:root {
  --hmx-top-h: 52px;
  --hmx-rail-collapsed: 68px;
  --hmx-rail-expanded: 218px;
  --hmx-bottom-h: 66px;
  --hmx-safe-bottom: env(safe-area-inset-bottom, 0px);
  --hmx-ink: #182230;
  --hmx-muted: #667085;
  --hmx-line: rgba(217, 224, 232, .94);
  --hmx-surface: rgba(255, 255, 255, .94);
  --hmx-surface-strong: #fff;
  --hmx-accent: #2563eb;
  --hmx-accent-soft: #eef4ff;
  --hmx-shadow: 0 12px 36px rgba(16, 24, 40, .14);
  --hmx-shadow-soft: 0 5px 18px rgba(16, 24, 40, .10);
}

/* No intro: keep the original element for compatibility with the preserved app bundle, but never show it. */
.kmap-intro-screen { display: none !important; }
.kmap-blog-header { display: none !important; }

.hmx-topbar,
.hmx-rail,
.hmx-bottom-nav,
.hmx-sheet-backdrop,
.hmx-sheet { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif; }

.hmx-topbar {
  position: fixed;
  z-index: 1800;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hmx-top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--hmx-line);
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 5px rgba(16, 24, 40, .04);
}
.hmx-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--hmx-ink);
  text-decoration: none;
}
.hmx-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -.04em;
}
.hmx-brand-copy { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.hmx-brand-copy strong { font-size: 13px; white-space: nowrap; }
.hmx-brand-copy span { color: var(--hmx-muted); font-size: 11px; white-space: nowrap; }
.hmx-top-spacer { flex: 1; }
.hmx-top-action {
  height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--hmx-line);
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  color: var(--hmx-ink);
  font-size: 11px;
  font-weight: 750;
}
.hmx-top-action:hover { background: #f8fafc; }
.hmx-top-action svg,
.hmx-rail-link svg,
.hmx-rail-toggle svg,
.hmx-bottom-nav svg,
.hmx-map-card svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.hmx-rail {
  position: fixed;
  z-index: 1700;
  top: calc(var(--hmx-top-h) + 10px);
  left: 10px;
  bottom: 12px;
  width: var(--hmx-rail-collapsed);
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid var(--hmx-line);
  border-radius: 18px;
  background: var(--hmx-surface);
  box-shadow: var(--hmx-shadow-soft);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: width .18s ease;
  overflow: hidden;
}
.hmx-rail.is-expanded { width: var(--hmx-rail-expanded); }
.hmx-rail-scroll { display: grid; gap: 5px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.hmx-rail-scroll::-webkit-scrollbar { display: none; }
.hmx-rail-divider { height: 1px; margin: 5px 3px; background: #edf0f4; }
.hmx-rail-link,
.hmx-rail-toggle {
  min-height: 44px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #344054;
  text-decoration: none;
  text-align: left;
  white-space: nowrap;
}
.hmx-rail-link:hover,
.hmx-rail-toggle:hover { background: #f4f6f8; }
.hmx-rail-link.is-active { background: var(--hmx-accent-soft); color: var(--hmx-accent); }
.hmx-rail-link.is-disabled { opacity: .46; cursor: default; }
.hmx-rail-icon { width: 34px; height: 34px; display: grid; place-items: center; }
.hmx-rail-label { min-width: 0; overflow: hidden; opacity: 0; transform: translateX(-3px); transition: opacity .12s ease, transform .12s ease; }
.hmx-rail.is-expanded .hmx-rail-label { opacity: 1; transform: translateX(0); }
.hmx-rail-label strong { display: block; color: currentColor; font-size: 12px; }
.hmx-rail-label small { display: block; margin-top: 1px; color: #98a2b3; font-size: 9px; }
.hmx-rail-bottom { margin-top: auto; padding-top: 6px; }
.hmx-rail-toggle { cursor: pointer; }
.hmx-rail-toggle .hmx-collapse-icon { transition: transform .18s ease; }
.hmx-rail.is-expanded .hmx-collapse-icon { transform: rotate(180deg); }

.hmx-bottom-nav { display: none; }

.hmx-sheet-backdrop {
  position: fixed;
  z-index: 2300;
  inset: 0;
  background: rgba(15,23,42,.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.hmx-sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.hmx-sheet {
  position: fixed;
  z-index: 2310;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(410px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hmx-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15,23,42,.24);
  transform: translateX(calc(100% + 28px));
  transition: transform .22s ease;
  overflow: hidden;
}
.hmx-sheet.is-open { transform: translateX(0); }
.hmx-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 17px 13px; border-bottom: 1px solid #edf0f4; }
.hmx-sheet-head strong { font-size: 17px; color: var(--hmx-ink); }
.hmx-sheet-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #f2f4f7; color: #344054; font-size: 22px; }
.hmx-sheet-scroll { padding: 14px; overflow: auto; }
.hmx-section-title { margin: 3px 0 9px; color: #98a2b3; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.hmx-map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hmx-map-card { position: relative; min-height: 86px; padding: 12px; border: 1px solid #e5eaf0; border-radius: 14px; background: #fff; color: var(--hmx-ink); text-decoration: none; }
.hmx-map-card:hover { background: #f9fbfd; border-color: #becbe0; }
.hmx-map-card.is-active { border-color: #a8bff2; background: #f6f9ff; }
.hmx-map-card.is-disabled { opacity: .48; pointer-events: none; }
.hmx-map-card-icon { width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 9px; background: var(--hmx-accent-soft); color: var(--hmx-accent); }
.hmx-map-card strong { display: block; font-size: 12px; }
.hmx-map-card small { display: block; margin-top: 3px; color: var(--hmx-muted); font-size: 9px; line-height: 1.4; }
.hmx-badge { position: absolute; top: 9px; right: 9px; padding: 3px 6px; border-radius: 999px; background: #f2f4f7; color: #667085; font-size: 8px; font-weight: 800; }
.hmx-platform-list { display: grid; gap: 7px; }
.hmx-platform-link { min-height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border: 1px solid #e5eaf0; border-radius: 12px; color: var(--hmx-ink); text-decoration: none; font-size: 12px; font-weight: 750; }
.hmx-platform-link span { color: #98a2b3; }
.hmx-platform-link:hover { background: #f8fafc; }

/* Make room for the shared shell without changing the original converter logic. */
@media (min-width: 769px) {
  .kmap-pc-search-panel { top: calc(var(--hmx-top-h) + 12px) !important; }
  .kmap-distance-info { top: calc(var(--hmx-top-h) + 12px) !important; }
  .kmap-info-panel { left: calc(var(--hmx-rail-collapsed) + 22px) !important; transition: left .18s ease; }
  body.hmx-rail-expanded .kmap-info-panel { left: calc(var(--hmx-rail-expanded) + 22px) !important; }
  body.hmx-rail-expanded .kmap-pc-search-panel { left: calc(50% + 55px) !important; }
}

@media (max-width: 768px) {
  :root { --hmx-top-h: 48px; }
  .hmx-topbar { padding: 5px 9px; }
  .hmx-brand-mark { width: 34px; height: 34px; }
  .hmx-brand-copy strong { font-size: 12px; }
  .hmx-brand-copy span { display: none; }
  .hmx-top-action span { display: none; }
  .hmx-top-action { width: 36px; padding: 0; }
  .hmx-rail { display: none; }
  .hmx-bottom-nav {
    position: fixed;
    z-index: 1900;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--hmx-bottom-h) + var(--hmx-safe-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 4px 3px var(--hmx-safe-bottom);
    border-top: 1px solid var(--hmx-line);
    background: rgba(255,255,255,.96);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
  .hmx-bottom-nav a,
  .hmx-bottom-nav button {
    min-width: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: #667085;
    text-decoration: none;
    font-size: 9px;
    font-weight: 750;
  }
  .hmx-bottom-nav button.is-active { color: var(--hmx-accent); }
  .hmx-bottom-nav svg { width: 20px; height: 20px; }
  .kmap-search-trigger { top: calc(var(--hmx-top-h) + 8px) !important; }
  .kmap-distance-info { top: calc(var(--hmx-top-h) + 58px) !important; }
  .kmap-maptype-control { bottom: calc(var(--hmx-bottom-h) + 18px + var(--hmx-safe-bottom)) !important; }
  .kmap-mobile-close-float { bottom: calc(var(--hmx-bottom-h) + 18px + var(--hmx-safe-bottom)) !important; }
  .kmap-share-panel { padding-bottom: calc(var(--hmx-bottom-h) + 22px + var(--hmx-safe-bottom)) !important; }
  .kmap-side-tools { top: 51% !important; right: 12px !important; }
  .hmx-sheet {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(var(--hmx-bottom-h) + 8px + var(--hmx-safe-bottom));
    width: auto;
    max-height: min(72dvh, 620px);
    border-radius: 20px;
    transform: translateY(calc(100% + var(--hmx-bottom-h) + 30px));
  }
  .hmx-sheet.is-open { transform: translateY(0); }
  .hmx-sheet-backdrop { bottom: calc(var(--hmx-bottom-h) + var(--hmx-safe-bottom)); }
}
