:root {
    --primary-blue: #0a2a4a;
    --primary-blue-80: rgba(10, 42, 74, 0.8);
    --secondary-blue: #1a4a7a;
    --light-blue: #3a8abc;
    --beige: #f5f0e8;
    --ivory: #faf8f0;
    --white: #ffffff;
    --accent-burgundy: #8b1a4a;
    --accent-gold: #c4a35a;
    --shadow: 0 4px 20px rgba(0,0,0,0.15);
    --header-height: 64px;

    --font-primary: 'SPORE', 'Segoe UI', 'Roboto', sans-serif;
    --font-secondary: 'SPORE', 'Georgia', serif;
    --font-retro: 'SPORE', Arial;
    --font-name: 'Pacifico', 'Segoe UI', 'Roboto', sans-serif;

    --gray-project: #808080;
    --gray-project-bg: #ececec;
    --attribution-height: 30px;
    --custom-attribution-width:150px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-primary);
    background: var(--beige);
    color: var(--primary-blue);
    height: 100vh;
    overflow: hidden;
    font-weight: 400;
    letter-spacing: 0.3px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-page { display: flex; justify-content: center; align-items: center; background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 50%, var(--light-blue) 100%); height: 100vh; }
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: var(--ivory); border-radius: 20px; padding: 40px 35px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.2); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-size: 2.2rem; font-family: var(--font-name); font-weight: 700; color: var(--primary-blue); margin-bottom: 8px; letter-spacing: 2px; }
.login-header p { font-family: var(--font-primary); color: #666; font-size: 1rem; font-weight: 400; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-family: var(--font-primary); font-weight: 600; margin-bottom: 6px; color: var(--primary-blue); letter-spacing: 0.5px; }
.login-form input { width: 100%; padding: 12px 16px; border: 2px solid #ddd; border-radius: 12px; font-family: var(--font-primary); font-size: 1rem; transition: border-color 0.3s; background: var(--white); }
.login-form input:focus { outline: none; border-color: var(--accent-gold); }
.login-btn { width: 100%; padding: 14px; background: var(--accent-burgundy); color: var(--white); border: none; border-radius: 12px; font-family: var(--font-primary); font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; letter-spacing: 1px; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(139, 26, 74, 0.4); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.error-message { color: var(--accent-burgundy); background: #ffe0e0; padding: 10px; border-radius: 8px; margin-bottom: 15px; font-family: var(--font-primary); font-weight: 500; }

/* ============================================================
   APP
   ============================================================ */
.app-container { display: flex; flex-direction: column; height: 100vh; position: relative; }
.app-header { position: relative; z-index: 1000; background: var(--primary-blue); color: var(--white); padding: 10px 25px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; border-bottom: 3px solid var(--accent-gold); flex-wrap: wrap; gap: 8px; height: var(--header-height); min-height: var(--header-height); }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-family: var(--font-name); font-size: 1.4rem; font-weight: 700; letter-spacing: 2px; }
.badge { background: var(--accent-gold); color: var(--primary-blue); padding: 2px 10px; border-radius: 20px; font-family: var(--font-primary); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px; }
/* Ставим центральный блок строго по центру экрана */
.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px; /* отступ между map-controls и basemap-dropdown */
}
.header-center .map-controls { display: flex; gap: 6px; }

/* Basemap dropdown */
.basemap-dropdown { position: relative; display: flex; align-items: center; }
.btn-basemap { background: rgba(255,255,255,0.15); color: var(--white); border: 1px solid rgba(255,255,255,0.2); padding: 5px 16px; border-radius: 20px; cursor: pointer; font-family: var(--font-primary); font-size: 0.85rem; transition: all 0.3s; display: flex; align-items: center; justify-content: center; vertical-align: middle; gap: 8px; }
.btn-basemap:hover { background: rgba(255,255,255,0.25); border-color: var(--accent-gold); }
.basemap-menu { display: none; position: absolute; top: 110%; left: 50%; transform: translateX(-50%); background: var(--white); min-width: 190px; border-radius: 8px; box-shadow: var(--shadow); z-index: 1000; border: 1px solid #e0d8cc; max-width: calc(100vw - 24px); max-height: calc(100dvh - 80px); overflow: visible; }
.basemap-menu.show { display: block; }
.basemap-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 16px; border: none; background: transparent; color: var(--primary-blue); cursor: pointer; font-family: var(--font-primary); font-size: 0.85rem; transition: all 0.2s; text-align: center; }
.basemap-option:hover { background: var(--beige); border-radius: 8px; }
.basemap-option.active { background: var(--beige); font-weight: 600; border-radius: 8px; }
.basemap-option.active::after { content: ' ✓'; color: var(--accent-gold); }

.header-right { display: flex; align-items: center; gap: 15px; }

/* ============================================================
   User menu (профиль + выход в выпадающем меню)
   ============================================================ */
.user-menu { position: relative; display: flex; align-items: center; }

.user-menu-toggle {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 5px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    white-space: nowrap;
}
.user-menu-toggle:hover {
    background: rgba(255,255,255,0.2);
    border-color: var(--accent-gold);
}
.user-menu-role { white-space: nowrap; }

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: fit-content;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid #e0d8cc;
    z-index: 1100;
    overflow: hidden;
}
.user-menu-dropdown.show { display: block; }

.user-menu-logout {
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--primary-blue);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    transition: background 0.15s;
}
.user-menu-logout:hover { background: var(--accent-burgundy); color: var(--white); font-weight: 700;}
.user-menu-logout:hover .icon { filter: brightness(0) invert(1); }
.user-menu-dropdown:hover {background: var(--white)}

/* Main */
.main-content { display: flex; flex: 1; overflow: hidden; position: relative; height: calc(100vh - var(--header-height)); }
.map-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; z-index: 1; }

/* Sidebar */
.sidebar { position: absolute; top: 0; right: 0; min-width: 340px; width: 600px; height: 100%; background: rgba(250, 248, 240, 0.95); backdrop-filter: blur(10px); border-left: 1px solid rgba(224, 216, 204, 0.5); display: flex; flex-direction: column; overflow: hidden; transition: all 0.3s ease; z-index: 100; box-shadow: -4px 0 20px rgba(0,0,0,0.1); }
.sidebar.collapsed { right: -340px; min-width: 0; width: 0; border-left: none; box-shadow: none; }
.sidebar-header { padding: 15px 30px; background: rgba(245, 240, 232, 0.9); border-bottom: 1px solid rgba(224, 216, 204, 0.5); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.sidebar-header h3 { font-family: var(--font-primary); font-size: 1rem; color: var(--primary-blue); display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.5px; }
.sidebar-controls { display: flex; gap: 8px; align-items: center; }
.btn-toggle { background: transparent; border: none; cursor: pointer; color: var(--secondary-blue); padding: 4px 8px; border-radius: 6px; transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-toggle:hover { background: rgba(26, 74, 122, 0.1); }

/* Sidebar open button */
.sidebar-open-btn { display: none; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: var(--white); border: 2px solid var(--accent-gold); border-radius: 50%; width: 44px; height: 44px; cursor: pointer; color: var(--primary-blue); box-shadow: var(--shadow); transition: all 0.3s; z-index: 99; align-items: center; justify-content: center; }
.sidebar-open-btn:hover { background: var(--beige); transform: translateY(-50%) scale(1.05); }
.sidebar-open-btn.show { display: flex; }

/* Search */
.search-box { padding: 12px 20px; flex-shrink: 0; position: relative; }
.search-box input { width: 100%; padding: 8px 14px 8px 38px; border: 2px solid rgba(221, 221, 221, 0.8); border-radius: 25px; font-family: var(--font-primary); font-size: 0.9rem; background: rgba(255,255,255,0.9); transition: border-color 0.3s; }
.search-box input:focus { outline: none; border-color: var(--accent-gold); }
.search-box .search-icon { position: absolute; left: 32px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* ============================================================
   Sidebar sections
   ============================================================ */
.sidebar-section { display: flex; flex-direction: column; flex-shrink: 0; border-bottom: 1px solid rgba(224, 216, 204, 0.5); min-height: 0; }
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section-grow { flex: 1 1 0; min-height: 0; overflow: hidden; }

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 30px;
    cursor: default;
    user-select: none;
    transition: background 0.15s;
    gap: 8px;
}
.sidebar-section-header:hover { background: rgba(26, 74, 122, 0.05); }
.sidebar-section-header h4 {
    font-family: var(--font-primary);
    font-size: 0.85rem;
    color: var(--secondary-blue);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.section-master-checkbox {
    margin: 0 8px 0 0;
    accent-color: var(--accent-burgundy);
    cursor: pointer;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.section-arrow {
    position: relative;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
    margin: -3px 4px -3px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    transform-origin: 50% 50%;
    transform: rotate(45deg);
}
.section-arrow::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--secondary-blue);
    border-bottom: 2px solid var(--secondary-blue);
    transform-origin: 50% 50%;
}
.sidebar-section.collapsed .section-arrow { transform: rotate(-45deg); }

.sidebar-section-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
    padding: 0 20px 12px;
    opacity: 1;
}
.sidebar-section.collapsed .sidebar-section-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}
.sidebar-section-grow .sidebar-section-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 20px;
    max-height: none;
}
.sidebar-section-grow .sidebar-section-body::-webkit-scrollbar { width: 4px; }
.sidebar-section-grow .sidebar-section-body::-webkit-scrollbar-thumb { background: var(--accent-gold); border-radius: 10px; }

/* ============================================================
   Секция категорий — скролл, если не влезает
   ============================================================ */
.sidebar-section[data-section-id="categories"] {
    flex: 0 0 auto;
    max-height: 40vh;
    min-height: 0;
    overflow: hidden;
}
.sidebar-section[data-section-id="categories"] .sidebar-section-body {
    overflow-y: auto;
    max-height: none;
    min-height: 0;
}
.sidebar-section[data-section-id="categories"] .sidebar-section-body::-webkit-scrollbar { width: 4px; }
.sidebar-section[data-section-id="categories"] .sidebar-section-body::-webkit-scrollbar-thumb {
    background: var(--accent-gold); border-radius: 10px;
}
.sidebar-section.collapsed[data-section-id="categories"] .sidebar-section-body {
    max-height: 0;
    overflow: hidden;
    flex: 0 0 auto;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* Filter */
.filter-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.filter-item {
    background: rgba(255,255,255,0.9);
    padding: 4px 12px;
    border-radius: 15px;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    border: 2px solid rgba(221, 221, 221, 0.8);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.filter-item:hover { background: var(--beige); }
.filter-item input[type="checkbox"] { margin: 0; accent-color: var(--accent-burgundy); cursor: pointer; }

/* ============================================================
   PROJECT TREE
   ============================================================ */
.project-tree { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }

.project-item {
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    border: 1px solid rgba(224, 216, 204, 0.6);
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.project-item:hover { border-color: rgba(196, 163, 90, 0.8); }

.project-item.active-project {
    box-shadow: 0 0 0 2px #c4a35a;
    border-color: transparent;
}

.project-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    cursor: default;
    user-select: none;
    font-family: var(--font-primary);
    font-size: 0.88rem;
    color: var(--primary-blue);
}
.project-header:hover { background: rgba(245, 240, 232, 0.6); }

.project-arrow {
    position: relative;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-right: 4px;
    margin-left: -2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    transform-origin: 50% 50%;
    transform: rotate(-45deg);
    pointer-events: auto;
}
.project-arrow::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--secondary-blue);
    border-bottom: 2px solid var(--secondary-blue);
    transform-origin: 50% 50%;
}
.project-item.expanded > .project-header > .project-arrow {
    transform: rotate(45deg);
}

.project-checkbox {
    margin: 0;
    accent-color: var(--accent-burgundy);
    cursor: pointer;
    flex-shrink: 0;
}

.project-name {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    transition: color 0.15s;
}
.project-name:hover { color: var(--accent-burgundy); }

.project-counts {
    font-size: 0.72rem;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.project-children {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
    background: rgba(245, 240, 232, 0.5);
    border-top: 0 dashed rgba(224, 216, 204, 0.8);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease, border-top-width 0.35s ease;
}
.project-item.expanded > .project-children {
    max-height: 3000px;
    padding: 8px;
    opacity: 1;
    border-top-width: 1px;
}

.project-child {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 6px;
    font-family: var(--font-primary);
    font-size: 0.82rem;
    border: 1px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
}
.project-child:hover {
    border-color: rgba(196, 163, 90, 0.6);
    filter: brightness(1.03);
}
.project-child input[type="checkbox"] { margin: 0; accent-color: var(--accent-burgundy); cursor: pointer; flex-shrink: 0; }

.child-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-name:hover { text-decoration: underline; text-decoration-color: var(--accent-gold); }

.category-badge {
    font-size: 0.68rem;
    padding: 1px 8px;
    border-radius: 10px;
    background: #f0ebe3;
    color: var(--primary-blue);
    border: 2px solid rgba(221, 221, 221, 0.8);
    flex-shrink: 0;
    white-space: nowrap;
    font-weight: 600;
}

.child-actions { display: flex; gap: 2px; flex-shrink: 0; }
.child-actions button { background: transparent; border: none; cursor: pointer; padding: 2px 5px; border-radius: 4px; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.child-actions button:hover { background: rgba(139, 26, 74, 0.1); }

.tree-empty { color: #888; text-align: center; padding: 20px 10px; font-size: 0.85rem; font-style: italic; }

/* Modal */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; }
.modal.show { display: flex; }
.modal-content { background: var(--ivory); border-radius: 20px; padding: 35px; max-width: 550px; width: 90%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); position: relative; }
.modal-close { position: absolute; right: 20px; top: 15px; cursor: pointer; color: #888; transition: color 0.3s; background: none; border: none; }
.modal-close:hover { color: var(--accent-burgundy); }
.modal-content h2 { font-family: var(--font-primary); color: var(--primary-blue); margin-bottom: 20px; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.5px; }
.modal-content .form-group { margin-bottom: 16px; }
.modal-content label { display: block; font-family: var(--font-primary); font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; color: var(--primary-blue); letter-spacing: 0.3px; }
.modal-content input, .modal-content select, .modal-content textarea { width: 100%; padding: 10px 14px; border: 2px solid #ddd; border-radius: 10px; font-family: var(--font-primary); font-size: 0.95rem; background: var(--white); transition: border-color 0.3s; }
.modal-content input:focus, .modal-content select:focus, .modal-content textarea:focus { outline: none; border-color: var(--accent-gold); }
.modal-content textarea { resize: vertical; font-family: 'Courier New', monospace; }
.btn-save { width: 100%; padding: 12px; background: var(--accent-burgundy); color: var(--white); border: none; border-radius: 12px; font-family: var(--font-primary); font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; letter-spacing: 0.5px; }
.btn-save:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(139, 26, 74, 0.3); }

/* ============================================================
   Retro
   ============================================================ */
.retro-btn { width: 50px; height: 50px; background: #ffffff; border: none; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease; }
.retro-btn:hover { background: #f5f9ff; box-shadow: 0 4px 15px rgba(0,0,0,0.15), 0 0 0 2px rgba(0, 123, 255, 0.4); }
.retro-btn:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.retro-btn-icon { width: 32px; height: 32px; object-fit: contain; pointer-events: none; }

#retro-container {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 50;
    font-family: var(--font-retro), sans-serif;
}

#time-controller-panel {
    display: none; background: white; padding: 16px 20px 20px 20px; border-radius: 12px; width: 420px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); position: absolute; bottom: 0; left: 0; box-sizing: border-box;
}

.custom-attribution-panel {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 99;
  height: var(--attribution-height);
  width: var(--custom-attribution-width);
  background: white;
  padding: 6px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease;

  /* Выравнивание содержимого по центру */
  display: flex;
  justify-content: center; /* по горизонтали */
  align-items: center;     /* по вертикали */
}

.custom-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  color: var(--primary-blue);
  font-family: var(--font-secondary);
  font-size: 0.7rem;
  font-weight: bold;
}

.custom-logo {
  display: block;
  width: 20px;
  height: auto;
  object-fit: contain;
}

.custom-attribution-panel:hover {
  background-color: #f8f9fa;
}


/* Атрибуция OL — отдельный блок, прижат вправо, но ЛЕВЕЕ плашки логотипа */
.map-attribution {
    position: absolute;
    bottom: 10px;
    right: calc(10px + var(--custom-attribution-width) + 8px);              /* ← левее плашки логотипа */
    z-index: 98;               /* чуть ниже плашки */
    height: var(--attribution-height);
    display: flex;
    /* flex-wrap: wrap; */
    align-items: flex-end;
    justify-content: flex-end;
    gap: 4px;
    max-width: 45vw;
    font-family: var(--font-secondary);
    font-size: 10px;
    line-height: 1.3;
    color: var(--primary-blue);
    text-align: right;
    pointer-events: auto;
    overflow: visible;
}

.map-attribution .ol-attribution {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    position: static;

    display: flex;
    /* flex-wrap: wrap; */
    align-items: flex-end;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.map-attribution .ol-attribution ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;                          /* ← перенос, если не влезает */
    align-items: flex-end;
    justify-content: flex-end;                /* ← вправо */
    gap: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    line-height: 1.25;
    color: var(--primary-blue);
    text-align: right;
    width: 100%;
    overflow: visible;
}

.map-attribution .ol-attribution li {
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.map-attribution .ol-attribution a {
    color: #061a2d;
    text-decoration: none;
    word-break: keep-all; 
}

.map-attribution .ol-attribution li,
.map-attribution .ol-attribution a {
    -webkit-text-stroke: 3px rgb(255, 255, 255);
    paint-order: stroke fill;
}

.map-attribution .ol-attribution a:hover {
    text-decoration: underline;
    -webkit-text-stroke: 4px rgb(255, 255, 255);
    paint-order: stroke fill;
    color: var(--accent-gold);
}

.map-attribution .ol-attribution button {
    display: none;             /* collapsible: false — кнопка не нужна */
}

.basemap-submenu-wrapper { position: relative; width: 100%; }
.basemap-submenu { display: none; position: absolute; top: 0; left: 100%; min-width: 90px; background-color: #fff; box-shadow: 2px 2px 5px rgba(0,0,0,0.2); border-radius: 8px; z-index: 10; }
.basemap-submenu-wrapper:hover > .basemap-submenu { display: block; }
.basemap-submenu .basemap-option { display: flex; align-items: center; width: 100%; text-align: left; white-space: nowrap; }
.btn-icon, .btn-text { flex: 0.6; width: 50%; }
.btn-icon { object-fit: contain; margin: 0 auto; }
.btn-text { text-align: center; }
.basemap-submenu-wrapper:has(.basemap-option.active) > .parent-option { font-weight: 600; }

#current-time-label { color: #1a4a7a; }
.retro-clickable { transition: color 0.15s ease, background-color 0.15s ease; border-radius: 6px; }
.retro-clickable:hover { background-color: rgba(26, 74, 122, 0.08); }
.retro-clickable:hover #current-time-label, .retro-clickable:hover span { color: #0d2c4d; }
.retro-clickable:active { background-color: rgba(26, 74, 122, 0.16); }

.retro-now-btn { background: #1a4a7a; color: #fff; border: none; cursor: pointer; padding: 6px 16px; border-radius: 6px; font-family: var(--font-retro); font-size: 1rem; white-space: nowrap; flex: 0 0 auto; transition: background-color 0.15s ease, transform 0.05s ease; }
.retro-now-btn:hover { background: #14395e; }
.retro-now-btn:active { transform: translateY(1px); }

.retro-close-btn { background: none; border: none; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: background-color 0.15s ease; }
.retro-close-btn:hover { background-color: rgba(0, 0, 0, 0.06); }

.retro-slider-wrap { position: relative; width: 100%; height: 56px; padding: 0; font-family: var(--font-retro); box-sizing: border-box; }
.retro-slider-ticks { position: absolute; left: 10px; right: 10px; top: 4px; height: 10px; pointer-events: none; }
.retro-slider-ticks .tick { position: absolute; bottom: 0; width: 1px; background: #b8c5d3; transform: translateX(-50%); }
.retro-slider-ticks .tick.major { width: 2px; height: 10px; background: #1a4a7a; }
.retro-slider-ticks .tick.minor { height: 6px; background: #b8c5d3; }
.retro-slider-labels { position: absolute; left: 10px; right: 10px; bottom: 0; height: 16px; pointer-events: none; }
.retro-slider-labels .label { position: absolute; bottom: 0; font-size: 10px; color: #666; transform: translateX(-50%); white-space: nowrap; font-family: var(--font-retro), Arial, sans-serif; }
.retro-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; cursor: pointer; margin: 18px 0 0 0; outline: none; position: relative; z-index: 2; }
.retro-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #cfd9e3; border: 1px solid #c0cad4; }
.retro-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; border: 3px solid #1a4a7a; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); cursor: pointer; margin-top: -8px; transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.retro-slider::-webkit-slider-thumb:hover { background: #eaf1f8; box-shadow: 0 0 0 6px rgba(26, 74, 122, 0.12), 0 1px 4px rgba(0, 0, 0, 0.25); }
.retro-slider::-webkit-slider-thumb:active { transform: scale(1.1); background: var(--white); border-color: #0d2c4d; }
.retro-slider::-moz-range-track { height: 6px; border-radius: 3px; background: #cfd9e3; border: 1px solid #c0cad4; }
.retro-slider::-moz-range-progress { height: 6px; border-radius: 3px; background: #1a4a7a; }
.retro-slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #ffffff; border: 3px solid #1a4a7a; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); cursor: pointer; transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.retro-slider::-moz-range-thumb:hover { background: #eaf1f8; box-shadow: 0 0 0 6px rgba(26, 74, 122, 0.12), 0 1px 4px rgba(0, 0, 0, 0.25); }
.retro-slider::-moz-range-thumb:active { transform: scale(1.1); background: var(--white); border-color: #0d2c4d; }

.ol-scale-line { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: var(--primary-blue-80); border-radius: 3px; padding: 2px; pointer-events: none; user-select: none; }
.ol-scale-line-inner { color: #eee; border-color: #eee; font-size: 11px; }

/* ============================================================
   prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .sidebar { transition: none; }
}