/* sofia-prepping.com — "operations console" design.
   Near-black ground, hairline borders, square corners, IBM Plex Sans for text and
   IBM Plex Mono for labels, codes and times. Amber is the only accent. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

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

/* Elements with display rules (flex cards etc.) must still disappear when hidden */
[hidden] {
    display: none !important;
}

:root {
    --bg: #0A0C0F;
    --surface: #0F1216;
    --surface-2: #14181D;
    --line: #1F252D;
    --line-soft: #161B21;
    --line-strong: #2A323C;
    --text: #E6E9ED;
    --text-2: #B4BCC6;
    --muted: #8B95A1;
    --dim: #76818E;  /* lightest grey that still reads 4.5:1 on every panel */
    --accent: #F2A93B;
    --accent-bg: #14110B;
    --ok: #4CC38A;
    --warn: #F2A93B;
    --danger: #FF8A3D;
    --alert: #FF5D5D;
    --info: #7FB2FF;
    --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --gutter: 24px;
    --max: 1400px;

    /* Older names, still read by listovka.css */
    --text-primary: var(--text);
    --text-secondary: var(--text-2);
    --primary-color: var(--accent);
    --background: var(--bg);
    --border: var(--line);
}

html {
    scroll-padding-top: 80px;
}

body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    /* IBM Plex switches to Bulgarian letter shapes for lang="bg"; keep the standard Cyrillic forms */
    font-feature-settings: 'locl' 0;
}

a {
    color: var(--text);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Embedded maps (Google My Maps) show the same ring when tabbed to */
iframe:focus-visible,
iframe:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* "Skip to content" link, the first Tab stop on every page; hidden until focused */
.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 2000;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--bg);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.skip-link:focus {
    top: 8px;
    color: var(--bg);
}

button,
select,
input {
    font: inherit;
    color: inherit;
}

/* ---------- Notice strip + navbar ---------- */

.notice-strip {
    background: var(--accent);
    color: var(--bg);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    padding: 4px 16px;
}

.navbar {
    background: rgba(10, 12, 15, 0.94);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.nav-container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 8px var(--gutter);
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.nav-brand {
    order: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
    color: var(--text);
}

.brand-mark {
    stroke: var(--accent);
    stroke-width: 1.5;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.08em;
}

.brand-slash {
    color: var(--accent);
}

.nav-links {
    order: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-right: auto;
}

.nav-link {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 12px;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.district-select {
    order: 2;
    height: 40px;
    min-width: 0;
    max-width: 220px;
    padding: 0 32px 0 12px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238B95A1' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    appearance: none;
    cursor: pointer;
}

.district-select option {
    background: var(--surface);
    color: var(--text);
    text-transform: none;
}

.lang-toggle {
    order: 3;
    height: 40px;
    min-width: 44px;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    font-family: var(--mono);
    font-size: 12px;
    cursor: pointer;
}

.lang-toggle:hover,
.district-select:hover {
    border-color: var(--muted);
}

.nav-clock {
    order: 4;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    padding-left: 12px;
    border-left: 1px solid var(--line);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */

.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 32px var(--gutter);
}

.container.home {
    padding-top: 24px;
    padding-bottom: 0;
}

.container.home:last-of-type {
    padding-bottom: 48px;
}

.grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

header {
    margin-bottom: 24px;
}

header h1 {
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.01em;
}

header h1::before {
    content: '//';
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 500;
    margin-right: 14px;
    font-size: 0.6em;
    vertical-align: 0.25em;
}

.h1-icon {
    display: none;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.breadcrumb a {
    color: var(--accent);
}

.breadcrumb a:hover {
    color: var(--text);
}

.breadcrumb span {
    color: var(--dim);
}

/* Panels (old name: .card) */
.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
}

.card {
    padding: 24px;
}

.card h2,
.panel-head h2 {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
}

.card h2 {
    margin: -24px -24px 20px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px;
    min-height: 52px;
    border-bottom: 1px solid var(--line);
}

.panel-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 20px;
}

.kicker {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.card-text {
    color: var(--text-2);
    max-width: 70ch;
    margin-bottom: 16px;
}

.steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    margin-bottom: 20px;
}

.steps li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text-2);
}

.steps li:last-child {
    border-bottom: none;
}

.steps strong {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-right: 8px;
}

.loading,
.error,
.status-empty {
    color: var(--muted);
    font-size: 14px;
    padding: 8px 0;
}

.error {
    color: var(--alert);
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    min-height: 44px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.link-button:hover {
    color: var(--text);
}

.district-note {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
}

.district-note:empty {
    display: none;
}

.district-note .link-button {
    min-height: 32px;
}

/* Buttons */
.btn-primary,
.modal-nav-btn,
.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 0;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary:hover,
.modal-nav-btn:hover,
.link-btn:hover {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.btn-primary::after {
    content: '↗';
}

/* ---------- Home: map + assessment ---------- */

.hero {
    border-bottom: 1px solid var(--line);
}

.hero-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 24px var(--gutter);
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: stretch;
}

.hero-map {
    isolation: isolate;  /* keep Leaflet's z-indexes inside the map, under the sticky navbar */
    flex: 999 1 560px;
    min-width: 0;
    position: relative;
    min-height: 620px;
    border: 1px solid var(--line);
    background: #0D1014;
    overflow: hidden;
}

.home-map {
    position: absolute;
    inset: 0;
    background: #0D1014;
}

.map-layers {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 500;
    width: 260px;
    max-width: calc(100% - 32px);
    background: rgba(10, 12, 15, 0.94);
    border: 1px solid var(--line-strong);
}

.map-layers-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
}

.map-layers-head:hover {
    background: var(--surface-2);
}

.map-layers-title {
    font-weight: 600;
    margin-right: auto;
}

.map-layers-count {
    color: var(--muted);
}

.map-layers-chevron {
    color: var(--muted);
    transform: rotate(180deg);
    transition: transform 0.15s;
}

.map-layers.collapsed .map-layers-chevron {
    transform: none;
}

.map-layers.collapsed .map-layers-head {
    border-bottom: none;
}

.map-layers.collapsed .map-layers-body {
    display: none;
}

.map-layers.collapsed {
    width: auto;
}

.map-layers-list {
    padding: 4px 14px 6px;
}

.map-layers-actions {
    display: flex;
    border-top: 1px solid var(--line);
}

.map-layers-actions button {
    flex: 1 1 0;
    min-height: 38px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.map-layers-actions button + button {
    border-left: 1px solid var(--line);
}

.map-layers-actions button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.layer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    font-size: 13px;
    cursor: pointer;
}

.layer-row input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.layer-row.empty {
    color: var(--dim);
}

.layer-name {
    flex: 1 1 auto;
}

.layer-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.swatch {
    flex-shrink: 0;
}

.map-foot {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 500;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.map-foot > * {
    pointer-events: auto;
}

.map-scroll-hint {
    position: absolute;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 7, 10, 0.55);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.map-scroll-hint.show {
    opacity: 1;
}

.map-credit {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(10, 12, 15, 0.9);
    border: 1px solid var(--line);
    padding: 4px 8px;
}

.hero-status {
    flex: 1 1 380px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
}

.assessment {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-bottom: 1px solid var(--line);
}

.assessment-title {
    font-size: 32px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.assessment-word.level-1 { color: var(--ok); }
.assessment-word.level-2 { color: var(--warn); }
.assessment-word.level-3 { color: var(--danger); }
.assessment-word.level-4 { color: var(--alert); }

.assessment-summary {
    font-size: 13px;
    color: var(--text-2);
}

.readiness {
    display: flex;
    gap: 4px;
}

.readiness span {
    flex: 1 1 0;
    height: 6px;
    background: var(--line);
}

.readiness span.on {
    background: var(--tone);
}

.readiness-scale {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Indicator rows */
.tone-green { --tone: var(--ok); }
.tone-yellow { --tone: var(--warn); }
.tone-orange { --tone: var(--danger); }
.tone-red { --tone: var(--alert); }
.tone-active { --tone: var(--accent); }
.tone-neutral { --tone: var(--info); }
.tone-na { --tone: var(--muted); }

.status-tiles {
    display: flex;
    flex-direction: column;
}

.status-tiles .loading {
    padding: 16px 20px;
}

.status-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    color: var(--text);
    cursor: pointer;
}

.status-tile:hover {
    background: var(--surface-2);
    color: var(--text);
}

.status-tile.open {
    background: var(--surface-2);
    box-shadow: inset 3px 0 0 var(--text);
}

.status-tile.tone-yellow,
.status-tile.tone-orange,
.status-tile.tone-red,
.status-tile.tone-active {
    background: var(--accent-bg);
    box-shadow: inset 3px 0 0 var(--tone);
}

.status-code {
    flex: 0 0 22px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--dim);
}

.status-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 14px;
    color: var(--text-2);
}

.status-note {
    font-size: 12px;
    color: var(--muted);
}

.status-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    text-align: right;
}

.status-value {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.tone-active .status-value,
.tone-yellow .status-value,
.tone-orange .status-value,
.tone-red .status-value {
    color: var(--tone);
}

.tone-na .status-value {
    color: var(--muted);
}

.status-tag {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 6px;
    color: var(--tone);
    border: 1px solid var(--tone);
    white-space: nowrap;
}

.tone-yellow .status-tag,
.tone-orange .status-tag,
.tone-red .status-tag,
.tone-active .status-tag {
    background: var(--tone);
    color: var(--bg);
}

.status-updated {
    margin-top: auto;
    padding: 12px 20px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.status-updated::before {
    content: '●';
    color: var(--ok);
    margin-right: 8px;
}

.status-updated:empty::before {
    content: none;
}

/* Detail panel, opened under the clicked indicator row */
.status-detail {
    padding: 16px 20px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: inset 3px 0 0 var(--text);
    max-height: 340px;
    overflow-y: auto;
}

.status-tile::after {
    content: '+';
    flex: 0 0 auto;
    width: 14px;
    font-family: var(--mono);
    color: var(--dim);
    text-align: center;
}

.status-tile.open::after {
    content: '−';
    color: var(--text);
}

.status-tile:hover::after {
    color: var(--accent);
}

.status-detail h3 {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.status-detail h3:not(:first-child) {
    margin-top: 20px;
}

.status-row {
    padding: 10px 14px;
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--line-strong);
    margin-bottom: 6px;
    background: var(--bg);
}

.status-row.level-yellow { border-left-color: var(--warn); }
.status-row.level-orange { border-left-color: var(--danger); }
.status-row.level-red { border-left-color: var(--alert); }

.status-row-title {
    font-weight: 600;
    font-size: 14px;
}

.status-row-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.status-row a,
.status-source a {
    color: var(--accent);
}

.status-source {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-top: 12px;
}

.panel-foot .status-source {
    margin: 0;
    flex: 1 1 320px;
}

/* Ticker */
.ticker {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.ticker-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--gutter);
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 16px;
    white-space: nowrap;
    overflow: hidden;
}

.ticker-stamp {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--accent);
    padding: 2px 8px;
}

.ticker-text {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-2);
    font-size: 14px;
}

.ticker-text:empty::before {
    content: '…';
}

/* Protocol tiles */
.protocols {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 1px;
    padding: 1px;
    margin: 8px 0 24px;
}

.protocol {
    --c: var(--accent);
    background: var(--bg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 96px;
    color: var(--text);
    transition: background 0.15s;
}

.protocol:hover {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--c);
}

.protocol-icon {
    flex: 0 0 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
    background: color-mix(in srgb, var(--c) 8%, transparent);
}

.protocol-icon svg {
    fill: none;
    stroke: var(--c);
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.protocol-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.protocol strong {
    font-weight: 600;
    font-size: 17px;
    line-height: 1.3;
}

.protocol small {
    font-size: 13px;
    color: var(--muted);
}

.protocol-arrow {
    font-family: var(--mono);
    font-size: 16px;
    color: var(--dim);
    transition: transform 0.15s, color 0.15s;
}

.protocol:hover .protocol-arrow {
    color: var(--c);
    transform: translateX(3px);
}

/* Feed + sources row */
.home-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
}

.news-feed-card {
    flex: 999 1 600px;
    min-width: 0;
}

.links-card {
    flex: 1 1 320px;
    min-width: 0;
}

.news-tabs {
    display: flex;
}

.news-tab {
    min-height: 36px;
    padding: 0 14px;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--line-strong);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.news-tab + .news-tab {
    border-left: none;
}

.news-tab:hover {
    color: var(--text);
}

.news-tab.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.news-list {
    color: var(--muted);
}

.news-list:not(:has(.news-item)) {
    padding: 16px 20px;
}

.news-item {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 4px 16px;
    align-items: baseline;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text);
}

.news-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-transform: uppercase;
}

.news-date {
    order: -1;
    color: var(--accent);
    font-size: 12px;
    width: 100%;
}

.news-source::after {
    content: ' /';
    color: var(--dim);
}

.news-section {
    color: var(--muted);
}

.news-new {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--bg);
    padding: 0 6px;
}

.news-title-text {
    font-size: 15px;
    line-height: 1.45;
}

.link-groups {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.link-group h3 {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    font-size: 13px;
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    color: var(--text-2);
}

.chip:hover {
    border-color: var(--accent);
    color: var(--text);
}

.emergency {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    font-size: 13px;
    color: var(--text-2);
}

.emergency strong {
    font-family: var(--mono);
    font-size: 18px;
    color: var(--text);
    padding-left: 6px;
}

/* ---------- Galleries (Карти, Документи, Райони) ---------- */

/* Hairline grids: every cell draws its own 1px outline over the 1px gap, so a short last row
   leaves empty space instead of a filled block */
.map-item,
.protocol,
.nearest-item,
.siren-item,
.sheet-card {
    box-shadow: 0 0 0 1px var(--line);
}

.map-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1px;
    padding: 1px;
}

.section-anchor {
    grid-column: 1 / -1;
    scroll-margin-top: 140px;
    background: var(--surface);
}

.section-letter {
    grid-column: 1 / -1;
    background: var(--surface);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--accent);
    padding: 16px 16px 8px;
}

.map-item {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    cursor: pointer;
    color: var(--text);
}

.map-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.map-item img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    display: block;
    filter: grayscale(0.4) brightness(0.85);
    border-bottom: 1px solid var(--line);
    transition: filter 0.2s;
}

.map-item:hover img {
    filter: none;
}

.map-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
}

.map-label::after {
    content: '→';
    font-family: var(--mono);
    color: var(--dim);
}

.map-item:hover .map-label::after {
    color: var(--accent);
}

.map-thumb-icon {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 24px 24px,
        #0D1014;
}

.map-thumb-icon svg {
    stroke: var(--accent);
    fill: none;
    stroke-width: 1.5;
}

.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
}

.quick-nav-btn {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-2);
}

.quick-nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    font-family: var(--mono);
    color: var(--text);
    z-index: 900;
}

.back-to-top:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- Modal ---------- */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(5, 7, 10, 0.96);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 16px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: 36px;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
    z-index: 2001;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92%;
    max-height: 85vh;
}

.modal-content {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border: 1px solid var(--line-strong);
}

.modal-content:not([src]),
.modal-content[src=""] {
    display: none;
}

.modal-caption {
    padding: 14px;
    text-align: center;
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-nav {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* ---------- Interactive map page ---------- */

.map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.type-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line-strong);
    border-radius: 0;
    font-size: 13px;
    cursor: pointer;
}

.type-chip .swatch {
    opacity: 0.4;
}

.type-chip.active {
    color: var(--text);
    border-color: var(--muted);
    background: var(--surface-2);
}

.type-chip.active .swatch {
    opacity: 1;
}

.type-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}

.layer-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.layer-actions button {
    background: none;
    border: none;
    min-height: 32px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.layer-actions button:hover {
    color: var(--text);
}

.leaflet-map {
    isolation: isolate;
    height: 68vh;
    min-height: 420px;
    border: 1px solid var(--line);
    background: #0D1014;
}

.nearest h3 {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 24px 0 10px;
}

.nearest-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1px;
    padding: 1px;
}

.nearest-item {
    background: var(--bg);
    padding: 14px 16px;
    cursor: pointer;
}

.nearest-item:hover {
    background: var(--surface-2);
}

.nearest-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.nearest-name {
    font-weight: 600;
    margin: 4px 0;
}

.nearest-meta {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-2);
}

.nearest-meta a,
.map-source a,
.freq-note a,
.card-text a {
    color: var(--accent);
}

.map-source,
.freq-note {
    margin-top: 16px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.embed-map {
    width: 100%;
    height: 68vh;
    min-height: 420px;
    border: 1px solid var(--line);
    display: block;
    filter: invert(0.92) hue-rotate(180deg) grayscale(0.3);
}

/* Leaflet, dark */
.tiles-dark {
    filter: invert(1) grayscale(1) brightness(0.85) contrast(1.2);
}

.leaflet-container {
    background: #0D1014;
    font-family: var(--sans);
}

.leaflet-bar,
.leaflet-touch .leaflet-bar {
    border: 1px solid var(--line-strong);
    border-radius: 0;
    box-shadow: none;
}

.leaflet-bar a,
.leaflet-bar a:hover {
    background: rgba(10, 12, 15, 0.94);
    color: var(--text);
    border-bottom-color: var(--line-strong);
    border-radius: 0 !important;
}

.leaflet-bar a:hover {
    color: var(--accent);
}

.leaflet-control-attribution {
    background: rgba(10, 12, 15, 0.8) !important;
    color: var(--muted);
    font-size: 10px;
}

.leaflet-control-attribution a {
    color: var(--text-2);
}

.leaflet-popup-content-wrapper {
    background: rgba(10, 12, 15, 0.97);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.leaflet-popup-content {
    margin: 12px 14px;
    font-size: 13px;
    line-height: 1.45;
    min-width: 180px;
}

.leaflet-popup-content strong {
    display: block;
    font-size: 14px;
    margin: 4px 0;
}

.leaflet-popup-content a {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.leaflet-popup-tip {
    background: var(--accent);
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--muted);
}

.popup-kind {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.popup-coords {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    margin-top: 6px;
}

/* ---------- Sirens ---------- */

.siren-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1px;
    padding: 1px;
}

.siren-item {
    background: var(--bg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.siren-name {
    font-weight: 600;
    font-size: 16px;
}

.siren-desc {
    font-size: 13px;
    color: var(--muted);
    flex: 1;
}

.siren-item audio {
    width: 100%;
    height: 40px;
    margin-top: 4px;
    filter: invert(0.9) grayscale(1);
}

.links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.link-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    font-weight: 600;
    font-size: 14px;
}

.link-item::after {
    content: '↗';
    font-family: var(--mono);
    color: var(--dim);
}

.link-item:hover {
    border-color: var(--accent);
}

.link-item span:empty {
    display: none;
}

/* ---------- Printable materials ---------- */

.print-intro {
    margin-bottom: 20px;
}

.sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1px;
    padding: 1px;
}

.sheet-card {
    background: var(--bg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sheet-card.mine {
    background: var(--accent-bg);
    box-shadow: 0 0 0 1px var(--line), inset 0 0 0 1px var(--accent);
}

.sheet-card-name {
    font-weight: 600;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sheet-card-actions {
    display: flex;
    gap: 6px;
}

.sheet-card-actions a {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border: 1px solid var(--line-strong);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-2);
}

.sheet-card-actions a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---------- Footer ---------- */

footer {
    border-top: 1px solid var(--line);
    margin-top: 32px;
}

.container footer {
    margin: 48px calc(-1 * var(--gutter)) -32px;
}

.footer-inner,
footer > p {
    max-width: var(--max);
    margin: 0 auto;
    padding: 20px var(--gutter);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
    :root {
        --gutter: 16px;
    }

    /* Thumb-sized tap targets (44px) on phones and tablets */
    .district-select,
    .lang-toggle,
    .news-tab,
    .chip,
    .map-layers-head,
    .map-layers-actions button,
    .sheet-card-actions a,
    .type-chip,
    .quick-nav-btn {
        min-height: 44px;
    }

    .district-select,
    .lang-toggle {
        height: 44px;
    }

    .chip {
        display: inline-flex;
        align-items: center;
        padding: 0 14px;
    }

    .chips {
        gap: 8px;
    }

    .layer-row {
        min-height: 44px;
    }

    .nav-brand,
    .breadcrumb a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .leaflet-touch .leaflet-bar a {
        width: 44px;
        height: 44px;
        line-height: 44px;
    }

    /* The headline strip wraps to two lines instead of being cut off */
    .ticker-inner {
        white-space: normal;
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .ticker-stamp {
        flex-shrink: 0;
        margin-top: 2px;
    }

    .ticker-text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        min-height: 44px;
    }

    .nav-container {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .nav-links {
        order: 5;
        width: 100%;
        margin: 0 -12px;
    }

    .nav-clock {
        display: none;
    }

    .district-select {
        margin-left: auto;
        max-width: 170px;
    }

    /* Map on top, layer list and button below it */
    .hero-map {
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .home-map {
        position: relative;
        height: 380px;
    }

    .map-layers {
        position: static;
        width: auto;
        max-width: none;
        border: none;
        border-top: 1px solid var(--line);
        background: var(--bg);
    }

    .map-layers-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        column-gap: 16px;
    }

    .map-foot {
        position: static;
        padding: 0 14px 14px;
        background: var(--bg);
    }

    .map-credit {
        display: none;
    }

    .assessment-title {
        font-size: 26px;
    }

    .news-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .card {
        padding: 18px;
    }

    .card h2 {
        margin: -18px -18px 16px;
        padding: 14px 18px;
    }
}

@media (max-width: 520px) {
    .nav-brand {
        margin-right: 0;
    }

    .nav-container {
        gap: 8px;
    }

    .nav-brand {
        gap: 8px;
    }

    .brand-mark {
        width: 22px;
        height: 22px;
    }

    .brand-text {
        font-size: 12px;
        letter-spacing: 0.04em;
    }

    .district-select {
        max-width: 124px;
        padding-right: 28px;
        background-position: right 10px center;
    }

    .map-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .map-credit {
        display: none;
    }
}

@media print {
    .notice-strip,
    footer {
        display: none !important;
    }
}
