/* Self-hosted Noto Sans for MapLibre local label rendering (see static/fonts/). */
@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/NotoSans-Regular-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/NotoSans-Regular-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/NotoSans-Regular-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

html, body {
  margin: 0;
  height: 100%;
}

.profile-page {
  min-height: 100%;
  display: flex;
  /* Column so the admin usage block stacks under the card instead of beside
     it; with a single child this renders exactly as it did before. */
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 48px 16px;
  box-sizing: border-box;
  background: #f5f7fa;
}

.profile-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.profile-avatar {
  width: 128px;
  height: 128px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  background: #e2e8f0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 600;
  color: #64748b;
}

.profile-name {
  margin: 0 0 12px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  color: #1e293b;
}

.profile-description {
  margin: 0 0 20px;
  color: #475569;
  line-height: 1.5;
  white-space: pre-line;
}

.profile-contacts {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.profile-contact a {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #2b5f92;
  text-decoration: none;
  font-size: 0.95rem;
}

.profile-contact a:hover {
  background: #eef2f7;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-edit,
.profile-editor,
.profile-logout {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.profile-edit {
  background: #2b5f92;
  border: 1px solid #2b5f92;
  color: #fff;
}

.profile-edit:hover {
  background: #24507d;
  border-color: #24507d;
}

.profile-editor {
  background: #fff;
  border: 1px solid #2b5f92;
  color: #2b5f92;
}

.profile-editor:hover {
  background: #eef4fb;
}

.profile-logout {
  background: #fff;
  border: 1px solid #c0392b;
  color: #c0392b;
}

.profile-logout:hover {
  background: #fdecec;
}

.profile-admin-link {
  margin: 0 0 20px;
  text-align: center;
}

.profile-admin-link a {
  color: #2b5f92;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.profile-admin-link a:hover {
  text-decoration: underline;
}

.profile-back {
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.profile-back a {
  color: #2b5f92;
  text-decoration: none;
}

.profile-back a:hover {
  text-decoration: underline;
}

/* Technical block styles kept for historical snapshots; the live tariff UI
   lives in the editor (UserUsagePanel). */
.usage-block {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  font-size: 14px;
  color: #2d3b47;
}

.usage-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.usage-plan,
.usage-period,
.usage-outcomes,
.usage-empty {
  margin: 0 0 8px;
}

.usage-period.is-lapsed {
  color: #c0392b;
  font-weight: 600;
}

.usage-resource {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  margin-bottom: 10px;
}

.usage-resource-figures {
  font-variant-numeric: tabular-nums;
  color: #5a6b78;
}

.usage-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}

.usage-bar-fill {
  display: block;
  height: 100%;
  background: #2b5f92;
}

.usage-bar-fill.is-exhausted {
  background: #c0392b;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.usage-table th,
.usage-table td {
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px solid #eef2f6;
  font-variant-numeric: tabular-nums;
}

.usage-table th:first-child,
.usage-table td:first-child {
  text-align: left;
  font-variant-numeric: normal;
}

.usage-table th {
  font-weight: 600;
  color: #5a6b78;
}

.usage-history {
  margin: 12px 0;
  color: #5a6b78;
}

.usage-history summary {
  cursor: pointer;
}

.usage-history-row {
  padding: 4px 0 0 12px;
}

.usage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.usage-upgrade {
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef4fb;
  color: #24507d;
}

.usage-date {
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}

.usage-plan-select {
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}

.usage-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #2b5f92;
  background: #fff;
  color: #2b5f92;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.usage-btn:hover {
  background: #eef4fb;
}

.usage-btn-danger {
  border-color: #c0392b;
  color: #c0392b;
}

.usage-btn-danger:hover {
  background: #fdecec;
}

.usage-error {
  margin: 12px 0 0;
  color: #c0392b;
}

#map {
  position: absolute;
  inset: 0;
}

.lang-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.85em;
  color: #5a6b78;
}

.copy-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.8em;
  color: #8a97a2;
}

#copy-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 40;
  transform: translate(-50%, 8px);
  padding: 9px 16px;
  border-radius: 20px;
  background: rgba(26, 42, 56, 0.92);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#copy-toast.open {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Site logo: desktop float (hover 50→100) vs mobile-in-menu (fixed 50). */
.site-logo {
  line-height: 0;
  text-decoration: none;
  opacity: 0.75;
}

.site-logo img {
  display: block;
  width: 50px;
  height: 50px;
}

.site-logo--float {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 15;
  width: 40px;
  height: 40px;
  transform-origin: top left;
  transition: transform 0.2s ease;
}

.site-logo--float img {
  width: 40px;
  height: 40px;
}

@media (hover: hover) and (pointer: fine) {
  .site-logo--float:hover {
    /* 40px → 100px */
    transform: scale(2.5);
  }
}

.site-logo--menu {
  display: none;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
}

#map-menu .site-logo--menu {
  padding: 10px 14px;
  width: auto;
  height: auto;
  border-bottom: 1px solid #eef2f6;
}

/* Loading: spin the logo image (not the <a>, which uses scale on hover). */
.site-logo.is-logo-spinning img {
  animation: similarity-spin 3.2s linear infinite;
}

.site-logo.is-logo-stopping img {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .site-logo.is-logo-spinning img,
  .site-logo.is-logo-stopping img {
    animation: none;
    transition: none;
  }
}

#toolbar {
  position: absolute;
  top: 12px;
  left: 64px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#toolbar label {
  font-size: 13px;
  color: #333;
}

/* Keep a label and its field together so they never wrap separately. */
.field-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The collapse toggle is only relevant on small screens. */
#toolbar-toggle {
  display: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  cursor: pointer;
  line-height: 1;
}

#word {
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  min-width: 200px;
}

#word:focus {
  border-color: #4a90d9;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

#threshold,
#cluster-basis,
#user-country {
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #333;
  cursor: pointer;
}

#threshold:focus,
#cluster-basis:focus,
#user-country:focus {
  border-color: #4a90d9;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

#translate-btn {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #4a90d9;
  color: #fff;
  cursor: pointer;
}

#translate-btn:hover {
  background: #3b7dc0;
  border-color: #3b7dc0;
}

#clusterize-btn {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
}

#clusterize-btn:hover:not(:disabled) {
  background: #eef4fb;
}

#clusterize-btn:disabled {
  border-color: #ccc;
  color: #9aa5ae;
  background: #f2f3f5;
  cursor: not-allowed;
}

/* Group the База field, state lamp and Кластеризовать button inside a
   framed box with a little breathing room on each side. */
.cluster-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px;
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

/* Clustering-state indicator ("lamp") next to the Кластеризовать button.
   Dim when clustering is off; lit (and clickable to exit) when it is on. */
.cluster-lamp {
  width: 16px;
  height: 16px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid #b9c2cb;
  border-radius: 50%;
  background: #e4e8ec;
  cursor: default;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.cluster-lamp.on {
  border-color: #2e9e5b;
  background: #35c46b;
  box-shadow: 0 0 6px rgba(53, 196, 107, 0.7);
  cursor: pointer;
}

#export-btn {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
}

#export-btn:hover {
  background: #eef4fb;
}

#map-edit-toggle {
  font-size: 15px;
  line-height: 1;
  padding: 7px 12px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
}

#map-edit-toggle:hover {
  background: #eef4fb;
}

#share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 6px 10px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
}

#share-btn:hover {
  background: #eef4fb;
}

#similarity-spinner {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  /* Transparent overlay that also intercepts clicks while active. */
  background: rgba(255, 255, 255, 0.05);
  cursor: progress;
}

#similarity-spinner.open {
  display: flex;
}

#similarity-spinner .spinner {
  width: 54px;
  height: 54px;
  border: 5px solid rgba(74, 144, 217, 0.25);
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: similarity-spin 0.8s linear infinite;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

@keyframes similarity-spin {
  to {
    transform: rotate(360deg);
  }
}

#export-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#export-modal.open {
  display: flex;
}

#export-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 20px 22px;
  width: 320px;
  max-width: calc(100vw - 32px);
}

#export-card h2 {
  margin: 0 0 12px;
  font-size: 17px;
  color: #222;
}

#export-card label {
  display: block;
  font-size: 13px;
  color: #444;
  margin-bottom: 6px;
}

#export-scale {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
}

#export-hint {
  font-size: 12px;
  color: #777;
  margin: 8px 0 16px;
}

#export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#export-actions button {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #f4f4f4;
  color: #333;
}

#export-confirm {
  border-color: #4a90d9 !important;
  background: #4a90d9 !important;
  color: #fff !important;
}

#export-confirm:hover {
  background: #3b7dc0 !important;
  border-color: #3b7dc0 !important;
}

/* --- API / WebSocket error modal --- */
#error-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#error-modal.open {
  display: flex;
}

#error-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 20px 22px;
  width: 360px;
  max-width: calc(100vw - 32px);
}

#error-card h2 {
  margin: 0 0 12px;
  font-size: 17px;
  color: #222;
}

#error-modal-message {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

#error-modal-actions {
  display: flex;
  justify-content: flex-end;
}

#error-modal-ok {
  font-size: 14px;
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #4a90d9;
  background: #4a90d9;
  color: #fff;
}

#error-modal-ok:hover {
  background: #3b7dc0;
  border-color: #3b7dc0;
}

/* --- Confirm modal (Mapus.showConfirmModal) --- */
#confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#confirm-modal.open {
  display: flex;
}

#confirm-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 20px 22px;
  width: 360px;
  max-width: calc(100vw - 32px);
}

#confirm-card h2 {
  margin: 0 0 12px;
  font-size: 17px;
  color: #222;
}

#confirm-modal-message {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

#confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#confirm-modal-actions button {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #f4f4f4;
  color: #333;
}

#confirm-modal-actions button:hover {
  background: #eaeaea;
}

#confirm-modal-ok {
  border-color: #4a90d9 !important;
  background: #4a90d9 !important;
  color: #fff !important;
}

#confirm-modal-ok:hover {
  background: #3b7dc0 !important;
  border-color: #3b7dc0 !important;
}

/* --- POI detail modal --- */
#poi-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#poi-modal.open {
  display: flex;
}

#poi-card {
  position: relative;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 20px 22px;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

#poi-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #666;
  cursor: pointer;
}

#poi-close:hover {
  color: #222;
}

#poi-title {
  margin: 0 0 10px;
  font-size: 19px;
  color: #1a2a38;
  padding-right: 28px;
}

#poi-description {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #384652;
  white-space: pre-wrap;
}

#poi-link {
  display: inline-block;
  margin: 0 0 14px;
  font-size: 14px;
  color: #2f6fed;
  word-break: break-all;
}

#poi-gallery {
  position: relative;
  margin: 0 0 16px;
  background: #f2f4f7;
  border-radius: 8px;
  overflow: hidden;
}

#poi-image {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #f2f4f7;
}

#poi-prev,
#poi-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(26, 42, 56, 0.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#poi-prev:hover,
#poi-next:hover {
  background: rgba(26, 42, 56, 0.8);
}

#poi-prev {
  left: 10px;
}

#poi-next {
  right: 10px;
}

#poi-counter {
  position: absolute;
  right: 10px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(26, 42, 56, 0.6);
  color: #fff;
  font-size: 12px;
}

#poi-data {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 6px 14px;
  font-size: 13px;
}

#poi-data dt {
  font-weight: 600;
  color: #55636e;
  word-break: break-word;
}

#poi-data dd {
  margin: 0;
  color: #1a2a38;
  word-break: break-word;
}

#about-btn {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 10;
  font-size: 14px;
  padding: 8px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#about-btn:hover {
  background: #eef4fb;
}

.map-footer-bar {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 30px;
}

/* Hamburger menu is mobile-only; shown via the max-width media query. */
#map-menu-wrap {
  display: none;
}

/* AI dialog: compact, collapsible dock centered at the bottom of the map.
   Sits between the footer bar (bottom-left) and the legend (bottom-right).
   Draggable within #map (see map_ai.js); above persistent map chrome. */
.ai-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 50;
  width: min(588px, calc(100vw - 24px));
  border: 1px solid #d4dde5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.ai-dock--moved {
  right: auto;
  bottom: auto;
  transform: none;
}

.ai-dock--returning {
  transition: left 2s ease, top 2s ease;
}

.ai-dock--dragging {
  user-select: none;
}

.ai-dock-toggle,
#ai-dock-toggle {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #2b5f92;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: grab;
  touch-action: none;
}

.ai-dock--dragging #ai-dock-toggle {
  cursor: grabbing;
}

.ai-dock:not(.collapsed) #ai-dock-toggle {
  border-radius: 8px 8px 0 0;
}

#ai-dock-toggle::before {
  content: "\25B2\00A0";
  font-size: 10px;
}

.ai-dock.collapsed #ai-dock-toggle::before {
  content: "\25BC\00A0";
}

.ai-dock-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-dock-body[hidden] {
  display: none;
}

#ai-prompt {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 8px;
  border: 1px solid #d4dde5;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
}

.ai-upload-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 13px;
  color: #5a6b78;
}

.ai-upload-wrap[hidden] {
  display: none;
}

.ai-upload-label {
  flex-shrink: 0;
}

.ai-dock-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#ai-send {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
}

#ai-send:hover:not(:disabled) {
  background: #eef4fb;
}

#ai-send:disabled {
  opacity: 0.6;
  cursor: default;
}

#ai-publish {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #4a90d9;
  color: #fff;
  cursor: pointer;
}

#ai-publish[hidden] {
  display: none;
}

#ai-publish:hover:not(:disabled) {
  background: #3b7cc4;
}

#ai-publish:disabled {
  opacity: 0.6;
  cursor: default;
}

#ai-edit {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  cursor: pointer;
}

#ai-edit[hidden] {
  display: none;
}

#ai-edit:hover:not(:disabled) {
  background: #eef4fb;
}

#ai-edit:disabled {
  opacity: 0.6;
  cursor: default;
}

#ai-reset {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #d98a8a;
  border-radius: 6px;
  background: #fff;
  color: #a13b3b;
  cursor: pointer;
}

#ai-reset:hover:not(:disabled) {
  background: #fbeeee;
}

#ai-reset:disabled {
  opacity: 0.6;
  cursor: default;
}

/* «Отмена» shares the row with the outline-red «Сброс» while a request runs,
   so it takes the same red filled rather than outlined — the relationship
   #ai-publish already has with #ai-send. Two identical red outlines side by
   side would read as one control repeated. */
#ai-cancel {
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid #a13b3b;
  border-radius: 6px;
  background: #a13b3b;
  color: #fff;
  cursor: pointer;
}

#ai-cancel[hidden] {
  display: none;
}

#ai-cancel:hover:not(:disabled) {
  background: #8a3232;
}

#ai-cancel:disabled {
  opacity: 0.6;
  cursor: default;
}

.ai-dock .spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(74, 144, 217, 0.25);
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: similarity-spin 0.8s linear infinite;
}

.ai-dock .spinner[hidden] {
  display: none;
}

/* Live saga progress: an append-only journal, collapsed to its newest line
   until the user opens it. Capped in height so a six-task fan-out cannot push
   the dock off screen once open. */
.ai-progress-dock {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-progress-dock[hidden] {
  display: none;
}

/* The whole summary line is the disclosure control, so the hit area matches
   what it looks like it opens. */
.ai-progress-toggle {
  display: flex;
  /* Centre, not baseline: an empty summary has its baseline at the bottom of
     its reserved box, so baseline alignment would add the caret's descender on
     top of it and make the empty row *taller* than the filled one. */
  align-items: center;
  gap: 4px;
  width: 100%;
  /* One line is always reserved, so the dock does not grow when the first
     status arrives nor shrink when the last one is cleared on completion.
     The summary is a flex item, so it needs its own floor: an empty one is
     zero-height and would otherwise let the row collapse. */
  min-height: 1.5em;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
}

.ai-progress-caret {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 10px;
}

.ai-progress-last {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Same box empty or full: 1.5 x 12px is exactly the filled line box, so
     setting and clearing the text cannot move anything below it. */
  line-height: 1.5;
  min-height: 1.5em;
}

/* Opaque request id above the journal. Monospace so a paste-target is
   recognisable; click copies and appends «(скопировано)». */
.ai-progress-request-id {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 0 0 2px;
  text-align: left;
  font: inherit;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #64748b;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-progress-request-id[hidden] {
  display: none;
}

.ai-progress-request-id:hover {
  color: #334155;
}

.ai-progress {
  margin: 0;
  /* Right padding keeps the row's last control -- the ✕ -- clear of the
     scrollbar; scrollbar-gutter additionally stops the rows shifting sideways
     at the moment the list starts to scroll. */
  padding: 0 10px 0 0;
  scrollbar-gutter: stable;
  list-style: none;
  font-size: 12px;
  /* Fixed, not max-height: an arriving task must scroll the journal, never
     resize the dock under the cursor. The cost is empty space early in a run;
     the alternative is the panel growing line by line while it is read. */
  height: 180px;
  overflow-y: auto;
}

.ai-progress[hidden] {
  display: none;
}

/* A line about the answer rather than about one task -- today, that some of
   the data could not be fetched. Amber, because it is a caveat on the result,
   not a failure of the request. */
.ai-progress-note {
  color: #92400e;
  padding: 2px 0;
}

.ai-progress-task {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 1px 0;
  color: #334155;
}

/* Fixed-width mark and right-aligned status, so rows do not jump sideways as
   statuses change under them. */
.ai-progress-mark {
  width: 1em;
  flex: 0 0 1em;
  text-align: center;
}

.ai-progress-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-progress-status {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 11px;
}

/* Empty for the statuses the mark already conveys; the margin would otherwise
   leave a gap between the label and the ✕. */
.ai-progress-status:empty {
  display: none;
}

/* Sits immediately right of the status, last in the row. */
.ai-progress-cancel {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  line-height: 1;
}

.ai-progress-cancel:hover:not(:disabled) {
  color: #b91c1c;
}

.ai-progress-cancel:disabled {
  opacity: 0.4;
  cursor: default;
}

.ai-progress-task.is-queued {
  color: #94a3b8;
}

.ai-progress-task.is-processing .ai-progress-mark,
.ai-progress-task.is-assigned .ai-progress-mark {
  display: inline-block;
  animation: similarity-spin 1.2s linear infinite;
}

.ai-progress-task.is-completed .ai-progress-mark {
  color: #15803d;
}

.ai-progress-task.is-failed .ai-progress-mark {
  color: #b91c1c;
}

.ai-progress-task.is-requeued .ai-progress-mark {
  color: #b45309;
}

/* Cancellation is a neutral outcome the user asked for, not an error. */
.ai-progress-task.is-cancelled,
.ai-progress-task.is-skipped {
  color: #94a3b8;
}

.ai-comment {
  margin: 0;
  font-size: 13px;
  color: #334155;
  white-space: pre-wrap;
}

.ai-comment:empty {
  display: none;
}

.ai-rag-message {
  margin: 0;
  font-size: 13px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.ai-rag-message[hidden] {
  display: none;
}

.ai-error {
  margin: 0;
  font-size: 13px;
  color: #b3261e;
}

.ai-error:empty {
  display: none;
}

/* Viewer badge, top-right next to the map zoom control (right: 10px). */
.user-badge {
  position: fixed;
  top: 12px;
  right: 52px;
  z-index: 12;
}

.user-badge-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #2b5f92;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.user-badge-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-badge-login {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Page gradient behind the globe — always on, never fades with the canvas. */
.gate-page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #000;
}

.gate-globe {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: transparent;
  opacity: 0;
}

.gate-globe--ready {
  opacity: 1;
  transition: opacity 5s ease;
}

.gate-globe canvas {
  display: block;
}

.gate-globe-marker {
  position: relative;
  width: 0;
  height: 0;
  pointer-events: none;
}

.gate-globe-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #ffd68c;
  box-shadow: 0 0 0 2px rgba(255, 214, 140, 0.35), 0 0 8px rgba(255, 214, 140, 0.55);
}

.gate-globe-label {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 180px;
  line-height: 1.25;
  pointer-events: none;
  white-space: normal;
}

.gate-globe-label-title {
  font-size: 12px;
  font-weight: 600;
}

.gate-globe-label-caption {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.home-gate {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  box-sizing: border-box;
  background: transparent;
  color: #fff;
  text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Same gradient as before, opacity 0.3 over the globe; content stays opaque. */
.home-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(160deg, #0e2c57 10%, #5fa3f1 40%, #020913 100%); 
  opacity: 0.3;
}

.home-gate > * {
  position: relative;
  z-index: 1;
}

/* Full opaque gradient when globe is off (load failure / no WebGL). */
.home-gate--no-globe::before {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .gate-globe {
    display: none !important;
  }

  .home-gate::before {
    opacity: 1;
  }
}

.home-gate-logo {
  display: block;
  width: min(340px, 78vw);
  height: auto;
  max-height: 120px;
  margin: 0 auto 32px;
  object-fit: contain;
  /* Same shadow as .home-gate-login, but drop-shadow rather than box-shadow:
     the logo is a transparent SVG, so box-shadow would trace the image's
     rectangle instead of the mark itself. drop-shadow follows the alpha. */
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.home-gate-text {
  margin: 0 0 20px;
  max-width: 32em;
  font-size: 18px;
  line-height: 1.45;
}

.home-gate-text a,
.home-gate-text a:visited,
.home-gate-text a:hover {
  color: inherit;
  text-decoration: underline;
}

.home-gate-login {
  display: inline-block;
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  background: #fff;
  color: #2b5f92;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-family: inherit;
}

.home-gate-login:hover {
  background: #f4f7fb;
}

.map-footer-bar #about-btn {
  position: static;
  left: auto;
  bottom: auto;
}

.map-footer-bar #export-btn,
.map-footer-bar #map-edit-toggle {
  flex: 0 0 auto;
  padding: 8px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-footer-bar #share-btn {
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-author {
  font-size: 14px;
  color: #2b3b47;
  white-space: nowrap;
}

.map-author a {
  color: #2b5f92;
  text-decoration: none;
}

#map-author-link {
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff,
    0 -1px 0 #fff,
    0 1px 0 #fff,
    -1px 0 0 #fff,
    1px 0 0 #fff;
}

.map-author a:hover {
  text-decoration: underline;
}

/* Clustered-point donut markers (DOM overlays, see map_point_layer.js). */
.cluster-donut {
  cursor: pointer;
}

/* POI view=marker clouds (maplibregl.Marker DOM, see map_poi_layer.js).
   Outer .poi-marker anchors at bottom (tip tip = lng/lat); card clips media. */
.poi-marker {
  --poi-marker-accent: #2f6fed;
  position: relative;
  width: 140px;
  max-width: 160px;
  /* Room for the tip inside the box so Marker anchor:bottom hits the tip. */
  padding-bottom: 8px;
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

.poi-marker__card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #d4dde5;
  border-top: 3px solid var(--poi-marker-accent);
  border-radius: 6px;
  overflow: hidden;
}

/* Diamond tip: lowest vertex sits on the Marker lng/lat (anchor bottom). */
.poi-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: #fff;
  border-right: 1px solid #d4dde5;
  border-bottom: 1px solid #d4dde5;
  transform: rotate(45deg);
  pointer-events: none;
}

.poi-marker__img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: cover;
  background: #eef2f5;
}

.poi-marker__text {
  padding: 6px 8px 8px;
  font-size: 12px;
  line-height: 1.25;
  color: #1a2a38;
  overflow-wrap: anywhere;
}

/* Compact bubble when there is no photo (or image failed to load). */
.poi-marker--text {
  width: auto;
  max-width: 180px;
}

.poi-marker--text .poi-marker__text {
  padding: 8px 10px;
}

.poi-marker-cluster {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 14px;
  background: #2f6fed;
  color: #fff;
  font: 600 12px/28px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  border: 2px solid #fff;
}

#map-legend {
  position: fixed;
  right: 44px;
  bottom: 12px;
  z-index: 10;
  max-width: 360px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid #d4dde5;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #2b3b47;
}

#map-legend[hidden] {
  display: none;
}

/* Kept in markup for a11y hooks; not used as a drag/collapse control. */
#map-legend-toggle {
  display: none;
}

#map-legend.legend--moved {
  right: auto;
  bottom: auto;
}

#map-legend.legend--returning {
  transition: left 2s ease, top 2s ease;
}

#map-legend.legend--dragging {
  user-select: none;
}

/* Keep the attribution "i" control clickable above the legend. */
.maplibregl-ctrl-bottom-right {
  z-index: 11;
}

.legend-title {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: #1a2a38;
  margin-bottom: 8px;
  cursor: grab;
  touch-action: none;
}

#map-legend.legend--dragging .legend-title {
  cursor: grabbing;
}

.legend-title:not(:last-child) {
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8ee;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 4px;
  margin: 0 -4px;
  border-radius: 4px;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.legend-row + .legend-row {
  margin-top: 4px;
}

.legend-row:hover {
  background: #eef4fb;
}

.legend-row.active {
  background: #e2edf9;
  font-weight: 600;
}

.legend-row.inactive {
  opacity: 0.45;
}

.legend-swatch {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

#about-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#about-modal.open {
  display: flex;
}

#about-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 20px 22px;
  width: 360px;
  max-width: calc(100vw - 32px);
}

#about-card h2 {
  margin: 0 0 12px;
  font-size: 17px;
  color: #222;
}

p.about-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #444;
}

#about-actions {
  display: flex;
  justify-content: flex-end;
}

#about-actions button {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #4a90d9;
  background: #4a90d9;
  color: #fff;
}

#about-actions button:hover {
  background: #3b7dc0;
  border-color: #3b7dc0;
}

#login-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#login-modal.open {
  display: flex;
}

#login-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 20px 22px;
  width: 340px;
  max-width: calc(100vw - 32px);
  overflow: visible;
}

/* Field-anchored validation tips: absolute overlays, no layout shift. */
.field-wrap {
  position: relative;
  margin-bottom: 12px;
}

.field-wrap > label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #444;
}

.field-wrap > input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #ccd6df;
  border-radius: 6px;
}

.field-wrap > input:focus {
  outline: none;
  border-color: #4a90d9;
}

.field-wrap > input.field-invalid {
  border-color: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.18);
}

.field-tip {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 8;
  margin: 0;
  padding: 6px 8px;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.35;
  color: #8b1e14;
  background: #fff5f4;
  border: 1px solid #f0c2bd;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.field-tip::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -5px;
  width: 8px;
  height: 8px;
  background: #fff5f4;
  border-left: 1px solid #f0c2bd;
  border-top: 1px solid #f0c2bd;
  transform: rotate(45deg);
}

.field-tip[hidden] {
  display: none;
}

.field-tip-success {
  color: #1e7a3a;
  background: #eaf7ee;
  border-color: #b7e0c2;
}

.field-tip-success::before {
  background: #eaf7ee;
  border-left-color: #b7e0c2;
  border-top-color: #b7e0c2;
}

.auth-form-footer {
  position: relative;
}

.field-tip-form {
  top: auto;
  bottom: calc(100% + 6px);
}

.field-tip-form::before {
  top: auto;
  bottom: -5px;
  transform: rotate(225deg);
}

#login-card h2 {
  margin: 0 0 14px;
  font-size: 17px;
  color: #222;
}

/* More specific than the UA [hidden] rule; without this, register/forgot
   modes keep showing the password field (display:block wins). */
#login-form label[hidden],
#login-form .field-wrap[hidden],
#login-form input[hidden] {
  display: none;
}

.login-captcha {
  margin-bottom: 12px;
  min-height: 100px;
}

/* Legacy block errors kept for non-auth pages; auth forms use .field-tip. */
.login-error {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fdecec;
  color: #c0392b;
  font-size: 13px;
}

.login-success {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #eaf7ee;
  color: #1e7a3a;
  font-size: 13px;
}

.login-oauth {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e4ebf2;
}

.login-oauth-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid #ccd6df;
  background: #fff;
  color: #222;
}

.login-oauth-btn:hover {
  background: #f5f8fb;
  border-color: #4a90d9;
}

.login-oauth-icon {
  display: block;
  width: 22px;
  height: 22px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.login-oauth-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.login-oauth-google .login-oauth-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z'/%3E%3Cpath fill='%23FBBC05' d='M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z'/%3E%3C/svg%3E");
}

.login-oauth-yandex .login-oauth-icon {
  /* Official Yandex mark (yastatic home-static «Я» disc); source: static/images/oauth-yandex.svg */
  background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.04%2012c0-5.523%204.476-10%2010-10%205.522%200%2010%204.477%2010%2010s-4.478%2010-10%2010c-5.524%200-10-4.477-10-10z%22%20fill%3D%22%23FC3F1D%22%2F%3E%3Cpath%20d%3D%22M13.32%207.666h-.924c-1.694%200-2.585.858-2.585%202.123%200%201.43.616%202.1%201.881%202.959l1.045.704-3.003%204.487H7.49l2.695-4.014c-1.55-1.111-2.42-2.19-2.42-4.015%200-2.288%201.595-3.85%204.62-3.85h3.003v11.868H13.32V7.666z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E");
}

.login-oauth-github .login-oauth-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2324292F' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E");
}

.login-oauth-google {
  border-color: #dadce0;
}

.login-oauth-yandex {
  border-color: #f5c4bb;
  color: #c23018;
}

.login-oauth-github {
  border-color: #c9ced4;
  color: #24292f;
}

.login-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.login-link {
  border: 0;
  background: none;
  padding: 0;
  color: #2b5f92;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.login-link:hover {
  color: #1a3f66;
}

#login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#login-actions button {
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #4a90d9;
  background: #4a90d9;
  color: #fff;
}

#login-actions button:hover {
  background: #3b7dc0;
  border-color: #3b7dc0;
}

#login-cancel {
  background: #fff;
  color: #2b5f92;
}

#login-cancel:hover {
  background: #eef4fb;
  border-color: #4a90d9;
}

@media (max-width: 640px) {
  .home-gate {
    padding: 20px 16px;
  }

  .home-gate-logo {
    width: min(280px, 84vw);
    max-height: 88px;
    margin-bottom: 24px;
  }

  .home-gate-text {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 16px;
    max-width: none;
  }

  .home-gate-login {
    width: 100%;
    max-width: 280px;
  }

  .site-logo--float {
    display: none;
  }

  .site-logo--menu {
    display: block;
  }

  #toolbar .site-logo--menu {
    display: block;
  }

  #toolbar {
    left: 8px;
    right: 8px;
    top: 8px;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 8px;
  }

  /* Show the hamburger and let it sit on its own row. */
  #toolbar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 18px;
    padding: 6px 12px;
  }

  /* When collapsed, shrink the toolbar to just the toggle button. */
  #toolbar.collapsed {
    right: auto;
  }

  #toolbar.collapsed > *:not(#toolbar-toggle) {
    display: none;
  }

  /* Input takes a full row and shrinks freely. */
  #word {
    flex: 1 1 100%;
    min-width: 0;
    font-size: 16px; /* prevents auto-zoom on focus in iOS Safari */
  }

  /* Label+field groups share a row and stay intact. */
  .field-group {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
  }

  /* Framed clustering group spans the full row and wraps cleanly. */
  .cluster-box {
    flex: 1 1 100%;
    flex-wrap: wrap;
    margin: 0;
  }

  #user-country,
  #threshold {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
  }

  /* Buttons stretch into comfortable touch targets. */
  #translate-btn,
  #export-btn {
    flex: 1 1 auto;
    font-size: 15px;
    padding: 8px 12px;
  }

  #about-btn {
    font-size: 13px;
    padding: 7px 12px;
  }

  /* Footer bar controls are replaced by the hamburger menu on mobile. The bar
     itself stays in the DOM so the included #about-modal keeps working. */
  .map-footer-bar #about-btn,
  .map-footer-bar #export-btn,
  .map-footer-bar #map-edit-toggle,
  .map-footer-bar #share-btn,
  .map-footer-bar #map-author {
    display: none;
  }

  /* Hamburger menu, top-left. */
  #map-menu-wrap {
    display: block;
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 20;
  }

  #map-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d4dde5;
    border-radius: 6px;
    background: #fff;
    color: #2b5f92;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
  }

  #map-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid #d4dde5;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #map-menu[hidden] {
    display: none;
  }

  .map-menu-item {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid #eef2f6;
    background: none;
    font-size: 15px;
    color: #2b5f92;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }

  .map-menu-item:last-child {
    border-bottom: 0;
  }

  .map-menu-item:hover {
    background: #eef4fb;
  }

  /* Legend is controlled from the menu: hidden until opened, no own toggle. */
  #map-legend {
    right: 44px;
    bottom: 12px;
    max-width: min(240px, calc(100vw - 72px));
    max-height: 45vh;
    overflow-y: auto;
    font-size: 12px;
    padding: 10px 12px;
    display: none;
  }

  #map-legend.mobile-open {
    display: block;
  }

  #map-legend-toggle {
    display: none;
  }

  .legend-title {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .legend-title:not(:last-child) {
    padding-bottom: 6px;
  }

  .legend-row {
    gap: 6px;
    padding: 2px 3px;
    margin: 0 -3px;
  }

  .legend-swatch {
    width: 12px;
    height: 12px;
  }

  .ai-dock {
    width: calc(100vw - 16px);
    bottom: 8px;
  }

  #ai-dock-toggle,
  #ai-send,
  #ai-publish,
  #ai-edit,
  #ai-reset,
  #ai-cancel {
    font-size: 15px;
    padding: 10px 14px;
  }

  #ai-prompt {
    font-size: 16px;
  }

  #ai-send,
  #ai-publish,
  #ai-edit,
  #ai-reset,
  #ai-cancel {
    flex: 1;
  }

  .ai-dock-body {
    max-height: 40vh;
    overflow-y: auto;
  }
}

/* Set-password page (templates/set_password.html). Reuses the login modal's
   input/error styling; only the page frame is new. */
.set-password-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: #eef2f6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.set-password-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 26px 28px;
  width: 400px;
  max-width: 100%;
  overflow: visible;
}

.set-password-card h1 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #222;
}

.set-password-intro {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #555;
}

#set-password-form .field-wrap > label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #444;
}

.set-password-policy {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #6b7885;
}

#set-password-submit {
  width: 100%;
  padding: 9px 14px;
  font-size: 14px;
  color: #fff;
  background: #4a90d9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#set-password-submit:hover {
  background: #3b7fc4;
}

#set-password-submit:disabled {
  opacity: 0.6;
  cursor: default;
}
