* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  background: #05070d;
  color: #f0f0f0;
  font-family: "Poppins", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  overflow-x: hidden;
}

#globeViz {
  width: 100vw;
  height: 100vh;
  transition: opacity 0.28s ease;
  /* Three.js CSS3DRenderer assigns very high z-index values to individual
     photo-pin elements for depth sorting — without an isolated stacking
     context here, those values leak out and render above later siblings
     like modals, no matter what z-index the modal itself declares. */
  isolation: isolate;
}

.photo-pin {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.photo-pin:hover {
  transform: scale(1.25);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
}

/* Cloud transition + flat map (globe -> map descent) */

.cloud-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  background:
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(255,255,255,0.95), transparent 70%),
    radial-gradient(ellipse 50% 35% at 70% 60%, rgba(255,255,255,0.9), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 80%, rgba(255,255,255,0.95), transparent 70%),
    radial-gradient(ellipse 55% 40% at 85% 20%, rgba(255,255,255,0.9), transparent 70%),
    #e8ecf2;
}

/* Полупрозрачная "дымка" вместо сплошной белой пелены — низа/глобус всё
   ещё немного проглядывают, переход короткий и не дезориентирует. */
.cloud-overlay.visible {
  opacity: 0.55;
}

.flat-map {
  position: fixed;
  inset: 0;
  z-index: 3;
  transition: opacity 0.28s ease;
}

/* Общий класс для "выключенного" слоя (глобус или карта) — держим оба
   слоя смонтированными и просто кроссфейдим прозрачность между ними,
   вместо display:none — так у Leaflet всегда корректный размер контейнера
   с самого первого рендера, и не бывает размытых недогруженных тайлов. */
.layer-off {
  opacity: 0;
  pointer-events: none;
}

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

.highlight-pin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff4d4f;
  border: 3px solid #fff;
  box-shadow: 0 0 10px rgba(255, 77, 79, 0.9);
}

/* Toolbar */

.toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 10px;
  z-index: 6;
  /* Контейнер сам по себе прозрачный, но без этого перехватывал клики по
     пустым местам между кнопками (и по соседнему #mapSearchBar, если тот
     оказывается под ним) — теперь клики проходят насквозь, кроме самих
     кнопок (см. .toolbar-button ниже). */
  pointer-events: none;
}

.toolbar-left {
  top: auto;
  bottom: 16px;
  right: 16px;
  left: auto;
  /* Должна быть кликабельна поверх модалки поездки и лайтбокса (z-index 10
     и 20), чтобы "Назад"/"Обновить" работали из любого состояния сайта. */
  z-index: 25;
}

.back-joke {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  max-width: 90vw;
  text-align: center;
  background: rgba(42, 48, 68, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  /* Неровные радиусы вместо ровного прямоугольника — читается как облачко. */
  border-radius: 55% 45% 48% 52% / 60% 55% 45% 40%;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  padding: 16px 28px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Хвостик из двух уменьшающихся кружков — как у мысленного облака,
   указывает в сторону кнопки "Назад", которая его вызвала. */
.back-joke::before,
.back-joke::after {
  content: "";
  position: absolute;
  background: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.back-joke::before {
  width: 16px;
  height: 16px;
  right: 28px;
  bottom: -20px;
}

.back-joke::after {
  width: 9px;
  height: 9px;
  right: 16px;
  bottom: -32px;
}

.back-joke.visible {
  opacity: 1;
  animation: backJokeFloat 3s ease-in-out infinite;
}

@keyframes backJokeFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.map-tools {
  position: fixed;
  bottom: 20px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 6;
}

.map-search-bar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 6;
  background: rgba(8, 10, 18, 0.28);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  padding: 4px 4px 4px 18px;
}

.map-search-bar input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  width: 160px;
}

.map-search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.map-search-bar .toolbar-button {
  padding: 8px 14px;
}

.ruler-tooltip {
  background: rgba(8, 10, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
}

/* Фон-плашка не нужна ни на десктопе, ни на телефоне — оставляем только
   текст/иконку с тенью для читаемости поверх глобуса и фото галереи. */
.toolbar-button {
  background: none;
  border: none;
  backdrop-filter: none;
  color: #fff;
  font-family: inherit;
  font-size: 19px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 24px;
  cursor: pointer;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.toolbar-button:hover {
  background: none;
  opacity: 0.75;
}

.toolbar-button.active {
  background: rgba(66, 133, 244, 0.55);
  border: 1px solid rgba(66, 133, 244, 0.8);
  backdrop-filter: blur(6px);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 16px;
}

.settings-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.install-app-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  text-align: center;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.edit-field input[type="text"],
.edit-field input[type="password"],
.edit-field input[type="number"],
.edit-field textarea {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
}

.edit-geo-row {
  display: flex;
  gap: 10px;
}

.edit-geo-row input {
  flex: 1;
}

.edit-mode-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.edit-mode-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.edit-mode-radio input {
  accent-color: #6bdb8f;
}

.edit-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}

.edit-photo-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-photo-thumb-wrap {
  position: relative;
  cursor: pointer;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
}

.edit-photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.edit-photo-card.is-removed .edit-photo-thumb,
.edit-photo-card.is-deleted .edit-photo-thumb {
  opacity: 0.4;
  filter: grayscale(0.6);
}

.edit-photo-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-photo-badge.is-cover {
  background: #1f4d2e;
  color: #6bdb8f;
}

.edit-photo-badge.is-deleted-badge {
  background: #6b1f1f;
}

.edit-photo-badge.is-removed-badge {
  background: #4a3c1f;
}

.edit-photo-current-cover {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
  color: #ffce54;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.edit-photo-caption {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  padding: 5px 7px;
  resize: vertical;
}

.modal-footer {
  flex-shrink: 0;
  margin-top: 12px;
}

.edit-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.edit-copy-btn {
  flex-shrink: 0;
}

.edit-request-preview {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #c9cdd3;
  font-size: 12px;
  font-family: "Courier New", monospace;
  padding: 8px 10px;
  resize: vertical;
}

.dev-settings h3 {
  font-size: 15px;
  margin: 4px 0 8px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.edit-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.85;
}

.edit-mode-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.dev-password-content {
  max-width: 320px;
  text-align: center;
}

.dev-password-content .edit-field {
  margin-bottom: 14px;
}

.edit-mode-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 6px;
  background: #1f4d2e;
  color: #6bdb8f;
  font-size: 14px;
  font-weight: 600;
  z-index: 40;
  pointer-events: none;
}

.edit-mode-banner-inline {
  position: static;
  transform: none;
  margin: 0 auto 14px;
  width: fit-content;
}

/* Двойной клик по логотипу запрашивает пароль скрытых настроек
   разработчика (см. aboutLogoEl.ondblclick в app.js); наведение/фокус
   запускает декоративную анимацию "вращения" (см. spinAboutLogo). */
.about-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.85;
}

.about-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 6px;
}

.about-logo {
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  outline: none;
}

.about-logo:focus-visible {
  outline: 2px solid #6bdb8f;
  outline-offset: 4px;
  border-radius: 50%;
}

.about-wordmark {
  display: block;
  width: 100%;
  max-width: 110px;
  height: auto;
  margin-top: -14px;
  margin-left: 10px;
}

.about-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.about-epigraph {
  margin: 0;
  font-style: italic;
  opacity: 0.75;
  font-size: 13px;
}

.about-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* Плейсхолдер About пересобирается заново при каждом открытии
   #settingsModal (display:none -> flex сбрасывает анимации),
   поэтому лого/wordmark/подписи каждый раз плавно въезжают заново. */
@keyframes aboutFadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal:not(.hidden) .about-logo {
  animation: aboutFadeInUp 0.5s ease-out both;
}

.modal:not(.hidden) .about-wordmark {
  animation: aboutFadeInUp 0.5s ease-out 0.08s both;
}

.modal:not(.hidden) .about-epigraph {
  animation: aboutFadeInUp 0.5s ease-out 0.16s both;
}

.modal:not(.hidden) .about-title {
  animation: aboutFadeInUp 0.5s ease-out 0.22s both;
}

.modal:not(.hidden) .about-text,
.modal:not(.hidden) .about-credits {
  animation: aboutFadeInUp 0.5s ease-out 0.28s both;
}

.about-text {
  margin: 0 0 10px;
}

.about-credits {
  margin: 0;
  font-size: 12px;
  opacity: 0.7;
}

.about-row a {
  color: #4285f4;
}

/* Calendar */

.albums-calendar {
  margin-top: 10px;
  touch-action: pan-y;
}

#calendarBody.collapsed {
  display: none;
}

.calendar-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.calendar-dd {
  position: relative;
  flex: 1;
  min-width: 0;
}

#calendarDayDD {
  flex: 0.6;
}

.calendar-nav .icon-button {
  flex-shrink: 0;
}

/* Стрелки календаря и крестик очистки поиска были едва заметны рядом с
   крупным крестиком закрытия окна (28px) — увеличиваем сам символ, но не
   кружок кнопки (остаётся 32x32, как у .icon-button). */
#calendarPrev,
#calendarNext,
#albumsSearchClear {
  font-size: 24px;
}

.calendar-nav .map-button {
  flex-shrink: 0;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

#goTodayBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
}

.calendar-select:hover {
  background: rgba(255, 255, 255, 0.14);
}

.calendar-select::after {
  content: "▾";
  margin-left: 6px;
  opacity: 0.6;
  font-size: 11px;
}

.calendar-dd-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #181b26;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 30;
  padding: 4px;
}

.calendar-dd-list::-webkit-scrollbar {
  width: 8px;
}

.calendar-dd-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.calendar-dd-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

.calendar-dd-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.calendar-dd-item {
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

.calendar-dd-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.calendar-dd-item.active {
  background: rgba(66, 133, 244, 0.5);
  font-weight: 600;
}

.calendar-months {
  display: flex;
  gap: 14px;
}

.calendar-month-panel {
  flex: 1;
  min-width: 0;
}

.calendar-month-title {
  font-size: 13px;
  opacity: 0.6;
  text-align: center;
  margin-bottom: 4px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-weekdays {
  font-size: 14px;
  opacity: 0.4;
  text-align: center;
  margin-bottom: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 4px;
  opacity: 0.5;
}

.calendar-day.travel-day {
  background: #3d7cf4;
  opacity: 1;
  cursor: pointer;
  font-weight: 600;
}

.calendar-day.travel-day:hover {
  background: #5c92ff;
}

.calendar-day.today {
  outline: 2px solid #ffce54;
  outline-offset: -2px;
}

.calendar-day.focused {
  box-shadow: 0 0 0 2px #fff inset;
}

/* Albums */

.albums-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.albums-search input[type="text"] {
  flex: 1;
  min-width: 0;
}

.albums-search input {
  color-scheme: dark;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
}

.albums-empty {
  text-align: center;
  opacity: 0.6;
  padding: 24px 0;
}

.modal-content-split .modal-body {
  padding-right: 4px;
}

.modal-content-split .modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-content-split .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.modal-content-split .modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

.modal-content-split .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.album-card {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.album-card:first-child {
  border-top: none;
}

.album-thumb {
  width: 100px;
  min-width: 100px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
}

.album-title {
  font-size: 16px;
  font-weight: 600;
}

.album-meta {
  font-size: 12px;
  opacity: 0.55;
  margin: 2px 0 4px;
}

.album-notes {
  font-size: 13px;
  opacity: 0.85;
  line-height: 1.4;
}

/* Modal */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #12141c;
  border-radius: 12px;
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}

.modal-content > h2 {
  margin: 0 0 10px;
}

.modal-content.wide {
  max-width: 820px;
}

/* Split layout: static header (title/description/buttons) on top,
   scrollable body below — wheel scrolling works anywhere over the
   window via JS forwarding to .modal-body. */
.modal-content-split {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content-split .modal-header {
  flex-shrink: 0;
}

.modal-content-split .modal-header h2 {
  margin: 0 0 10px;
}

#modalTitle {
  margin: 0 0 8px;
}

#modalNotes {
  margin: 0 0 10px;
  line-height: 1.35;
}

.modal-content-split .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 140px;
}

.modal-anchor-top {
  align-items: flex-start;
  padding-top: 40px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

.modal-meta {
  opacity: 0.6;
  font-size: 13px;
  white-space: nowrap;
  margin-left: auto;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.icon-button {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  font-size: 16px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.gemini-button {
  background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
}

.gemini-button:hover {
  filter: brightness(1.1);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.gallery-item {
  position: relative;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  display: block;
}

.gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 14px 8px 6px;
  font-size: 12px;
  color: #fff;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 20;
}

.lightbox.hidden {
  display: none;
}

.lightbox img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}

.lightbox-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
}

.lightbox-caption {
  color: #fff;
  font-size: 17px;
  opacity: 0.85;
  max-width: 80vw;
  text-align: center;
}

.lightbox-caption.hidden {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  z-index: 2;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
}

.map-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
}

.map-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.map-button.active {
  background: rgba(66, 133, 244, 0.5);
  border-color: rgba(66, 133, 244, 0.8);
}

/* Map click popup (📋 copy / 🤖 Gemini) — icon-only, side by side, with a
   thin ring around each icon rather than the base .map-button's padded
   pill. Leaflet's popup background is white, so .map-button's white text/
   near-transparent background (meant for the dark page background) need
   a dark override here or the icon ring is invisible against it. */
.map-popup-button-row {
  display: flex;
  gap: 10px;
}

.map-popup-button {
  font-size: 28px;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  color: #1a1a1a;
  background: none;
  border-color: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-popup-button:hover {
  opacity: 0.7;
}

.lightbox-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

/* Responsive */

@media (max-width: 800px) {
  .toolbar {
    gap: 4px;
    max-width: calc(100vw - 32px);
  }

  .toolbar-left {
    flex-direction: row;
  }

  .toolbar-button {
    font-size: 14px;
    padding: 8px 10px;
  }

  .back-joke {
    /* Поднимаем над нижним рядом кнопок "Обновить"/"Назад" — иначе окно
       шутки перекрывалось ими на телефоне. */
    bottom: 76px;
  }

  /* Верхний ряд (Альбомы/Карта/Настройки) теперь в одну строку и на
     телефоне — сдвигаем строку поиска карты ниже, чтобы не перекрывались. */
  .map-search-bar {
    top: 60px;
  }

  .modal-content {
    width: 95%;
    max-height: 94vh;
    padding: 20px;
  }

  /* Двузначные жирные числа (font-weight:600 у поездок) в узкой колонке
     наезжали на соседние ячейки — делаем цифры тоньше и мельче на телефоне. */
  .calendar-day {
    font-size: 12px;
  }

  .calendar-day.travel-day {
    font-weight: 500;
  }

  .modal-actions {
    gap: 8px;
    margin-top: 10px;
  }

  .modal-meta,
  .album-notes,
  #modalNotes {
    font-size: 13px;
  }
}

/* На узких телефонах (~360px) двум месяцам рядом и трём выпадающим
   спискам даты не хватало места — подужимаем отступы. */
@media (max-width: 400px) {
  .modal-content {
    width: 97%;
    max-height: 96vh;
    padding: 14px;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-day {
    font-size: 11px;
  }

  .calendar-nav {
    gap: 3px;
  }

  #calendarDayDD {
    flex: 0.45;
  }

  .calendar-select {
    padding: 6px 2px;
  }
}
