/* Universal cover focus: one private focal point, adapted to every cover frame. */
html body .memory-cover-focus-dialog {
  width: min(560px, calc(100vw - 28px));
  max-width: 560px;
  max-height: min(760px, calc(100dvh - 28px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(212, 240, 236, 0.82);
  border-radius: 30px;
  color: #073744;
  background: rgba(255, 253, 248, 0.985);
  box-shadow: 0 34px 90px rgba(1, 28, 46, 0.28), 0 5px 18px rgba(8, 77, 91, 0.12);
}

html body .memory-cover-focus-dialog::backdrop {
  background: rgba(1, 25, 43, 0.48);
  backdrop-filter: blur(9px) saturate(0.9);
  -webkit-backdrop-filter: blur(9px) saturate(0.9);
}

html body .memory-cover-focus-panel {
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto auto auto;
  gap: 14px;
  max-height: min(760px, calc(100dvh - 28px));
  padding: 23px;
  overflow: auto;
  background:
    radial-gradient(circle at 84% 8%, rgba(67, 205, 193, 0.12), transparent 32%),
    linear-gradient(145deg, rgba(255, 253, 248, 0.99), rgba(241, 249, 246, 0.98));
}

html body .memory-cover-focus-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

html body .memory-cover-focus-heading > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

html body .memory-cover-focus-heading span {
  color: #0b776f;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

html body .memory-cover-focus-heading h2 {
  margin: 0;
  color: #052f3e;
  font-size: clamp(1.3rem, 4vw, 1.75rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

html body .memory-cover-focus-close,
html body .memory-cover-focus-nudges button {
  display: inline-grid;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(7, 67, 83, 0.14);
  color: #083b4a;
  background: rgba(250, 253, 249, 0.92);
  box-shadow: 0 6px 16px rgba(4, 51, 63, 0.08);
}

html body .memory-cover-focus-close {
  border-radius: 50%;
}

html body .memory-cover-focus-panel > p {
  margin: 0;
  color: #55747b;
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1.45;
}

html body .memory-cover-focus-stage {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 260px;
  max-height: 410px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(113, 213, 199, 0.4);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 45%, rgba(26, 102, 123, 0.96), rgba(1, 31, 52, 0.99));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 14px 30px rgba(3, 47, 63, 0.13);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

html body .memory-cover-focus-stage img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  max-height: 410px;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

html body .memory-cover-focus-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 3px solid #f8fff9;
  border-radius: 50%;
  background: rgba(9, 93, 105, 0.12);
  box-shadow: 0 0 0 5px rgba(81, 219, 179, 0.56), 0 8px 22px rgba(1, 24, 41, 0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

html body .memory-cover-focus-ring::before,
html body .memory-cover-focus-ring::after {
  content: "";
  position: absolute;
  background: rgba(248, 255, 249, 0.88);
}

html body .memory-cover-focus-ring::before {
  width: 14px;
  height: 2px;
}

html body .memory-cover-focus-ring::after {
  width: 2px;
  height: 14px;
}

html body .memory-cover-focus-ring > span {
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255, 253, 248, 0.96);
  border-radius: 50%;
  background: #f2555f;
  box-shadow: 0 2px 8px rgba(112, 37, 49, 0.28);
}

html body .memory-cover-focus-stage:focus-visible {
  outline: 4px solid rgba(37, 174, 188, 0.28);
  outline-offset: 3px;
}

html body .memory-cover-focus-nudges {
  display: flex;
  justify-content: center;
  gap: 8px;
}

html body .memory-cover-focus-nudges button {
  border-radius: 14px;
}

html body .memory-cover-focus-status {
  min-height: 1.3em;
  color: #628087 !important;
  text-align: center;
  font-size: 0.76rem !important;
}

html body .memory-cover-focus-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
}

html body .memory-cover-focus-actions button {
  min-height: 46px;
  padding: 0 17px;
  border-radius: 15px;
  font-size: 0.82rem;
  font-weight: 820;
}

html body .memory-cover-focus-auto,
html body .memory-cover-focus-cancel {
  border: 1px solid rgba(7, 67, 83, 0.14);
  color: #315f67;
  background: rgba(255, 255, 252, 0.86);
}

html body .memory-cover-focus-save {
  min-width: 132px;
  border: 1px solid rgba(85, 220, 180, 0.36);
  color: #f8fffc;
  background: linear-gradient(112deg, #00243f 0%, #07556f 52%, #0b806e 100%);
  box-shadow: 0 12px 24px rgba(4, 71, 88, 0.2);
}

html body .memory-cover-focus-save:disabled {
  opacity: 0.52;
  box-shadow: none;
}

html body .memory-cover-focus-actions button:focus-visible,
html body .memory-cover-focus-close:focus-visible,
html body .memory-cover-focus-nudges button:focus-visible {
  outline: 3px solid rgba(35, 170, 183, 0.25);
  outline-offset: 2px;
}

@media (hover: hover) {
  html body .memory-cover-focus-actions button:not(:disabled):hover,
  html body .memory-cover-focus-close:hover,
  html body .memory-cover-focus-nudges button:hover {
    filter: brightness(1.025);
    transform: translateY(-1px);
  }
}

@media (max-width: 560px) {
  html body .memory-cover-focus-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
    border-radius: 26px;
  }

  html body .memory-cover-focus-panel {
    grid-template-rows: auto auto minmax(210px, 1fr) auto auto auto;
    max-height: calc(100dvh - 18px);
    padding: 18px 15px max(16px, env(safe-area-inset-bottom));
    gap: 11px;
  }

  html body .memory-cover-focus-stage,
  html body .memory-cover-focus-stage img {
    min-height: 225px;
    max-height: min(45dvh, 380px);
    border-radius: 20px;
  }

  html body .memory-cover-focus-actions {
    grid-template-columns: 1fr 1fr;
  }

  html body .memory-cover-focus-auto {
    grid-column: 1 / -1;
  }

  html body .memory-cover-focus-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .memory-cover-focus-dialog,
  html body .memory-cover-focus-dialog *,
  html body .memory-cover-focus-dialog *::before,
  html body .memory-cover-focus-dialog *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Keep framing controls beside the chapter action—not over the photograph. */
html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions {
  grid-template-columns: 44px minmax(0, 1fr) !important;
  align-items: center !important;
}

html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions .life-chapter-completion-status,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions .life-chapter-completion-status {
  grid-column: 1 / -1 !important;
}

html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover {
  appearance: none !important;
  -webkit-appearance: none !important;
  position: static !important;
  grid-column: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(8, 92, 105, 0.16) !important;
  border-radius: 999px !important;
  color: #07576a !important;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(229, 246, 240, 0.78)) !important;
  box-shadow: 0 7px 16px rgba(4, 67, 78, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.82) !important;
  font: inherit !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-adjust-cover svg,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-adjust-cover svg {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
  stroke-width: 2.2 !important;
}

html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions .life-chapter-relive,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions .life-chapter-relive {
  grid-column: 2 !important;
  min-height: 44px !important;
}

html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover:focus-visible,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover:focus-visible {
  outline: 3px solid rgba(85, 226, 187, 0.62) !important;
  outline-offset: 2px !important;
}

@media (hover: hover) {
  html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover:hover,
  html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover:hover {
    color: #043f52 !important;
    background: linear-gradient(145deg, #ffffff, #dff6ec) !important;
    transform: translateY(-1px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover,
  html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions button.life-chapter-adjust-cover {
    transition: none !important;
  }
}
