/*
 * Layer panel v2
 * Isolated from the legacy toolbox CSS on purpose. The legacy renderer stays
 * mounted and becomes visible again as soon as `layer-panel-ui-v2` is removed.
 */

.layer-panel-v2,
.layer-panel-v2-backdrop,
.layer-panel-v1__modernize {
  display: none;
}

body.layer-panel-ui-v2 .basemap-toolbox.layer-panel-v1 {
  display: none !important;
}

body.layer-panel-ui-v2 .layer-panel-v2 {
  --lp2-width: min(408px, calc(100vw - 24px));
  --lp2-edge: 12px;
  --lp2-radius: 20px;
  --lp2-surface: rgba(15, 28, 36, 0.965);
  --lp2-surface-raised: rgba(255, 255, 255, 0.055);
  --lp2-surface-hover: rgba(255, 255, 255, 0.085);
  --lp2-border: rgba(255, 255, 255, 0.12);
  --lp2-border-strong: rgba(255, 255, 255, 0.18);
  --lp2-text: rgba(255, 255, 255, 0.94);
  --lp2-muted: rgba(218, 228, 232, 0.6);
  --lp2-accent: #728c6c;
  --lp2-accent-rgb: 114, 140, 108;
  --lp2-accent-soft: rgba(var(--lp2-accent-rgb), 0.18);
  box-sizing: border-box;
  display: grid;
  position: fixed;
  z-index: 1200;
  top: calc(var(--app-header-height, 58px) + var(--lp2-edge));
  right: max(var(--lp2-edge), env(safe-area-inset-right, 0px));
  width: var(--lp2-width);
  height: calc(100dvh - var(--app-header-height, 58px) - (2 * var(--lp2-edge)));
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
  color: var(--lp2-text);
  background:
    linear-gradient(160deg, rgba(25, 40, 48, 0.985), var(--lp2-surface) 52%, rgba(12, 24, 32, 0.985));
  border: 1px solid var(--lp2-border);
  border-radius: var(--lp2-radius);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.46),
    0 3px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(28px) scale(0.985);
  transform-origin: top right;
  transition:
    opacity 180ms ease,
    visibility 0s linear 260ms,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.layer-panel-ui-v2 .layer-panel-v2.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  transition:
    opacity 180ms ease,
    visibility 0s linear 0s,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.layer-panel-ui-v2 .layer-panel-v2-backdrop {
  display: block;
  position: fixed;
  z-index: 1190;
  inset: var(--app-header-height, 58px) 0 0;
  padding: 0;
  border: 0;
  background: rgba(2, 8, 12, 0.06);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

body.layer-panel-ui-v2 .layer-panel-v2-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s linear 0s;
}

.lp2-header {
  box-sizing: border-box;
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, auto) auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px 12px 18px;
  border-bottom: 1px solid var(--lp2-border);
}

.lp2-title {
  min-width: 0;
  margin: 0;
  color: var(--lp2-text);
  font-family: var(--font-ui, Inter, system-ui, sans-serif);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.lp2-active-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--lp2-accent);
  font-family: var(--font-ui, Inter, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--lp2-accent-soft);
  border: 1px solid rgba(var(--lp2-accent-rgb), 0.36);
  border-radius: 999px;
}

.lp2-reset,
.lp2-close,
.lp2-see-all,
.lp2-basemap-card,
.lp2-toggle-row,
.lp2-analysis__summary,
.lp2-choice,
.lp2-mode-switch button {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-ui, Inter, system-ui, sans-serif);
  -webkit-tap-highlight-color: transparent;
}

.lp2-reset {
  justify-self: end;
  min-height: 36px;
  padding: 0 3px;
  color: var(--lp2-accent);
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.lp2-reset:disabled {
  opacity: 0.45;
  cursor: wait;
}

.lp2-close {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--lp2-border);
  border-radius: 10px;
  cursor: pointer;
}

.lp2-icon,
.lp2-row-icon,
.lp2-analysis__icon,
.lp2-analysis__chevron,
.lp2-choice__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.lp2-icon,
.lp2-icon svg {
  width: 20px;
  height: 20px;
}

.lp2-body {
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 17px;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.lp2-body::-webkit-scrollbar {
  width: 8px;
}

.lp2-body::-webkit-scrollbar-track {
  background: transparent;
}

.lp2-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.lp2-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.lp2-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lp2-section-label {
  margin: 0;
  color: rgba(241, 246, 247, 0.82);
  font-family: var(--font-ui, Inter, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.lp2-see-all {
  min-height: 28px;
  padding: 0 3px;
  color: var(--lp2-accent);
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.lp2-basemap-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lp2-basemap-card {
  position: relative;
  min-width: 0;
  min-height: 105px;
  display: grid;
  grid-template-rows: 76px minmax(22px, auto);
  gap: 6px;
  align-items: start;
  padding: 4px 4px 5px;
  color: var(--lp2-text);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.lp2-basemap-card[data-secondary="true"] {
  display: none;
}

.lp2-section--basemaps.show-all .lp2-basemap-card[data-secondary="true"] {
  display: grid;
}

.lp2-basemap-card__image,
.lp2-basemap-card__fallback {
  box-sizing: border-box;
  width: 100%;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(145deg, #3e5757, #7a755f 48%, #a9b3aa);
  border-radius: 9px;
  filter: saturate(0.88) contrast(0.98);
}

.lp2-basemap-card__label {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11.5px;
  font-weight: 620;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp2-basemap-card__check {
  position: absolute;
  z-index: 1;
  top: 60px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10241a;
  font-size: 12px;
  font-weight: 900;
  background: var(--lp2-accent);
  border: 2px solid rgba(15, 28, 36, 0.96);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 140ms ease, transform 140ms ease;
}

.lp2-basemap-card__region-badge {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 9px;
  box-sizing: border-box;
  width: 23px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.44);
}

.lp2-basemap-card__region-badge--france {
  background: linear-gradient(90deg, #0055a4 0 33.333%, #fff 33.333% 66.666%, #ef4135 66.666% 100%);
}

.lp2-basemap-card__region-badge--switzerland {
  width: 18px;
  height: 18px;
  background: #da291c;
}

.lp2-basemap-card__region-badge--switzerland::before,
.lp2-basemap-card__region-badge--switzerland::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 3px;
  background: #fff;
  border-radius: 0.5px;
  transform: translate(-50%, -50%);
}

.lp2-basemap-card__region-badge--switzerland::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.lp2-basemap-card.is-active {
  background: var(--lp2-accent-soft);
  border-color: rgba(var(--lp2-accent-rgb), 0.9);
  box-shadow: 0 0 0 1px rgba(var(--lp2-accent-rgb), 0.28);
}

.lp2-basemap-card.is-active .lp2-basemap-card__image,
.lp2-basemap-card.is-active .lp2-basemap-card__fallback {
  filter: none;
}

.lp2-basemap-card.is-active .lp2-basemap-card__label {
  color: var(--lp2-accent);
}

.lp2-basemap-card.is-active .lp2-basemap-card__check {
  opacity: 1;
  transform: scale(1);
}

.lp2-toggle-list {
  overflow: hidden;
  background: rgba(0, 0, 0, 0.085);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 13px;
}

.lp2-toggle-row {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  color: var(--lp2-text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  cursor: pointer;
  transition: background 140ms ease;
}

.lp2-toggle-row:last-child {
  border-bottom: 0;
}

.lp2-section--data .lp2-toggle-row[data-secondary="true"] {
  display: none;
}

.lp2-section--data.show-all .lp2-toggle-row[data-secondary="true"] {
  display: grid;
}

.lp2-row-icon,
.lp2-row-icon svg {
  width: 23px;
  height: 23px;
}

.lp2-row-icon {
  color: rgba(255, 255, 255, 0.76);
  transition: color 140ms ease;
}

.lp2-toggle-row__label {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp2-switch {
  box-sizing: border-box;
  width: 38px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  transition: background 160ms ease, border-color 160ms ease;
}

.lp2-switch > span {
  width: 16px;
  height: 16px;
  display: block;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.34);
  transform: translateX(0);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background 160ms ease;
}

.lp2-toggle-row.is-active .lp2-row-icon,
.lp2-toggle-row.is-active .lp2-toggle-row__label {
  color: var(--lp2-accent);
}

.lp2-toggle-row.is-active .lp2-switch {
  background: var(--lp2-accent);
  border-color: var(--lp2-accent);
}

.lp2-toggle-row.is-active .lp2-switch > span {
  background: #fff;
  transform: translateX(16px);
}

.lp2-analysis-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.085);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 13px;
}

.lp2-analysis {
  min-width: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.lp2-analysis:last-child,
.lp2-analysis--advanced {
  border-bottom: 0;
}

.lp2-analysis__summary {
  box-sizing: border-box;
  width: 100%;
  min-height: 55px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(90px, auto) 18px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--lp2-text);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 140ms ease;
}

.lp2-analysis__icon,
.lp2-analysis__icon svg {
  width: 22px;
  height: 22px;
}

.lp2-analysis__icon {
  color: rgba(255, 255, 255, 0.76);
  transition: color 140ms ease;
}

.lp2-analysis__label {
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13.5px;
  font-weight: 610;
  line-height: 1.2;
}

.lp2-analysis__status {
  min-width: 0;
  overflow: hidden;
  color: var(--lp2-muted);
  font-size: 12px;
  font-weight: 540;
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp2-analysis.has-active-layer .lp2-analysis__icon,
.lp2-analysis.has-active-layer .lp2-analysis__status {
  color: var(--lp2-accent);
}

.lp2-analysis__chevron,
.lp2-analysis__chevron svg {
  width: 16px;
  height: 16px;
}

.lp2-analysis__chevron {
  color: rgba(255, 255, 255, 0.6);
  transition: transform 180ms ease;
}

.lp2-analysis.is-expanded .lp2-analysis__chevron {
  transform: rotate(90deg);
}

.lp2-analysis__choices {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding: 0 10px 10px;
}

.lp2-analysis.is-expanded .lp2-analysis__choices {
  display: grid;
}

.lp2-analysis-controls {
  display: none;
  padding: 0 10px 10px;
}

.lp2-analysis.is-expanded .lp2-analysis-controls:not(:empty) {
  display: block;
}

.lp2-analysis-controls .analytical-legend {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  align-items: stretch;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

.lp2-analysis-controls .analysis-settings,
.lp2-analysis-controls .sun-controls {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 12px;
  box-shadow: none;
}

.lp2-analysis-controls .shadow-legend__content {
  min-width: 0;
}

.lp2-choice {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(21px, auto);
  align-items: start;
  gap: 3px;
  padding: 3px 3px 4px;
  color: var(--lp2-text);
  text-align: center;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.lp2-choice__image,
.lp2-choice__icon {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border-radius: 8px;
}

.lp2-choice__image {
  background: rgba(255, 255, 255, 0.035);
  filter: saturate(0.88) contrast(0.98);
}

/* The sun artwork is square while its card viewport is landscape-shaped. */
.lp2-analysis[data-analysis-group="sun"] .lp2-choice__image {
  object-position: 50% 32%;
}

.lp2-analysis[data-analysis-group="heatmap"] .lp2-choice__image {
  object-fit: contain;
  padding: 5px;
  filter: brightness(0) invert(1) opacity(0.8);
}

.lp2-choice__icon {
  padding: 13px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.05);
}

.lp2-choice__icon svg {
  width: 100%;
  height: 100%;
}

.lp2-choice__label {
  min-width: 0;
  align-self: center;
  justify-self: stretch;
  display: -webkit-box;
  overflow: hidden;
  padding: 0 2px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 9.5px;
  font-weight: 620;
  line-height: 1.15;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lp2-choice__indicator {
  position: absolute;
  z-index: 1;
  top: auto;
  right: 6px;
  bottom: 27px;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10241a;
  font-size: 10px;
  font-weight: 900;
  background: var(--lp2-accent);
  border: 2px solid rgba(15, 28, 36, 0.96);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 140ms ease, transform 140ms ease;
}

.lp2-choice.is-active {
  background: var(--lp2-accent-soft);
  border-color: rgba(var(--lp2-accent-rgb), 0.9);
  box-shadow: 0 0 0 1px rgba(var(--lp2-accent-rgb), 0.28);
}

.lp2-choice.is-active .lp2-choice__image {
  filter: none;
}

.lp2-analysis[data-analysis-group="heatmap"] .lp2-choice.is-active .lp2-choice__image {
  filter: brightness(0) saturate(100%) invert(56%) sepia(10%) saturate(896%) hue-rotate(64deg) brightness(91%) contrast(85%);
}

.lp2-choice.is-active .lp2-choice__label {
  color: var(--lp2-accent);
}

.lp2-choice.is-active .lp2-choice__indicator {
  opacity: 1;
  transform: scale(1);
}

.lp2-section--advanced {
  margin-top: -5px;
}

.lp2-analysis--advanced {
  overflow: hidden;
  background: rgba(0, 0, 0, 0.085);
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 13px;
}

.lp2-analysis--advanced .lp2-analysis__summary {
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, auto) 18px;
}

.lp2-advanced-content {
  display: none;
  gap: 9px;
  padding: 1px 12px 13px 49px;
}

.lp2-analysis--advanced.is-expanded .lp2-advanced-content {
  display: grid;
}

.lp2-advanced-content__label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11.5px;
  font-weight: 620;
}

.lp2-advanced-content__label--secondary {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.lp2-mode-switch {
  width: min(220px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
}

.lp2-mode-switch button {
  min-height: 32px;
  padding: 0 9px;
  color: var(--lp2-muted);
  font-size: 11.5px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.lp2-mode-switch button.is-active {
  color: #10241a;
  background: var(--lp2-accent);
}

.lp2-advanced-content p {
  max-width: 290px;
  margin: 0;
  color: rgba(218, 228, 232, 0.52);
  font-size: 10.5px;
  line-height: 1.4;
}

.lp2-basemap-card:disabled,
.lp2-toggle-row:disabled,
.lp2-choice:disabled,
.is-unavailable {
  opacity: 0.42;
  cursor: not-allowed;
}

.lp2-reset:focus-visible,
.lp2-close:focus-visible,
.lp2-see-all:focus-visible,
.lp2-basemap-card:focus-visible,
.lp2-toggle-row:focus-visible,
.lp2-analysis__summary:focus-visible,
.lp2-choice:focus-visible,
.lp2-mode-switch button:focus-visible,
.layer-panel-v1__modernize:focus-visible {
  outline: 2px solid var(--lp2-accent, #728c6c);
  outline-offset: 2px;
}

@media (hover: hover) {
  .lp2-reset:hover,
  .lp2-see-all:hover {
    background: rgba(var(--lp2-accent-rgb), 0.12);
  }

  .lp2-close:hover,
  .lp2-toggle-row:hover,
  .lp2-analysis__summary:hover {
    background: var(--lp2-surface-hover);
  }

  .lp2-basemap-card:not(.is-active):hover,
  .lp2-choice:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
  }
}

body.layer-panel-ui-legacy .layer-panel-v1__modernize {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(114, 140, 108, 0.12);
  border: 1px solid rgba(114, 140, 108, 0.4);
  border-radius: 8px;
  cursor: pointer;
}

body.layer-panel-ui-legacy .layer-panel-v1__modernize .lp2-icon,
body.layer-panel-ui-legacy .layer-panel-v1__modernize .lp2-icon svg {
  width: 18px;
  height: 18px;
}

@media (min-width: 768px) {
  body.layer-panel-ui-v2.layer-side-panel-open .imagery-panel,
  body.layer-panel-ui-v2.layer-side-panel-open .maplibregl-ctrl-top-right {
    transform: translateX(calc(-1 * (min(408px, calc(100vw - 24px)) + 28px))) !important;
  }

  body.layer-panel-ui-v2.layer-side-panel-open .analytical-legend-container {
    right: calc(min(408px, calc(100vw - 24px)) + 36px + env(safe-area-inset-right, 0px)) !important;
  }
}

@media (max-width: 767px) and (min-height: 520px) {
  body.layer-panel-ui-v2 .layer-panel-v2 {
    --lp2-mobile-edge: max(8px, var(--safe-area-right, env(safe-area-inset-right, 0px)));
    top: auto;
    right: var(--lp2-mobile-edge);
    bottom: max(8px, var(--safe-area-bottom, env(safe-area-inset-bottom, 0px)));
    left: max(8px, var(--safe-area-left, env(safe-area-inset-left, 0px)));
    width: auto;
    height: min(78dvh, 680px);
    max-height: calc(100dvh - var(--app-header-height, 58px) - 16px);
    border-radius: 22px 22px 18px 18px;
    transform: translateY(34px) scale(0.99);
    transform-origin: bottom center;
  }

  body.layer-panel-ui-v2 .layer-panel-v2.is-open {
    transform: translateY(0) scale(1);
  }

  body.layer-panel-ui-v2 .layer-panel-v2-backdrop {
    background: rgba(2, 8, 12, 0.28);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
  }

  .lp2-header {
    position: relative;
    min-height: 72px;
    padding-top: 20px;
  }

  .lp2-header::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    background: rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    transform: translateX(-50%);
  }
}

@media (max-width: 430px) {
  .lp2-header {
    grid-template-columns: minmax(0, auto) auto 1fr auto;
    gap: 7px;
    padding-right: 10px;
    padding-left: 14px;
  }

  .lp2-title {
    font-size: 18px;
  }

  .lp2-active-count {
    min-height: 22px;
    padding: 0 6px;
    font-size: 10px;
  }

  .lp2-reset {
    font-size: 11px;
  }

  .lp2-close {
    width: 36px;
    height: 36px;
  }

  .lp2-body {
    gap: 15px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .lp2-basemap-grid {
    gap: 6px;
  }

  .lp2-basemap-card {
    min-height: 94px;
    grid-template-rows: 66px minmax(20px, auto);
  }

  .lp2-basemap-card__image,
  .lp2-basemap-card__fallback {
    height: 66px;
  }

  .lp2-basemap-card__check {
    top: 51px;
  }

  .lp2-analysis__summary {
    grid-template-columns: 25px minmax(0, 1fr) minmax(72px, auto) 16px;
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .lp2-analysis__status {
    max-width: 110px;
    font-size: 11px;
  }

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

  .lp2-choice {
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) minmax(21px, auto);
  }
}

@media (prefers-reduced-motion: reduce) {
  .layer-panel-v2,
  .layer-panel-v2-backdrop,
  .lp2-basemap-card,
  .lp2-switch,
  .lp2-switch > span,
  .lp2-analysis__chevron,
  .lp2-choice,
  .lp2-choice__indicator {
    transition-duration: 0.01ms !important;
  }
}
