.hd-hm-map-app {
  --hdhm-primary: #2563eb;
  --hdhm-map-height: 760px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  color: #111827;
}

.hd-hm-shell {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.hd-hm-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid #eef2f7;
}

.hd-hm-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--hdhm-primary);
}

.hd-hm-title {
  margin: 6px 0 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

.hd-hm-topbar-right {
  text-align: right;
  flex-shrink: 0;
}

.hd-hm-result-meta {
  display: block;
  color: #6b7280;
  font-size: 12px;
}

.hd-hm-result-count {
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.hd-hm-toolbar {
  padding: 16px 22px 20px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
}

.hd-hm-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(96px,0.7fr) minmax(110px,0.78fr) minmax(110px,0.78fr) minmax(0,1.35fr) minmax(88px,0.68fr) auto auto;
  gap: 10px;
}

.hd-hm-toolbar select,
.hd-hm-toolbar input,
.hd-hm-toolbar button {
  height: 44px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 0 14px;
  font-size: 14px;
  box-sizing: border-box;
}

.hd-hm-toolbar input:focus,
.hd-hm-toolbar select:focus {
  outline: none;
  border-color: var(--hdhm-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.hd-hm-search-btn,
.hd-hm-reset-btn,
.hd-hm-chip,
.hd-hm-card,
.hd-hm-page-btn {
  cursor: pointer;
}

.hd-hm-search-btn {
  background: var(--hdhm-primary) !important;
  color: #fff;
  border-color: var(--hdhm-primary) !important;
  font-weight: 700;
}

.hd-hm-reset-btn {
  font-weight: 700;
}

.hd-hm-tags-wrap {
  margin-top: 14px;
}

.hd-hm-tag-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 700;
}

.hd-hm-service-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hd-hm-chip,
.hd-hm-overlay-chip,
.hd-hm-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.hd-hm-chip {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  padding: 8px 12px;
}

.hd-hm-chip.is-active {
  background: var(--hdhm-primary);
  border-color: var(--hdhm-primary);
  color: #fff;
}

.hd-hm-overlay-chip {
  padding: 5px 10px;
  background: #eff6ff;
  color: var(--hdhm-primary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hd-hm-content {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  height: var(--hdhm-map-height);
  min-height: 520px;
}

.hd-hm-list-panel {
  order: 1;
  border-right: 1px solid #eef2f7;
  background: #fff;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hd-hm-map-panel {
  order: 2;
  position: relative;
  min-height: 0;
  height: 100%;
  background: #f3f4f6;
}

.hd-hm-map-canvas {
  position: absolute;
  inset: 0;
}

.hd-hm-list-head {
  padding: 16px 14px 10px;
  border-bottom: 1px solid #eef2f7;
}

.hd-hm-list-title {
  font-size: 16px;
  font-weight: 800;
}

.hd-hm-list {
  padding: 10px;
  overflow: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.hd-hm-card {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  margin-bottom: 8px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.hd-hm-card:hover,
.hd-hm-card.is-active {
  border-color: #bfdbfe;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.hd-hm-card-main {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}

.hd-hm-card-thumb {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hdhm-primary);
  font-size: 22px;
  font-weight: 800;
}

.hd-hm-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hd-hm-card-meta {
  min-width: 0;
}

.hd-hm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hd-hm-card-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hd-hm-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.hd-hm-badge-featured {
  background: #f3f4f6;
  color: #9ca3af;
  white-space: nowrap;
}

.hd-hm-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hd-hm-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.hd-hm-like-btn:hover {
  border-color: #fecaca;
  color: #ef4444;
}

.hd-hm-like-btn.is-liked {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff5f5;
}

.hd-hm-like-icon {
  font-size: 14px;
  line-height: 1;
}

.hd-hm-like-count {
  line-height: 1;
}

.hd-hm-like-btn--overlay {
  min-height: 30px;
}

.hd-hm-overlay-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.hd-hm-overlay-top .hd-hm-overlay-title {
  margin-bottom: 0;
}

.hd-hm-card-phone {
  margin-top: 6px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.5;
}

.hd-hm-card-doctor-service {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 5px;
  color: #374151;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-hm-card-service-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--hdhm-primary);
  font-weight: 800;
}

.hd-hm-card-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.hd-hm-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-top: 0;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.hd-hm-card-link:hover {
  border-color: #bfdbfe;
  color: var(--hdhm-primary);
}

.hd-hm-empty {
  padding: 24px 18px;
  text-align: center;
  color: #6b7280;
  border: 1px dashed #d1d5db;
  border-radius: 16px;
  background: #fff;
}

.hd-hm-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 10px 14px;
  border-top: 1px solid #eef2f7;
  background: #fff;
}

.hd-hm-page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
}

.hd-hm-page-btn:hover {
  border-color: #93c5fd;
  color: var(--hdhm-primary);
}

.hd-hm-page-btn.is-active {
  background: var(--hdhm-primary);
  border-color: var(--hdhm-primary);
  color: #fff;
}

.hd-hm-page-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.hd-hm-overlay {
  min-width: 230px;
  max-width: 260px;
  padding: 14px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.hd-hm-overlay-title {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 800;
  margin-bottom: 10px;
}

.hd-hm-overlay-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  font-size: 13px;
}

.hd-hm-overlay-label {
  color: #6b7280;
  font-weight: 700;
}

.hd-hm-overlay-value {
  color: #111827;
  word-break: break-word;
}

.hd-hm-overlay-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  border-radius: 12px;
  background: var(--hdhm-primary);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.hd-hm-notice {
  padding: 18px 20px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 14px;
}

@media (max-width: 1100px) {
  .hd-hm-toolbar-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

@media (max-width: 960px) {
  .hd-hm-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hd-hm-topbar-right {
    text-align: left;
  }

  .hd-hm-toolbar-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hd-hm-content {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .hd-hm-list-panel {
    order: 1;
    border-right: 0;
    border-bottom: 1px solid #eef2f7;
    display: block;
  }

  .hd-hm-list {
    flex: none;
    max-height: none;
    overflow: visible;
  }

  .hd-hm-map-panel {
    order: 2;
    min-height: 58vh;
    height: 58vh;
  }
}

@media (max-width: 640px) {
  .hd-hm-shell {
    border-radius: 18px;
  }

  .hd-hm-topbar,
  .hd-hm-toolbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hd-hm-title {
    font-size: 24px;
  }

  .hd-hm-toolbar-grid {
    grid-template-columns: 1fr;
  }

  .hd-hm-list {
    padding: 10px;
  }

  .hd-hm-card {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .hd-hm-card-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }

  .hd-hm-map-panel {
    min-height: 52vh;
  }
}

@media (max-width: 640px) {
  .hd-hm-list-panel {
    background: #f8fafc;
  }

  .hd-hm-card-main {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
  }

  .hd-hm-card-thumb {
    width: 52px;
    height: 52px;
  }

  .hd-hm-card-title {
    font-size: 14px;
    -webkit-line-clamp: 1;
  }

  .hd-hm-card-phone {
    margin-top: 4px;
    font-size: 12px;
  }

  .hd-hm-card-doctor-service {
    margin-top: 4px;
    font-size: 11.5px;
    gap: 4px;
  }

  .hd-hm-card-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
  }

  .hd-hm-card-link {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }
}

/* 현재 지도 영역 검색 버튼 */
.hd-hm-region-search-btn {
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 5;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  white-space: nowrap;
}
.hd-hm-region-search-btn.is-visible {
  display: inline-flex;
}

/* 모바일 바텀시트 UI */
.hd-hm-mobile-list-toggle,
.hd-hm-mobile-sheet-handle,
.hd-hm-mobile-sheet-close {
  display: none;
}

@media (max-width: 640px) {
  .hd-hm-map-app {
    position: relative;
  }

  .hd-hm-content {
    display: block;
    height: auto;
    min-height: 0;
  }

  .hd-hm-map-panel {
    order: 1;
    height: 62vh;
    min-height: 460px;
    border-top: 1px solid #eef2f7;
    overflow: hidden;
  }

  .hd-hm-list-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    max-height: 74vh;
    height: 74vh;
    border-right: 0;
    border-top: 1px solid #e5e7eb;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.18);
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateY(calc(100% + 18px));
    transition: transform 0.24s ease;
    will-change: transform;
    overflow: hidden;
  }

  .hd-hm-map-app.is-mobile-sheet-open .hd-hm-list-panel {
    transform: translateY(0);
  }

  .hd-hm-map-app.is-mobile-sheet-dragging .hd-hm-list-panel {
    transition: none;
  }

  .hd-hm-mobile-sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 24px;
    flex: 0 0 auto;
    cursor: grab;
    touch-action: none;
  }

  .hd-hm-mobile-sheet-handle span {
    display: block;
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: #d1d5db;
  }

  .hd-hm-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    flex: 0 0 auto;
  }

  .hd-hm-mobile-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }

  .hd-hm-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 10px 14px 18px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .hd-hm-pagination {
    flex: 0 0 auto;
    display: none;
  }

  .hd-hm-mobile-list-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 50%;
    /*
     * 하단 고정 메뉴가 추가되어도 겹치지 않도록 버튼 높이만큼 위로 올림.
     * 기존: bottom 18px 수준 → 변경: safe-area + 68px 수준
     */
    bottom: calc(env(safe-area-inset-bottom, 0px) + 68px);
    transform: translateX(-50%);
    z-index: 9998;
    min-width: 142px;
    height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--hdhm-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.32);
    cursor: pointer;
  }

  .hd-hm-map-app.is-mobile-sheet-open .hd-hm-mobile-list-toggle {
    display: none;
  }

  .hd-hm-map-app.is-mobile-selected-sheet .hd-hm-list-panel {
    height: auto;
    max-height: 46vh;
  }

  .hd-hm-map-app.is-mobile-selected-sheet .hd-hm-list {
    flex: 0 1 auto;
    max-height: 34vh;
  }

  .hd-hm-map-app.is-mobile-selected-sheet .hd-hm-list-title::after {
    content: '';
  }

  body.hd-hm-mobile-sheet-lock {
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  .hd-hm-region-search-btn {
    top: 74px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 13px;
    z-index: 6;
  }
}

/* 모바일: 자세히보기 버튼을 카드 우측 버튼으로 고정 */
@media (max-width: 640px) {
  .hd-hm-card {
    position: relative;
  }

  .hd-hm-card-main {
    position: relative;
    grid-template-columns: 52px minmax(0, 1fr);
    padding-right: 92px;
    min-height: 78px;
  }

  .hd-hm-card-meta {
    min-width: 0;
    padding-right: 0;
  }

  .hd-hm-card-head {
    padding-right: 0;
  }

  .hd-hm-card-phone,
  .hd-hm-card-doctor-service {
    max-width: 100%;
  }

  .hd-hm-card-foot {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }

  .hd-hm-card-link {
    width: 72px;
    min-height: 52px;
    padding: 0 8px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }

  .hd-hm-card-link:active {
    transform: scale(0.98);
  }

  .hd-hm-map-app.is-mobile-selected-sheet .hd-hm-card-main {
    min-height: 84px;
  }
}

/* 모바일: 자세히보기 버튼 2줄 표시 */
.hd-hm-card-link .hd-hm-card-link-line {
  display: inline;
}

@media (max-width: 640px) {
  .hd-hm-card-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    word-break: keep-all;
    overflow-wrap: normal;
  }

  .hd-hm-card-link .hd-hm-card-link-line {
    display: block;
    white-space: nowrap;
  }
}
