#memoriesMemoryPlace,
.memoriesMemoryPlace {
  text-align: left;
}

#memoriesMemoryPlace {
  --locNavy: var(--memoriesText, #2c3340);
  --locMuted: var(--memoriesTextMuted, #5a6578);
  --locTeal: var(--memoriesPrimary, #5c9120);
  --locTealDeep: var(--memoriesPrimaryDark, #487f14);
  --locChrome: var(--memoriesChrome, #4a8bb5);
  --locCream: var(--memoriesCreamLight, #faf8f4);
  --locSurface: rgba(255, 255, 255, 0.78);
  --locBorder: rgba(74, 139, 181, 0.14);
  --locShadow: 0 1px 0 rgba(255, 255, 255, 0.88) inset, 0 10px 32px rgba(74, 139, 181, 0.07);
  box-sizing: border-box;
  padding: clamp(14px, 2.2vw, 24px) clamp(12px, 2vw, 20px) clamp(28px, 4vw, 44px);
  animation: memoryPlaceIn 0.45s ease both;
}

@keyframes memoryPlaceIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.memoryPlaceShell {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.4vw, 24px);
  max-width: 1100px;
}

.memoryPlaceHeader {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 16px;
  background:
    radial-gradient(ellipse 90% 80% at 0% 0%, rgba(74, 139, 181, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 100% 0%, rgba(92, 145, 32, 0.08) 0%, transparent 50%),
    var(--locSurface);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--locShadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  backdrop-filter: blur(14px) saturate(1.05);
}

.memoryPlaceIntro {
  margin: 0;
  max-width: none;
  width: 100%;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--locMuted);
}

.memoryPlaceStatus {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 1.35em;
  margin: 2px 0 0;
  padding: 6px 12px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--locMuted);
  background: rgba(74, 139, 181, 0.08);
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.memoryPlaceStatus:empty {
  display: none;
}

.memoryPlaceStatus.is-ok {
  color: var(--locTealDeep);
  background: rgba(92, 145, 32, 0.1);
  border-color: rgba(92, 145, 32, 0.18);
}

.memoryPlaceStatus.is-error {
  color: #9b2c2c;
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.14);
}

.memoryPlaceLayout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: stretch;
}

.memoryPlaceMapWrap,
.memoryPlaceListWrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 16px;
  background: var(--locSurface);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--locShadow);
  overflow: hidden;
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
  backdrop-filter: blur(12px) saturate(1.04);
}

.memoryPlacePanelHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--locBorder);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(250, 248, 244, 0.35) 100%);
}

.memoryPlacePanelLabel {
  margin: 0;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--locMuted);
}

.memoryPlaceMap {
  position: relative;
  flex: 1;
  min-height: 320px;
  height: clamp(300px, 44vh, 520px);
  background:
    linear-gradient(160deg, #e8f0f6 0%, #f3f6f2 48%, #eef2ea 100%);
}

.memoryPlaceMap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(74, 139, 181, 0.06);
  z-index: 1;
}

.memoryPlaceMapFallback {
  margin: 0;
  padding: 40px 28px;
  text-align: center;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--locMuted);
}

.memoryPlaceList {
  flex: 1;
  max-height: clamp(300px, 44vh, 520px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  scroll-behavior: smooth;
}

.memoryPlaceList::-webkit-scrollbar {
  width: 8px;
}
.memoryPlaceList::-webkit-scrollbar-thumb {
  background: rgba(74, 139, 181, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.memoryPlaceItem {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 252, 249, 0.9);
  border: 1px solid rgba(74, 139, 181, 0.1);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  animation: memoryItemIn 0.35s ease both;
}

.memoryPlaceItem:nth-child(1) { animation-delay: 0.02s; }
.memoryPlaceItem:nth-child(2) { animation-delay: 0.05s; }
.memoryPlaceItem:nth-child(3) { animation-delay: 0.08s; }
.memoryPlaceItem:nth-child(4) { animation-delay: 0.11s; }
.memoryPlaceItem:nth-child(5) { animation-delay: 0.14s; }

@keyframes memoryItemIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.memoryPlaceItem:hover {
  border-color: rgba(74, 139, 181, 0.28);
  background: #fff;
  box-shadow: 0 6px 18px rgba(74, 139, 181, 0.08);
  transform: translateY(-1px);
}

.memoryPlaceItem.is-active {
  border-color: rgba(74, 139, 181, 0.55);
  background: rgba(232, 246, 249, 0.95);
  box-shadow:
    0 0 0 2px rgba(74, 139, 181, 0.2),
    0 8px 22px rgba(74, 139, 181, 0.16);
  transform: translateY(-1px);
  animation: memoryItemHighlight 0.85s ease;
}

@keyframes memoryItemHighlight {
  0% {
    box-shadow:
      0 0 0 0 rgba(74, 139, 181, 0.35),
      0 6px 18px rgba(74, 139, 181, 0.08);
  }
  40% {
    box-shadow:
      0 0 0 4px rgba(74, 139, 181, 0.22),
      0 8px 22px rgba(74, 139, 181, 0.16);
  }
  100% {
    box-shadow:
      0 0 0 2px rgba(74, 139, 181, 0.2),
      0 8px 22px rgba(74, 139, 181, 0.16);
  }
}

.memoryPlaceItemKind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.4rem;
  height: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--locTealDeep);
  background: rgba(92, 145, 32, 0.12);
}

.memoryPlaceItemKind.is-memory {
  color: #2f6285;
  background: rgba(74, 139, 181, 0.14);
}

.memoryPlaceItemBody {
  min-width: 0;
}

.memoryPlaceItemTitle {
  margin: 0 0 4px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--locNavy);
  line-height: 1.3;
}

.memoryPlaceItemMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 0 4px;
}

.memoryPlaceItemDate,
.memoryPlaceItemPlace {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--locMuted);
}

.memoryPlaceItemDate i,
.memoryPlaceItemPlace i {
  font-size: 0.72rem;
  color: var(--locChrome);
  opacity: 0.9;
}

.memoryPlaceItemSummary {
  margin: 0;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #667084;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memoryPlaceEmpty {
  margin: auto;
  padding: 36px 20px;
  text-align: center;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--locMuted);
}

.memoryPlaceEmptyIcon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 14px;
  color: var(--locChrome);
  background: rgba(74, 139, 181, 0.1);
  font-size: 1.15rem;
}

/* Import panel */
.memoryImportPanel {
  padding: 20px;
  border-radius: 16px;
  background: var(--locSurface);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--locShadow);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
  backdrop-filter: blur(12px) saturate(1.04);
}

.memoryImportPanelHead {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.memoryImportPanelHead h3 {
  margin: 0;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--locNavy);
  letter-spacing: -0.01em;
}

.memoryImportPanelHead p {
  margin: 0;
  max-width: none;
  width: 100%;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--locMuted);
}

.memoryImportDropzone {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 14px;
  border: 1.5px dashed rgba(74, 139, 181, 0.32);
  background:
    linear-gradient(165deg, rgba(74, 139, 181, 0.05) 0%, rgba(92, 145, 32, 0.04) 100%);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.memoryImportDropzone.is-dragover {
  border-color: rgba(92, 145, 32, 0.55);
  background: rgba(92, 145, 32, 0.08);
  box-shadow: 0 0 0 4px rgba(92, 145, 32, 0.08);
}

.memoryImportControls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.memoryImportFileLabel {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(74, 139, 181, 0.22);
  background: rgba(255, 255, 255, 0.88);
  color: var(--locNavy);
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.memoryImportFileLabel:hover {
  border-color: rgba(74, 139, 181, 0.4);
  background: #fff;
}

.memoryImportFileLabel input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.memoryImportFileName {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.84rem;
  color: var(--locMuted);
}

.memoryImportPreview {
  margin-top: 14px;
}

.memoryImportPreviewIntro {
  margin: 0 0 8px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--locNavy);
}

.memoryImportLimitNote,
.memoryImportPreviewHint,
.memoryImportNameNote {
  margin: 0 0 10px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--locMuted);
}

.memoryImportLimitNote {
  color: var(--locNavy);
  font-weight: 600;
}

.memoryImportPreviewActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.memoryImportFilters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 252, 249, 0.88);
  border: 1px solid rgba(74, 139, 181, 0.12);
}

.memoryImportFilterModeLabel {
  margin: 0;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--locMuted);
}

.memoryImportTextFilters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.memoryImportTextFilter {
  display: grid;
  gap: 5px;
  margin: 0;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
}

.memoryImportTextFilter > span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--locMuted);
}

.memoryImportTextFilter input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(45, 74, 92, 0.16);
  background: rgba(255, 255, 255, 0.96);
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--locNavy);
}

.memoryImportTextFilter input:focus {
  outline: 2px solid rgba(74, 139, 181, 0.35);
  outline-offset: 1px;
  border-color: rgba(74, 139, 181, 0.4);
}

@media (max-width: 700px) {
  .memoryImportTextFilters {
    grid-template-columns: 1fr;
  }
}

.memoryImportFilterChip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(74, 139, 181, 0.16);
  background: rgba(255, 255, 255, 0.92);
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--locNavy);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.memoryImportFilterChip:hover {
  border-color: rgba(74, 139, 181, 0.34);
  background: #fff;
}

.memoryImportFilterChip:has(input:checked) {
  border-color: rgba(74, 139, 181, 0.36);
  background: rgba(74, 139, 181, 0.1);
  color: var(--locNavy);
}

.memoryImportFilterChip input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #4a8bb5;
  cursor: pointer;
}

.memoryImportFilterEmpty {
  margin: 0;
  padding: 22px 16px;
  text-align: center;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--locMuted);
}

.memoryImportKind {
  display: inline-flex;
  align-self: flex-start;
  margin: 0 0 2px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--locChrome, #4a8bb5);
  background: rgba(74, 139, 181, 0.1);
}

.memoryImportRow[data-place-kind="coordinates"] .memoryImportKind {
  color: #8a6a2f;
  background: rgba(196, 149, 55, 0.12);
}

.memoryImportRow[data-place-kind="title"] .memoryImportKind {
  color: #3d6e28;
  background: rgba(92, 145, 32, 0.12);
}

.memoryImportRow[data-place-kind="address"] .memoryImportKind {
  color: #2f5f7a;
  background: rgba(74, 139, 181, 0.12);
}

.memoryImportPreviewList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(70vh, 720px);
  overflow: auto;
  margin: 0 0 10px;
  padding: 2px;
}

.memoryImportPager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.memoryImportPagerBottom {
  margin-top: 0;
  margin-bottom: 14px;
}

.memoryImportPagerLabel {
  flex: 1 1 auto;
  text-align: center;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--locNavy);
}

.memoryImportPager .memoriesButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.memoryImportRow {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(255, 252, 249, 0.92);
  border: 1px solid rgba(74, 139, 181, 0.1);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.memoryImportRow:hover {
  border-color: rgba(74, 139, 181, 0.28);
  background: #fff;
}

.memoryImportRow.is-checked {
  border-color: rgba(74, 139, 181, 0.34);
  background: rgba(74, 139, 181, 0.06);
  box-shadow: inset 0 0 0 1px rgba(74, 139, 181, 0.08);
}

.memoryImportRow.is-locked {
  cursor: default;
}

.memoryImportCheckWrap {
  position: relative;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.memoryImportCheck {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.memoryImportCheck:disabled {
  cursor: default;
}

.memoryImportCheckMark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid rgba(45, 74, 92, 0.28);
  background: rgba(255, 255, 255, 0.95);
  color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.memoryImportCheckMark svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.memoryImportRow:hover .memoryImportCheckMark {
  border-color: rgba(74, 139, 181, 0.55);
}

.memoryImportCheck:focus-visible + .memoryImportCheckMark {
  outline: 2px solid rgba(74, 139, 181, 0.45);
  outline-offset: 2px;
}

.memoryImportCheck:checked + .memoryImportCheckMark,
.memoryImportRow.is-checked .memoryImportCheckMark {
  border-color: transparent;
  background: linear-gradient(160deg, #5a9bb8 0%, #4a8bb5 55%, #3f7ea6 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(45, 74, 92, 0.18);
}

.memoryImportCheck:checked + .memoryImportCheckMark svg,
.memoryImportRow.is-checked .memoryImportCheckMark svg {
  opacity: 1;
  transform: scale(1);
}

.memoryImportCheck:disabled + .memoryImportCheckMark {
  opacity: 0.72;
}

.memoryImportRowCopy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--locNavy);
  min-width: 0;
}

.memoryImportRowCopy strong {
  font-weight: 700;
}

.memoryImportRowCopy span {
  color: var(--locMuted);
  font-size: 0.82rem;
}

.memoryImportRowSummary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memoryImportDest {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding-top: 4px;
}

.memoryImportDest label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--locNavy);
}

.memoryImportDest select {
  appearance: none;
  padding: 8px 32px 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(74, 139, 181, 0.22);
  background:
    #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6578' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    right 12px center / 12px no-repeat;
  font: inherit;
  color: var(--locNavy);
  cursor: pointer;
}

.memoryPlaceInfo {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #2c3340;
  padding: 2px 0;
}

.memoryPlaceInfo strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.memoryPlaceInfo div {
  color: #5a6578;
  font-size: 0.82rem;
}

.memoryPlaceInfoHint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: #7a8494;
  font-style: italic;
}

/* Diary / memory place field + entry chip */
.memoriesDiaryPlaceField,
.memoriesMemoryPlaceField {
  margin: 10px 0 14px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(74, 139, 181, 0.06) 0%, rgba(255, 255, 255, 0.55) 100%);
  border: 1px solid rgba(74, 139, 181, 0.14);
}

.memoriesDiaryPlaceField .memoriesLabel,
.memoriesMemoryPlaceField .memoriesLabel {
  margin-bottom: 8px;
}

.memoriesOptionalHint {
  font-weight: 500;
  color: var(--locMuted, #5a6578);
  font-size: 0.85em;
}

.memoriesDiaryPlaceActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

#memoriesDiaryPlaceContainer {
  min-height: 42px;
}

#memoriesDiaryPlaceText {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(74, 139, 181, 0.22);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  color: var(--locNavy, #2c3340);
}

.diaryEntryPlace {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 4px 10px;
  max-width: 100%;
  border-radius: 999px;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2f6285;
  background: rgba(74, 139, 181, 0.12);
  line-height: 1.3;
}

.diaryEntryPlace i {
  margin: 0;
  font-size: 0.72rem;
  color: var(--locChrome, #4a8bb5);
}

@media (max-width: 900px) {
  .memoryPlaceLayout {
    grid-template-columns: 1fr;
  }

  .memoryPlaceMap {
    min-height: 240px;
    height: 260px;
  }

  .memoryPlaceList {
    max-height: 340px;
  }

  .memoryPlaceHeader,
  .memoryImportPanel {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #memoriesMemoryPlace,
  .memoryPlaceItem {
    animation: none;
  }

  .memoryPlaceItem:hover,
  .memoryPlaceItem.is-active {
    transform: none;
  }

  .memoryPlaceModeBtn,
  .memoryPlaceCountryItem,
  .memoryCountriesLightboxItem,
  .memoryPlaceWorldCountry {
    transition: none !important;
  }
}

/* —— Map mode switch (Places / Countries) —— */
.memoryPlaceHeaderTop {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
}

.memoryPlaceHeaderTop .memoryPlaceIntro {
  flex: 1 1 280px;
  min-width: 0;
}

.memoryPlaceMapMode {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(74, 139, 181, 0.08);
  border: 1px solid rgba(74, 139, 181, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  flex: 0 0 auto;
}

.memoryPlaceModeBtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--locMuted);
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

.memoryPlaceModeBtn i {
  font-size: 0.9em;
  opacity: 0.85;
}

.memoryPlaceModeBtn:hover {
  color: var(--locNavy);
}

.memoryPlaceModeBtn.is-active {
  color: #fff;
  background: linear-gradient(180deg, #6aa0c4 0%, var(--locChrome) 100%);
  box-shadow: 0 6px 16px rgba(74, 139, 181, 0.28);
}

#memoriesMemoryPlace.is-countries-mode .memoryPlaceModeBtn.is-active {
  background: linear-gradient(180deg, #74b03a 0%, var(--locTealDeep) 100%);
  box-shadow: 0 6px 16px rgba(92, 145, 32, 0.28);
}

.memoryPlaceModeBtn:focus-visible {
  outline: 2px solid var(--locChrome);
  outline-offset: 2px;
}

/* —— Stats strip —— */
.memoryPlaceStats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.memoryPlaceStat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.42) 100%);
  border: 1px solid rgba(74, 139, 181, 0.12);
}

.memoryPlaceStatValue {
  font-family: "Libre Baskerville", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--locNavy);
}

.memoryPlaceStatLabel {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--locMuted);
}

/* —— World map —— */
.memoryPlaceWorldMap {
  position: relative;
  flex: 1;
  min-height: 320px;
  height: clamp(300px, 44vh, 520px);
  overflow: hidden;
  touch-action: none;
  background: linear-gradient(180deg, #6eb0dc 0%, #4a93c9 48%, #3a7fb8 100%);
}

.memoryPlaceWorldMap[hidden],
.memoryPlaceMap[hidden],
.memoryPlaceList[hidden],
.memoryPlaceCountriesList[hidden],
.memoryPlaceStats[hidden],
#memoryImportPanel[hidden] {
  display: none !important;
}

.memoryPlaceWorldSvg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.memoryPlaceWorldSvg:active {
  cursor: grabbing;
}

.memoryPlaceWorldControls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  width: max-content;
  /* Only the buttons capture clicks — gaps/hint pass through to the map */
  pointer-events: none;
}

.memoryPlaceWorldControlBtn {
  appearance: none;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  color: #1f3a52;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 6px 16px rgba(20, 48, 72, 0.18);
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.memoryPlaceWorldControlBtn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 18px rgba(20, 48, 72, 0.22);
}

.memoryPlaceWorldControlBtn:active {
  transform: scale(0.96);
}

.memoryPlaceWorldControlBtn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.memoryPlaceWorldControlReset {
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 3px;
  position: relative;
  box-sizing: border-box;
}

.memoryPlaceWorldControlReset::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
}

.memoryPlaceWorldDragHint {
  margin: 2px 0 0;
  padding: 5px 8px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(20, 48, 72, 0.42);
  backdrop-filter: blur(6px);
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.2;
}

.memoryPlaceWorldCountry {
  cursor: default;
  outline: none !important;
  transition: fill 0.25s ease, stroke 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.memoryPlaceWorldCountry:focus,
.memoryPlaceWorldCountry:focus-visible {
  outline: none !important;
}

.memoryPlaceWorldCountry.is-unvisited {
  filter: saturate(0.72) brightness(1.02);
  pointer-events: none;
}

.memoryPlaceWorldCountry.is-visited {
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.28));
}

.memoryPlaceWorldCountry.is-visited:hover {
  filter: brightness(1.1) drop-shadow(0 4px 10px rgba(79, 134, 24, 0.32));
}

.memoryPlaceWorldCountry.is-visited:focus-visible {
  filter: brightness(1.12) drop-shadow(0 0 0 2px rgba(255, 255, 255, 0.95));
}

/* —— Countries list —— */
.memoryPlaceCountriesList {
  flex: 1;
  max-height: clamp(300px, 44vh, 520px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.memoryPlaceCountryItem {
  appearance: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(92, 145, 32, 0.16);
  background: rgba(255, 252, 249, 0.92);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.memoryPlaceCountryItem:hover {
  transform: translateY(-1px);
  border-color: rgba(92, 145, 32, 0.32);
  box-shadow: 0 8px 20px rgba(92, 145, 32, 0.1);
  background: #fff;
}

.memoryPlaceCountryItem.is-unknown {
  border-color: rgba(74, 139, 181, 0.14);
}

.memoryPlaceCountryCheck {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #74b03a 0%, #4f8618 100%);
  color: #fff;
  font-size: 0.75rem;
  box-shadow: 0 4px 10px rgba(92, 145, 32, 0.25);
}

.memoryPlaceCountryItem.is-unknown .memoryPlaceCountryCheck {
  background: linear-gradient(180deg, #8eb4cc 0%, #5a8faf 100%);
  box-shadow: 0 4px 10px rgba(74, 139, 181, 0.22);
}

.memoryPlaceCountryBody {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.memoryPlaceCountryName {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--locNavy);
}

.memoryPlaceCountryMeta {
  font-size: 0.8rem;
  color: var(--locMuted);
}

.memoryPlaceCountryChevron {
  color: rgba(90, 101, 120, 0.45);
  font-size: 0.75rem;
}

/* —— Country detail lightbox (signup shell; portaled to body) —— */
#memoryCountriesLightbox.form {
  display: none;
  z-index: var(--f2n-lightbox-overlay-z, 10060);
}

#memoryCountriesLightbox.form[aria-hidden="false"] {
  display: flex;
}

@media (min-width: 768px) {
  #memoryCountriesLightbox .memoryCountriesLightboxCard {
    max-width: min(520px, 92vw);
    width: 92%;
    max-height: min(78vh, 720px);
    overflow: auto;
    padding: 28px 26px 24px;
    animation: memoryCountriesLbIn 0.28s ease both;
  }
}

@keyframes memoryCountriesLbIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media screen and (max-width: 767px) {
  #memoryCountriesLightbox.form[aria-hidden="false"] {
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
    background: var(--f2n-lightbox-overlay-mobile-bg, rgba(0, 0, 0, 0.8));
    overflow: hidden;
  }

  #memoryCountriesLightbox > .accountForm.memoryCountriesLightboxCard {
    width: 100%;
    max-width: 100%;
    margin: 0;
    margin-bottom: 0;
    max-height: min(94dvh, 100%);
    border-radius: var(--f2n-lightbox-mobile-card-radius, 16px 16px 0 0);
    padding: var(--f2n-lightbox-mobile-card-padding, 24px 16px 16px 16px);
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    animation: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #memoryCountriesLightbox .memoryCountriesLightboxList {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
}

#memoryCountriesLightbox .memoryCountriesLightboxCard h2 {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--locNavy, #2c3340);
}

#memoryCountriesLightbox .memoryCountriesLightboxIntro {
  margin: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--locMuted, #5a6578);
}

#memoryCountriesLightbox .memoryCountriesLightboxList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Reset signup primary-button look; these are place cards, not CTAs */
#memoryCountriesLightbox .memoryCountriesLightboxItem,
#memoryCountriesLightbox .accountForm button.memoryCountriesLightboxItem {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 0 14px;
  align-items: start;
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 14px 14px 14px 0;
  border: none;
  border-radius: 14px;
  background: #f7faf8;
  color: var(--locNavy, #2c3340);
  box-shadow: 0 0 0 1px rgba(44, 51, 64, 0.08);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.35;
  overflow: hidden;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

#memoryCountriesLightbox .memoryCountriesLightboxItem:hover,
#memoryCountriesLightbox .accountForm button.memoryCountriesLightboxItem:hover {
  transform: translateY(-1px);
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(74, 139, 181, 0.2),
    0 10px 24px rgba(36, 87, 109, 0.1);
}

#memoryCountriesLightbox .memoryCountriesLightboxItem:active,
#memoryCountriesLightbox .accountForm button.memoryCountriesLightboxItem:active {
  transform: none;
}

#memoryCountriesLightbox .memoryCountriesLightboxItem:focus-visible {
  outline: 2px solid var(--color-focus-border, #4a8bb5);
  outline-offset: 2px;
}

#memoryCountriesLightbox .memoryCountriesLightboxAccent {
  align-self: stretch;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: #5c9120;
}

#memoryCountriesLightbox .memoryCountriesLightboxItem.is-memory .memoryCountriesLightboxAccent {
  background: #4a8bb5;
}

#memoryCountriesLightbox .memoryCountriesLightboxItemMain {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 2px 0;
  color: inherit;
}

#memoryCountriesLightbox .memoryCountriesLightboxItemTop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

#memoryCountriesLightbox .memoryCountriesLightboxKind {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #3f6e12;
  background: rgba(92, 145, 32, 0.12);
}

#memoryCountriesLightbox .memoryCountriesLightboxKind.is-memory {
  color: #2a5678;
  background: rgba(74, 139, 181, 0.12);
}

#memoryCountriesLightbox .memoryCountriesLightboxDate {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--locMuted, #5a6578);
  letter-spacing: 0.01em;
}

#memoryCountriesLightbox .memoryCountriesLightboxItemTitle {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--locNavy, #2c3340);
}

#memoryCountriesLightbox .memoryCountriesLightboxPlace {
  font-size: 0.84rem;
  color: #3d6f94;
  line-height: 1.35;
}

#memoryCountriesLightbox .memoryCountriesLightboxSummaryWrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

#memoryCountriesLightbox .memoryCountriesLightboxSummary {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--locMuted, #5a6578);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

#memoryCountriesLightbox .memoryCountriesLightboxSummary.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

#memoryCountriesLightbox .memoryCountriesLightboxMore {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3d6f94;
  cursor: pointer;
  line-height: 1.2;
  align-self: flex-start;
}

#memoryCountriesLightbox .memoryCountriesLightboxMore:hover,
#memoryCountriesLightbox .memoryCountriesLightboxMore:focus-visible {
  text-decoration: underline;
  outline: none;
}

#memoryCountriesLightbox .memoryCountriesLightboxItemGo {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(74, 139, 181, 0.1);
  color: #3d6f94;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
  transition: background 0.18s ease, transform 0.18s ease;
}

#memoryCountriesLightbox .memoryCountriesLightboxItemGo::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg) translateX(-1px);
}

#memoryCountriesLightbox .memoryCountriesLightboxItem:hover .memoryCountriesLightboxItemGo {
  background: rgba(74, 139, 181, 0.18);
  transform: translateX(2px);
}

@media (max-width: 720px) {
  .memoryPlaceShell {
    gap: 12px;
  }

  .memoryPlaceHeader {
    gap: 8px;
    padding: 14px;
  }

  .memoryPlaceHeaderTop {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .memoryPlaceHeaderTop .memoryPlaceIntro {
    flex: 0 1 auto;
  }

  .memoryPlaceMapMode {
    width: 100%;
  }

  .memoryPlaceModeBtn {
    padding: 10px 12px;
  }

  .memoryPlaceWorldMap {
    min-height: 240px;
    height: 280px;
  }

  .memoryPlaceWorldControls {
    right: 8px;
    bottom: 8px;
    gap: 5px;
  }

  .memoryPlaceWorldControlBtn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 1.15rem;
  }

  #memoryCountriesLightbox .memoryCountriesLightboxList {
    gap: 12px;
  }

  #memoryCountriesLightbox .memoryCountriesLightboxItem,
  #memoryCountriesLightbox .accountForm button.memoryCountriesLightboxItem {
    flex: 0 0 auto;
    align-self: stretch;
    grid-template-columns: 3px minmax(0, 1fr) auto;
    gap: 0 10px;
    align-items: start;
    padding: 12px 10px 12px 0;
    margin: 0;
    min-height: 0;
    height: auto;
  }

  #memoryCountriesLightbox .memoryCountriesLightboxAccent {
    align-self: stretch;
    min-height: 100%;
  }

  #memoryCountriesLightbox .memoryCountriesLightboxItemTitle {
    font-size: 0.95rem;
  }

  .memoryPlaceCountriesList {
    max-height: 340px;
  }

  .memoryPlaceStats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .memoryPlaceStat {
    padding: 10px;
  }

  .memoryPlaceStatValue {
    font-size: 1.25rem;
  }
}
