#map-settings {
  --settings-button-size: 42px;
  position: fixed; top: 10px; right: 14px; z-index: 1860;
  color: var(--night-ink, #222); font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
#map-settings[hidden], #map-display-settings[hidden] { display: none; }
#desktop-map-tools #map-settings { position: relative; inset: auto; z-index: auto; flex: 0 0 auto; }
#map-settings-toggle, #map-display-settings {
  box-sizing: border-box; border: 1px solid var(--night-border, #e0dcd8);
  background: var(--settings-panel-surface, var(--night-search-surface, #fffdfb)); box-shadow: 0 5px 18px #0005;
}
#map-settings-toggle {
  display: grid; place-items: center; width: var(--settings-button-size); height: var(--settings-button-size);
  padding: 0; border-radius: 50%; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#map-settings-toggle[aria-expanded="false"]:hover {
  border-color: var(--night-accent, #e60012); color: var(--night-accent, #e60012);
}
#map-settings-toggle[aria-expanded="true"] {
  border-color: var(--night-red, #d4141c); background: var(--night-red, #d4141c); color: #fff;
}
#map-settings-toggle svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
#map-display-settings {
  --settings-panel-surface: var(--night-search-surface, #fffdfb);
  --settings-padding-inline: 12px;
  --author-email-width: clamp(140px, 45vw, 176px);
  --author-email-gap: 6px;
  --author-email-shift: max(0px, calc(var(--author-email-width) + var(--author-email-gap) - var(--author-email-room, 0px)));
  position: absolute; top: calc(100% + 8px); right: var(--author-email-shift); width: max-content;
  max-width: calc(100vw - 28px - var(--author-email-shift));
  padding: 6px var(--settings-padding-inline); border-radius: 14px;
}
:root[data-color-theme="light"] #map-display-settings { --settings-panel-surface: #fff; --author-email-ink: #000; }
.map-display-row { display: flex; align-items: center; gap: 8px; }
#map-display-title, #map-author-title { font-size: 14px; font-weight: 750; white-space: nowrap; }
.map-display-choices { display: flex; gap: 6px; }
.map-display-choices label {
  display: flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 8px; white-space: nowrap;
  color: var(--night-copy, #333); font-size: 12px; font-weight: 650; cursor: pointer;
}
.map-display-choices label:is(:hover, :has(input:checked)) { color: var(--night-ink, #222); }
.map-display-choices input { flex: 0 0 auto; margin: 0; accent-color: var(--night-accent, #e60012); }
.map-display-choices input:focus-visible { outline: 2px solid var(--night-accent, #e60012); outline-offset: 2px; }
.map-author-row {
  position: relative; justify-content: space-between; margin-top: 4px; padding-top: 5px;
  border-top: 1px solid var(--night-border, #e0dcd8);
}
.map-author-links { display: flex; align-items: center; gap: 4px; min-width: 0; }
.map-author-links :is(a, button) {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; color: var(--night-copy, #333);
}
.map-author-links button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.map-author-links :is(a, button):is(:hover, :focus-visible, [aria-expanded="true"]) { background: var(--night-hover); color: var(--night-accent, #e60012); }
.map-author-links :is(a, button):focus-visible { outline: 2px solid currentColor; outline-offset: -1px; }
.map-author-links svg { width: 17px; height: 17px; fill: currentColor; }
#map-author-email-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#map-author-email {
  position: absolute; left: calc(100% + var(--settings-padding-inline) + 1px + var(--author-email-gap));
  top: calc(50% + 3px); transform: translateY(-50%);
  box-sizing: border-box; width: var(--author-email-width); padding: 6px 8px;
  border-radius: 8px; background: var(--settings-panel-surface); color: var(--author-email-ink, #fff);
  border: 0; font: inherit; font-size: clamp(10px, 3vw, 12px); line-height: 1.35;
  text-align: center; white-space: nowrap; cursor: pointer;
}
#map-author-email:focus-visible { outline: 2px solid var(--night-accent, #e60012); }
.map-author-email-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  #map-display-settings:not([hidden]) { animation: map-settings-appear .16s ease-out; }
  @keyframes map-settings-appear {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

#map[data-marker-layout="uniform"] .map-profile-marker {
  width: var(--uniform-avatar-size) !important;
  height: var(--uniform-avatar-size) !important;
  margin-left: calc(var(--uniform-offset-x, 0px) * var(--uniform-zoom-scale, 1) - var(--uniform-avatar-size) * .5) !important;
  margin-top: calc(var(--uniform-offset-y, 0px) * var(--uniform-zoom-scale, 1) - var(--uniform-avatar-size) * .5) !important;
}
#map[data-marker-layout="uniform"] .map-profile-marker .singer-marker-container {
  width: var(--uniform-avatar-size); height: var(--uniform-avatar-size); transform: none; transform-origin: center;
}
#map[data-marker-layout="uniform"] .map-profile-marker .singer-avatar-main { width: 100%; height: 100%; border-width: 1px; }
@media (hover: hover) {
  #map[data-marker-layout="uniform"] .map-profile-marker:not(.is-profile-selected) .singer-marker-container:hover { transform: scale(1.1); }
}
@media (max-width: 480px) {
  #map-settings {
    --settings-button-size: 48px;
    top: calc(8px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  }
  body[data-map-layout="rail"] #mobile-map-tools .mobile-map-search {
    right: calc(max(12px, env(safe-area-inset-right)) + 56px);
  }
  .map-display-choices label { min-height: 38px; }
  .map-author-links :is(a, button) { width: 44px; height: 44px; }
}
@media (max-width: 400px) {
  #map-display-settings > .map-display-row:not(.map-author-row) {
    flex-wrap: wrap; gap: 0 6px;
  }
  #map-display-title { font-size: 12px; }
  .map-display-choices { gap: 4px; }
  .map-display-choices label { padding-inline: 3px; font-size: 11px; }
  .map-author-links :is(a, button) { width: 36px; }
}
@media (max-width: 360px) {
  #map-display-settings { --settings-padding-inline: 8px; }
  .map-author-row { gap: 4px; }
  #map-display-settings :is(#map-theme-title, #map-author-title) { font-size: 12px; }
  #map-display-settings .map-theme-switch label { width: 31px; }
  .map-author-links :is(a, button) { width: 30px; }
}
