:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #e4572e;
  --off: #9a9a9a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", sans-serif;
}

body { display: flex; flex-direction: column; }

header {
  padding: 14px 16px 0;
  border-bottom: 1px solid #eee;
}
header h1 { margin: 0; font-size: 21px; letter-spacing: -0.3px; }
header p { margin: 2px 0 10px; font-size: 13px; color: var(--muted); }

/* 탭 */
.tabs { display: flex; gap: 4px; }
.tab {
  flex: 1;
  padding: 10px 0 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { font-size: 12px; font-weight: 500; color: var(--muted); }

/* 화면 전환 */
.views { flex: 1; min-height: 0; position: relative; }
.view { display: none; height: 100%; }
.view.is-active { display: block; }
#view-map.is-active { display: flex; flex-direction: column; }
#map { flex: 1; min-height: 0; }
#view-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 범례 (지도 위에 띄움) */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-float {
  position: absolute; top: 10px; left: 10px; z-index: 500;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--accent); }
.dot-off { background: var(--off); }

/* 목록 */
.gym-list { list-style: none; margin: 0; padding: 0; }
.gym-list li + li { border-top: 1px solid #f0f0f0; }
.gym-item {
  display: block; width: 100%;
  padding: 14px 16px;
  border: 0; background: none; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
}
.gym-item:active, .gym-item:hover { background: #fafafa; }
.li-top { display: flex; align-items: baseline; gap: 8px; }
.li-area {
  flex: none; font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 2px 6px; border-radius: 4px; background: #f2f2f2;
}
.li-name { font-size: 16px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.li-price { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--accent); }
.li-pending { color: var(--off); font-weight: 500; font-size: 14px; }
.li-hours { margin-top: 3px; font-size: 12px; color: var(--text); }
.li-addr { margin-top: 2px; font-size: 12px; color: var(--muted); }

/* 핀 */
.pin {
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.pin-on { background: var(--accent); }
.pin-off { background: var(--off); }

/* 정보창 */
.pp-area { font-size: 12px; color: var(--muted); }
.pp-name { font-size: 16px; font-weight: 700; margin: 2px 0 6px; }
.pp-price { font-size: 15px; font-weight: 600; color: var(--accent); }
.pp-pending { color: var(--off); }
.pp-hours { margin-top: 6px; font-size: 12px; color: var(--text); }
.pp-addr { margin-top: 6px; font-size: 13px; }
.leaflet-container a.pp-phone { display: inline-block; margin-top: 4px; font-size: 13px; color: var(--accent); }
.pp-muted { color: var(--muted); }
.pp-meta { margin-top: 6px; font-size: 11px; color: var(--muted); }
.leaflet-popup-content { margin: 12px 14px; line-height: 1.4; }

/* 가격 알려주기 버튼 */
.report-btn {
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.report-btn:active { background: #fdeee9; }
.gym-list li { position: relative; }
.gym-item { padding-right: 112px; }
.report-btn-list {
  position: absolute; top: 12px; right: 12px;
  margin: 0; padding: 5px 10px; font-size: 12px;
}

/* 제보 창 */
.report {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0; border: 0; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.report::backdrop { background: rgba(0,0,0,.4); }
.report-form { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 12px; }
.report-head { display: flex; justify-content: space-between; align-items: center; }
.report-head h2 { margin: 0; font-size: 18px; }
.report-x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.report-gym { margin: -4px 0 0; font-weight: 700; font-size: 15px; }
.report-current { margin: -8px 0 0; font-size: 13px; color: var(--muted); }
.report-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.report-form input, .report-form select, .report-form textarea {
  font: inherit; font-size: 16px; font-weight: 400; /* 16px: iOS 확대 방지 */
  padding: 9px 10px; border: 1px solid #ddd; border-radius: 8px; background: #fff; color: var(--text);
  width: 100%;
}
.report-form textarea { resize: vertical; }
.req { color: var(--accent); }
.opt { color: var(--muted); font-weight: 400; }
.report-submit {
  margin-top: 4px; padding: 12px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.report-submit:disabled { opacity: .5; cursor: default; }
.report-status { margin: 0; min-height: 1em; font-size: 13px; }
.report-status.is-ok { color: #1a7f37; }
.report-status.is-error { color: #c62828; }
.report-note { margin: 0; font-size: 11px; color: var(--muted); }

/* 협업 문의 */
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-link {
  flex: none; font-size: 12px; font-weight: 600; color: var(--muted);
  text-decoration: none; padding: 5px 10px; border: 1px solid #ddd; border-radius: 999px;
}
.contact-link:hover { color: var(--accent); border-color: var(--accent); }
.list-footer {
  padding: 22px 16px 32px; border-top: 1px solid #eee; background: #fafafa;
  font-size: 13px; color: var(--muted); text-align: center;
}
.list-footer p { margin: 0 0 6px; }
.footer-title { font-weight: 700; color: var(--text); font-size: 14px; }
.footer-mail { font-weight: 600; color: var(--accent); text-decoration: none; }

/* 헤더 링크 */
.top-links { display: flex; gap: 6px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 지도 위 검색창 (오른쪽 위) */
#view-map { position: relative; }
.search {
  position: absolute; top: 10px; right: 10px; z-index: 600;
  width: min(260px, calc(100% - 20px));
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid #ddd; border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center / 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.18);
  font: inherit; font-size: 16px; /* 16px: iOS 확대 방지 */
  color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results {
  list-style: none; margin: 6px 0 0; padding: 4px 0;
  background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.2);
  max-height: 55vh; overflow-y: auto;
}
.search-results button {
  display: block; width: 100%; padding: 9px 14px;
  border: 0; background: none; text-align: left; font: inherit; cursor: pointer; color: var(--text);
}
.search-results button:hover, .search-results button:focus { background: #fdf1ed; outline: none; }
.sr-name { display: block; font-size: 14px; font-weight: 700; }
.sr-meta { display: block; font-size: 12px; color: var(--muted); }
.sr-meta b { color: var(--accent); font-weight: 600; }
.sr-meta b.sr-pending { color: var(--off); font-weight: 500; }
.sr-empty { padding: 10px 14px; font-size: 13px; color: var(--muted); }

/* 범례는 왼쪽 위, 좁은 화면에선 검색창 아래로 */
@media (max-width: 520px) {
  .legend-float { top: 58px; }
}

/* 지도 아래 사이트 정보 링크 */
.map-info {
  position: absolute; left: 8px; bottom: 6px; z-index: 500;
  font-size: 11px; color: var(--muted);
  background: rgba(255,255,255,.85); padding: 2px 8px; border-radius: 6px;
}
.map-info a { color: var(--muted); text-decoration: none; }
.map-info a:hover { color: var(--accent); }

/* 목록 정렬 */
.list-tools {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid #eee;
}
.list-tools-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.sort { display: flex; gap: 6px; flex-wrap: wrap; }
.sort-btn {
  padding: 6px 12px; border: 1px solid #ddd; border-radius: 999px; background: #fff;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.sort-btn.is-active { background: var(--text); border-color: var(--text); color: #fff; }

/* 목록 하단 */
.list-disclaimer { font-size: 12px; margin-bottom: 14px !important; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 16px 0 6px; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: 12px; }
.footer-nav a:hover { color: var(--accent); }
.copyright { font-size: 11px; }
.footer-mail-addr { font-weight: 700; color: var(--text) !important; user-select: all; }
