:root {
  --navy: #003460;
  --teal: #00a1a8;
  --green: #83b027;
  --yellow: #f8c000;
  --red: #e5304a;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1c2b2e;
  --muted: #6b7a7d;
  --border: #e3e8e6;
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--navy), var(--teal));
  color: #fff;
}

.topbar-title strong { font-size: 1.05rem; margin-right: 6px; }
.topbar-title span { font-size: 0.8rem; opacity: 0.85; }

.floor-toggle { display: flex; background: rgba(255,255,255,0.18); border-radius: 999px; padding: 3px; }
.floor-btn {
  border: none; background: transparent; color: #fff; font-weight: 700;
  padding: 6px 16px; border-radius: 999px; cursor: pointer; font-size: 0.9rem;
}
.floor-btn.active { background: #fff; color: var(--navy); }

.gate-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--red); color: #fff; padding: 10px 16px; font-weight: 600; font-size: 0.9rem;
}
.gate-banner button { background: none; border: none; color: #fff; font-size: 1rem; cursor: pointer; }

.map-wrap {
  position: relative;
  aspect-ratio: 4523.03 / 2968.1;
  min-height: 220px;
  overflow: hidden;
  background: #eef2f1;
  touch-action: none;
  border-bottom: 1px solid var(--border);
  /* 지도를 드래그/핀치할 때 안의 텍스트가 파란 배경으로 선택되는 것만 막는다.
     자식 요소 하나하나에 강제로 걸면(특히 SVG <text>) 일부 모바일 브라우저에서
     그 위의 클릭 자체가 씹히는 문제가 있어, 상속되도록 컨테이너에만 적용한다. */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.map-stage {
  width: 100%;
  height: 100%;
}

.svg-host { width: 100%; line-height: 0; }
.svg-host svg { width: 100%; height: auto; display: block; }

.map-controls {
  position: absolute; right: 10px; bottom: 46px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px;
}
.map-controls button {
  width: 38px; height: 38px; border-radius: 10px; border: none;
  background: rgba(0,52,96,0.85); color: #fff; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.map-hint {
  position: absolute; left: 10px; bottom: 10px; z-index: 5;
  background: rgba(0,0,0,0.45); color: #fff; font-size: 0.7rem;
  padding: 4px 8px; border-radius: 999px;
}

.search-bar { padding: 12px 16px 6px; background: var(--bg); }
.search-bar input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  font-size: 0.95rem; background: #fff;
}
.search-bar input:focus { outline: 2px solid var(--teal); }

.store-list {
  padding: 4px 16px 8px;
  display: grid;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
}

.zone-header {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 0.85rem; color: var(--navy);
  padding: 10px 2px 2px;
}
.zone-header::before {
  content: ''; display: inline-block; width: 12px; height: 12px;
  border-radius: 4px; background: var(--zone-color, var(--muted)); flex-shrink: 0;
}
.zone-header:first-child { padding-top: 2px; }

.store-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--zone-color, var(--border));
  border-radius: 12px; padding: 10px 14px; cursor: pointer; text-align: left;
}
.store-item:active { background: #eef7f7; }
.store-item.active { border-color: var(--teal); background: #eaf7f8; }
.store-item .name { font-weight: 700; font-size: 0.95rem; }
.store-item .meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.store-item .floor-tag {
  font-size: 0.7rem; font-weight: 700; color: #fff; background: var(--navy);
  padding: 2px 8px; border-radius: 999px; margin-left: 8px; flex-shrink: 0;
}
.store-empty { text-align: center; color: var(--muted); padding: 24px 0; font-size: 0.9rem; }

.info-card {
  margin: 8px 16px 0;
  background: var(--card);
  border-radius: 16px;
  border-top: 5px solid var(--zone-color, var(--teal));
  box-shadow: 0 6px 20px rgba(0,52,96,0.12);
  padding: 18px 18px 20px;
  position: relative;
  scroll-margin-top: 16px;
}
.info-close {
  position: absolute; right: 12px; top: 12px; border: none; background: var(--bg);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--muted);
}
.info-eyebrow { color: var(--teal); font-weight: 700; font-size: 0.78rem; margin: 0 0 4px; }
.info-card h2 { margin: 0 0 12px; font-size: 1.3rem; color: var(--navy); padding-right: 30px; }
.info-grid { display: grid; grid-template-columns: 72px 1fr; row-gap: 8px; column-gap: 10px; margin: 0; }
.info-grid dt { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.info-grid dd { margin: 0; font-size: 0.95rem; font-weight: 600; }
.info-grid dd a { color: var(--navy); text-decoration: none; }

.site-footer {
  text-align: center; color: var(--muted); font-size: 0.75rem; padding: 20px 12px 6px;
}

.popup-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 20, 25, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.popup-modal {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 320px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  padding: 18px 16px 14px;
}
.popup-close {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.45); color: #fff; cursor: pointer; font-size: 0.85rem;
}
.popup-image { width: 100%; border-radius: 10px; display: block; margin-bottom: 10px; }
.popup-text {
  font-size: 0.95rem; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; word-break: break-word; padding-right: 20px;
}
.popup-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.popup-link-btn {
  display: block; text-align: center; background: var(--teal); color: #fff;
  text-decoration: none; padding: 10px; border-radius: 10px; font-weight: 700; font-size: 0.9rem;
}
.popup-hide-today {
  background: none; border: none; color: var(--muted); font-size: 0.78rem;
  text-decoration: underline; cursor: pointer; padding: 4px;
}

/* injected marker styles (also mirrored inside svg via injected <style>) */
.wf-hit { fill: transparent; stroke: none; cursor: pointer; }
.wf-pulse { animation: wf-pulse 1.6s ease-out infinite; }
@keyframes wf-pulse {
  0% { r: 34; opacity: 0.55; }
  100% { r: 90; opacity: 0; }
}

@media (min-width: 720px) {
  .store-list { grid-template-columns: 1fr 1fr; }
  body { max-width: 720px; margin: 0 auto; box-shadow: 0 0 24px rgba(0,0,0,0.06); }
}
