@media (max-height: 930px) {
  .app-shell {
    padding-top: 36px;
    padding-bottom: 36px;
  }

  .page-header {
    margin-bottom: 42px;
  }

  .map-stage,
  .map-root {
    min-height: min(560px, calc(100vh - 220px));
  }

  .map-root svg {
    max-height: calc(100vh - 190px);
  }
}

@media (max-height: 780px) {
  .app-shell {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .page-header {
    margin-bottom: 24px;
  }

  .map-stage,
  .map-root {
    min-height: 500px;
  }

  .map-root svg {
    max-height: none;
  }
}

@media (max-width: 1400px) {
  .app-shell {
    padding-right: clamp(24px, 3vw, 48px);
    padding-left: clamp(24px, 3vw, 48px);
  }

  .page-header {
    gap: 32px;
  }

  .workspace {
    gap: 28px;
  }

  .map-root svg {
    width: min(100%, 860px);
  }
}

@media (max-width: 1180px) {
  .page-header {
    margin-bottom: 36px;
  }

  .workspace {
    grid-template-columns: 280px minmax(420px, 1fr);
  }

  .workspace > .summary-panel {
    position: static;
    grid-column: 1 / -1;
    grid-row: 2;
    width: auto;
    max-width: 70%;
    margin: 0 auto;
  }

  .summary-action-wrap {
    flex: 0 0 100%;
    width: 100%;
  }

  .summary-help-action-wrap {
    flex: 0 0 calc(100% - 30px);
    width: calc(100% - 30px);
  }

  .map-stage,
  .map-root {
    min-height: min(500px, calc(100vh - 190px));
  }

  .summary-body {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
  }

  .summary-body p {
    margin: 4px 0;
  }

  .summary-body .summary-definition {
    flex: 0 0 calc(100% - 30px);
  }

  .summary-help-action-wrap {
    flex: 0 0 calc(100% - 30px);
    width: calc(100% - 30px);
  }
}

body.is-embed-mode:not(.is-embed-fullscreen) .app-shell {
  padding: 18px;
}

body.is-embed-mode:not(.is-embed-fullscreen) .page-header {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

body.is-embed-mode:not(.is-embed-fullscreen) .header-rule {
  display: none;
}

body.is-embed-mode:not(.is-embed-fullscreen) .page-header h1 {
  font-size: 1.35rem;
}

body.is-embed-mode:not(.is-embed-fullscreen) .workspace {
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 18px;
}

body.is-embed-mode:not(.is-embed-fullscreen) .workspace > .summary-panel {
  position: static;
  grid-column: 1 / -1;
  grid-row: 2;
  width: auto;
  max-width: none;
}

body.is-embed-mode:not(.is-embed-fullscreen) .map-stage,
body.is-embed-mode:not(.is-embed-fullscreen) .map-root {
  min-height: 420px;
}

body.is-embed-mode:not(.is-embed-fullscreen) .map-root svg {
  width: 100%;
}

body.is-embed-mode:not(.is-embed-fullscreen) .filter-section {
  padding: 10px;
}

body.is-embed-mode:not(.is-embed-fullscreen) .filter-option {
  margin: 6px 0;
  font-size: 0.86rem;
}

body.is-embed-mode:not(.is-embed-fullscreen) .summary-body {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

body.is-embed-mode:not(.is-embed-fullscreen) .summary-body p {
  margin: 4px 0;
}

body.is-embed-mode.is-embed-fullscreen .app-shell {
  padding: 24px;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 32px 18px;
  }

  .page-header {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 32px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .filters-panel.is-collapsed .filters-content {
    display: none;
  }

  .filters-title {
    padding: 8px;
    background: #ffffff;
  }

  .filters-title-label {
    display: none;
  }

  .filters-toggle {
    display: grid;
    width: 100%;
    min-height: 54px;
    padding: 9px 14px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(14, 125, 196, 0.42);
    border-radius: 6px;
    color: var(--color-primary);
    background: #f6fbfe;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(20, 138, 198, 0.08);
    transition:
      border-color 300ms ease,
      background-color 300ms ease,
      box-shadow 300ms ease;
  }

  .filters-toggle svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
  }

  .filters-toggle svg:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .filters-toggle [data-filters-toggle-label] {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    text-align: left;
  }

  .filters-toggle [data-filters-toggle-icon] {
    grid-column: 3;
    grid-row: 1;
  }

  .filters-active-summary {
    grid-column: 2 / 4;
    grid-row: 2;
    overflow: hidden;
    color: #5f7180;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.2;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .filters-toggle:hover,
  .filters-toggle:focus-visible {
    border-color: rgba(14, 125, 196, 0.7);
    background: #eef8fd;
    box-shadow: 0 6px 16px rgba(20, 138, 198, 0.12);
    outline: none;
  }

  .map-stage,
  .map-root {
    min-height: 420px;
  }

  .workspace > .summary-panel {
    position: static;
    grid-column: auto;
    grid-row: auto;
    width: auto;
    max-width: none;
    margin-bottom: 16px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 24px 14px;
  }

  .page-header h1 {
    font-size: 1.35rem;
  }

  .map-stage,
  .map-root {
    min-height: 340px;
  }

  .summary-body {
    display: block;
  }

  .details-content {
    padding: 22px 25px 28px;
  }

  .app-footer {
    justify-content: center;
  }
}
