/* MyMappi v786 — a calm, premium customization hub with clear essentials. */

html body .customize-mymappi-dialog {
  width: min(800px, calc(100vw - 28px));
  max-width: 800px;
}

html body .customize-mymappi-panel {
  gap: 14px;
  padding: 22px;
  scroll-padding-block: 150px 96px;
  background:
    radial-gradient(circle at 90% -5%, rgba(102, 218, 190, 0.18), transparent 32%),
    radial-gradient(circle at -4% 48%, rgba(115, 198, 220, 0.12), transparent 30%),
    linear-gradient(150deg, #fffefa 0%, #f1f8f6 52%, #edf7f6 100%);
}

html body .customize-mymappi-panel > .customize-mymappi-heading { order: 0; }
html body .customize-mymappi-panel > .customize-safety-note { order: 1; }
html body .customize-mymappi-panel > .customize-device-note { order: 2; }
html body .customize-mymappi-panel > .customize-live-preview { order: 3; }
html body .customize-mymappi-panel > .customize-look-presets { order: 4; }
html body .customize-mymappi-panel > .customize-view-switcher { order: 5; }
html body .customize-mymappi-panel > .customize-view-note { order: 6; }
html body .customize-mymappi-panel > .customize-section-jump { order: 7; }
html body .customize-mymappi-panel > .customize-map-section { order: 10; }
html body .customize-mymappi-panel > .customize-pin-section { order: 11; }
html body .customize-mymappi-panel > .customize-identity-section { order: 12; }
html body .customize-mymappi-panel > .customize-cover-section { order: 20; }
html body .customize-mymappi-panel > .customize-category-builder-section { order: 21; }
html body .customize-mymappi-panel > .customize-chapter-section { order: 22; }
html body .customize-mymappi-panel > .customize-route-section { order: 23; }
html body .customize-mymappi-panel > .customize-capsule-section { order: 24; }
html body .customize-mymappi-panel > .customize-mymappi-actions { order: 30; }

html body .customize-mymappi-dialog[data-customization-view="quick"] .customize-advanced-section,
html body .customize-mymappi-dialog[data-customization-view="all"] .customize-quick-section {
  display: none;
}

html body .customize-safety-note {
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(248, 252, 249, 0.76);
}

html body .customize-device-note {
  margin-top: 0;
  border-color: rgba(51, 132, 154, 0.12);
  background: rgba(237, 247, 249, 0.72);
}

html body .customize-live-preview {
  top: 8px;
  grid-template-columns: 112px minmax(0, 1fr) 70px;
  min-height: 108px;
  padding: 13px;
  border-color: rgba(36, 146, 132, 0.22);
  background:
    radial-gradient(circle at 8% 0%, rgba(87, 226, 184, 0.22), transparent 39%),
    linear-gradient(142deg, rgba(255, 255, 252, 0.98), rgba(229, 245, 241, 0.97));
  /* Sticky preview must mask scrolled option text beneath its gradients. */
  background-color: #edf8f4;
  box-shadow:
    0 18px 42px rgba(4, 55, 68, 0.14),
    0 0 0 5px rgba(246, 252, 249, 0.92);
}

html body .customize-preview-copy small {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

html body .customize-preview-category {
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  padding: 3px 8px;
  overflow: hidden;
  border: 1px solid rgba(11, 122, 112, 0.13);
  border-radius: 999px;
  color: #397078;
  background: rgba(255, 255, 252, 0.68);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body .customize-live-preview[data-pin-color-mode="feeling"] .customize-preview-pin {
  background: conic-gradient(from 25deg, #42a56e, #2b79e5, #f2a53b, #f05a67, #42a56e);
}

html body .customize-live-preview[data-pin-color-mode="category"] .customize-preview-pin {
  background: var(--preview-pin-color);
}

html body .customize-preview-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #169578;
  box-shadow: 0 0 0 4px rgba(39, 180, 145, 0.12);
}

html body .customize-live-preview[data-preview-state="dirty"] .customize-preview-state-dot {
  background: #ee725d;
  box-shadow: 0 0 0 4px rgba(238, 114, 93, 0.13);
}

html body .customize-live-preview[data-chapter-style="postcard"] .customize-preview-capsule {
  border-radius: 7px;
  transform: rotate(-2deg);
}

html body .customize-live-preview[data-chapter-style="film"] .customize-preview-capsule {
  border: 5px solid #123945;
  background: #fdfaf2;
}

html body .customize-live-preview[data-cover-photo-mode="center"] .customize-preview-capsule span {
  background: radial-gradient(circle at center, #ffd184 0 18%, var(--preview-chapter-color) 20% 100%);
}

html body .customize-live-preview[data-personality="playful"] .customize-preview-pin {
  transform: rotate(-41deg) scale(1.08);
}

html body .customize-live-preview[data-personality="minimal"] :is(.customize-preview-pin, .customize-preview-chapter-symbol, .customize-preview-capsule) {
  box-shadow: none;
}

html body .customize-look-presets {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid rgba(18, 108, 112, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 252, 0.72);
  box-shadow: 0 10px 24px rgba(7, 62, 72, 0.05);
}

html body .customize-presets-heading {
  display: flex;
  gap: 14px;
  align-items: end;
  justify-content: space-between;
}

html body .customize-presets-heading > div {
  display: grid;
  gap: 1px;
}

html body .customize-presets-heading small,
html body .customize-presets-heading > span {
  color: #5b787e;
  font-size: 0.67rem;
  font-weight: 680;
}

html body .customize-presets-heading small {
  color: #0b8277;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html body .customize-presets-heading h3 {
  margin: 0;
  color: #073845;
  font-size: 0.98rem;
  font-weight: 880;
}

html body .customize-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

html body .customize-preset-grid button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  min-width: 0;
  min-height: 62px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(14, 91, 100, 0.12);
  border-radius: 16px;
  color: #214f58;
  background: rgba(248, 251, 248, 0.9);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

html body .customize-preset-grid button > i {
  width: 26px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  background: linear-gradient(145deg, #a9dfca, #8bc8df);
  box-shadow: 0 5px 12px rgba(4, 55, 64, 0.14);
}

html body .customize-preset-grid button[data-customize-preset="golden"] > i { background: linear-gradient(145deg, #f3db9c, #bd9b67); }
html body .customize-preset-grid button[data-customize-preset="midnight"] > i { background: linear-gradient(145deg, #1b4d5b, #10293f); }
html body .customize-preset-grid button[data-customize-preset="adventure"] > i { background: linear-gradient(145deg, #76d99f, #70bfe9); }

html body .customize-preset-grid button > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

html body .customize-preset-grid button strong,
html body .customize-preset-grid button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body .customize-preset-grid button strong { font-size: 0.72rem; font-weight: 850; }
html body .customize-preset-grid button small { color: #607c81; font-size: 0.61rem; font-weight: 650; }

html body .customize-preset-grid button[aria-pressed="true"] {
  border-color: rgba(20, 155, 130, 0.43);
  background: linear-gradient(145deg, rgba(225, 249, 239, 0.96), rgba(230, 246, 249, 0.92));
  box-shadow: 0 8px 18px rgba(13, 117, 108, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.84);
}

html body .customize-view-switcher {
  padding: 6px;
  border-radius: 20px;
  background: rgba(221, 238, 235, 0.8);
}

html body .customize-view-switcher button {
  min-height: 58px;
  padding: 9px 13px;
  text-align: center;
}

html body .customize-view-switcher button strong { font-size: 0.82rem; }
html body .customize-view-switcher button small { font-size: 0.66rem; }

html body .customize-section-jump {
  max-width: 100%;
  overflow: hidden;
}

html body .customize-section-jump > div {
  display: flex;
  gap: 7px;
  padding: 2px 1px 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

html body .customize-section-jump > div::-webkit-scrollbar { display: none; }
html body .customize-section-jump > div[hidden] { display: none !important; }

html body .customize-section-jump button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(14, 91, 100, 0.12);
  border-radius: 999px;
  color: #315f67;
  background: rgba(255, 255, 252, 0.82);
  font-size: 0.68rem;
  font-weight: 780;
}

html body .customize-mymappi-section {
  scroll-margin-top: 136px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 252, 0.78);
}

html body .customize-category-palette,
html body .customize-mymappi-dialog[data-pin-color-mode="feeling"] .customize-category-palette {
  display: block;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
}

html body .customize-category-palette > summary {
  display: flex;
  min-height: 58px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
}

html body .customize-category-palette > summary::-webkit-details-marker { display: none; }

html body .customize-category-palette > summary > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

html body .customize-category-palette > summary strong {
  color: #174b55;
  font-size: 0.78rem;
  font-weight: 850;
}

html body .customize-category-palette > summary small {
  color: #607c81;
  font-size: 0.66rem;
  font-weight: 650;
}

html body .customize-details-action {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: #087f74;
  font-size: 0.68rem;
  font-weight: 850;
}

html body .customize-details-action svg {
  width: 15px;
  height: 15px;
  transition: transform 160ms ease;
}

html body .customize-category-palette[open] .customize-details-action svg { transform: rotate(180deg); }

html body .customize-category-help {
  margin: 0;
  padding: 11px 13px;
  border-block: 1px solid rgba(13, 91, 100, 0.08);
  color: #547279;
  background: rgba(232, 246, 241, 0.58);
  font-size: 0.67rem;
  font-weight: 640;
  line-height: 1.45;
}

html body .customize-core-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

html body .customize-core-category-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 42px;
  min-width: 0;
  gap: 7px;
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(13, 91, 100, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 252, 0.88);
}

html body .customize-core-category-emoji {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: rgba(224, 242, 237, 0.72);
  font-size: 1rem;
}

html body .customize-core-category-row input[type="text"] {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid rgba(13, 91, 100, 0.12);
  border-radius: 11px;
  color: #103f4a;
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 760;
}

html body .customize-core-category-color input {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 4px;
  border: 1px solid rgba(13, 91, 100, 0.13);
  border-radius: 12px;
  background: #fff;
}

html body .customize-category-palette[data-color-controls-active="false"] .customize-core-category-color {
  opacity: 0.42;
}

html body .customize-category-palette[data-color-controls-active="false"] .customize-category-help::after {
  content: " Choose Category above to edit colors.";
  color: #0b756d;
  font-weight: 820;
}

html body .customize-core-category-row input[aria-invalid="true"],
html body .customize-category-row input[aria-invalid="true"] {
  border-color: #c84f49;
  box-shadow: 0 0 0 3px rgba(200, 79, 73, 0.1);
}

html body .customize-mymappi-actions {
  bottom: -1px;
  border-radius: 21px;
}

html body .customize-discard-confirm {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(205, 111, 87, 0.2);
  border-radius: 15px;
  background: #fff8f2;
}

html body .customize-discard-confirm[hidden] { display: none !important; }

html body .customize-discard-confirm > span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

html body .customize-discard-confirm strong { color: #663d32; font-size: 0.73rem; font-weight: 850; }
html body .customize-discard-confirm small { color: #795b52; font-size: 0.62rem; font-weight: 640; }

html body .customize-discard-confirm button {
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid rgba(103, 65, 54, 0.16);
  border-radius: 11px;
  color: #5f463f;
  background: #fff;
  font-size: 0.66rem;
  font-weight: 790;
}

html body .customize-discard-confirm #customizeDiscardChanges {
  color: #fff;
  background: #8d4b3e;
}

html body :is(
  .customize-preset-grid button,
  .customize-section-jump button,
  .customize-category-palette > summary,
  .customize-core-category-row input,
  .customize-category-row input,
  .customize-add-category,
  .customize-remove-category,
  .customize-symbol-grid label,
  .customize-single-color input
):focus-visible,
html body :is(
  .customize-core-category-row,
  .customize-category-row,
  .customize-symbol-grid label,
  .customize-single-color
):has(input:focus-visible) {
  outline: 3px solid rgba(15, 149, 157, 0.28);
  outline-offset: 2px;
}

html body .customize-mymappi-status:not(:empty) {
  display: block;
  padding: 2px 4px;
}

html[data-mymappi-map-theme="paper"] body .map-stage #map .leaflet-tile { filter: sepia(0.28) saturate(0.72) contrast(0.94) brightness(1.04); }
html[data-mymappi-map-theme="midnight"] body .map-stage #map .leaflet-tile { filter: brightness(0.62) saturate(0.82) contrast(1.18) hue-rotate(146deg); }
html[data-mymappi-map-theme="adventure"] body .map-stage #map .leaflet-tile { filter: saturate(1.36) contrast(1.08) brightness(0.98); }

@media (hover: hover) {
  html body .customize-preset-grid button:hover,
  html body .customize-section-jump button:hover {
    border-color: rgba(18, 149, 127, 0.3);
    transform: translateY(-1px);
  }
}

@media (max-width: 700px) {
  html body .customize-preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html body .customize-core-category-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  html body .customize-mymappi-panel {
    gap: 11px;
    padding: 16px 13px max(13px, env(safe-area-inset-bottom));
    scroll-padding-block: 128px 96px;
  }

  html body .customize-live-preview {
    top: 5px;
    grid-template-columns: 84px minmax(0, 1fr);
    min-height: 94px;
    gap: 10px;
    padding: 10px;
  }

  html body .customize-preview-map { width: 84px; height: 70px; }
  html body .customize-preview-route { top: 36px; left: 11px; width: 58px; }
  html body .customize-preview-pin { right: 11px; bottom: 9px; }
  html body .customize-look-presets { padding: 12px; border-radius: 19px; }
  html body .customize-presets-heading > span { display: none; }
  html body .customize-preset-grid button { min-height: 58px; }
  html body .customize-view-switcher button { min-height: 54px; padding-inline: 8px; }
  html body .customize-view-switcher button small { white-space: normal; line-height: 1.2; }
  html body .customize-mymappi-section { padding: 15px; scroll-margin-top: 118px; }
  html body .customize-discard-confirm { grid-template-columns: minmax(0, 1fr) auto; }
  html body .customize-discard-confirm > span { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  html body .customize-theme-grid,
  html body .customize-pin-style-grid,
  html body .customize-personality-grid,
  html body .customize-chapter-section .customize-choice-grid,
  html body .customize-route-section .customize-choice-grid,
  html body .customize-capsule-section .customize-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  html body .customize-theme-grid .customize-choice-card,
  html body .customize-pin-style-grid .customize-choice-card {
    min-height: 78px;
  }

  html body .customize-choice-card small,
  html body .customize-view-switcher button small,
  html body .customize-preset-grid button small,
  html body .customize-category-help {
    font-size: 0.7rem;
  }

  html body .customize-preset-grid button {
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 8px;
  }

  html body .customize-preset-grid button > i { width: 24px; }
  html body .customize-core-category-row { grid-template-columns: 34px minmax(0, 1fr) 44px; }
}

@media (max-width: 360px) {
  html body .customize-mymappi-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  html body .customize-mymappi-actions > :is(.customize-mymappi-status, .customize-discard-confirm) {
    grid-column: 1;
  }
}

@media (max-height: 620px) {
  html body .customize-live-preview { position: relative; top: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html body .customize-preset-grid button,
  html body .customize-details-action svg,
  html body .customize-section-jump button {
    scroll-behavior: auto;
    transition: none;
  }
}
