/* === 로또명당 — Toss-inspired Design v0.8 === */
:root {
  --bg:       #FFFFFF;
  --surface:  #F5F6F8;
  --surface2: #EBEEF3;
  --border:   #E5E8EB;
  --text:     #191F28;
  --text2:    #4E5968;
  --text3:    #8B95A1;
  --gold:     #FFB800;
  --gold-bg:  #FFF8E1;
  --silver:   #8E99A4;
  --silver-bg:#F0F2F5;
  --blue:     #3182F6;
  --blue-bg:  #EBF3FE;
  --blue-pin: #3182F6;
  --red:      #F04452;
  --green:    #00C471;
  --orange:   #FF6B35;
  --radius:   16px;
  --radius-sm:10px;
  --shadow:   0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:0 -4px 24px rgba(0,0,0,0.12);
  --font:     'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--bg);
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.header-top h1 {
  font-size: 20px; font-weight: 800; color: var(--text);
  flex: 1;
}

/* Hamburger button */
.menu-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text);
  padding: 4px 6px; -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

/* Version tag */
.version-tag {
  font-size: 11px; font-weight: 600; color: var(--text3);
  background: var(--surface); border-radius: 6px;
  padding: 2px 7px; flex-shrink: 0;
}

/* ── Search Bar ──────────────────────────────────────────────────────────── */
.search-wrapper { position: relative; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  transition: box-shadow 0.2s;
}
.search-box:focus-within {
  box-shadow: 0 0 0 2px var(--blue);
  background: var(--bg);
}

.search-icon { flex-shrink: 0; color: var(--text3); }

#searchInput {
  flex: 1;
  border: none; background: transparent;
  font-family: var(--font); font-size: 14px; color: var(--text);
  outline: none; min-width: 0;
}
#searchInput::placeholder { color: var(--text3); }

.search-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 16px; padding: 0 2px;
  line-height: 1; -webkit-tap-highlight-color: transparent;
}
.search-clear.hidden { display: none; }

/* Search Results Dropdown */
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 2000;
  background: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
.search-results.hidden { display: none; }

.search-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.search-item:last-child { border-bottom: none; }
.search-item:active, .search-item:hover { background: var(--surface); }

.search-item-text { min-width: 0; }
.search-item-name { font-size: 15px; font-weight: 600; color: var(--text); }
.search-item-addr {
  font-size: 12px; color: var(--text3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Area suggestion rows */
.search-sugg { background: var(--gold-bg); }
.search-sugg:hover { background: #fff3cd; }
.area-icon { font-size: 16px; flex-shrink: 0; line-height: 1.4; }

.search-section-label {
  padding: 8px 16px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text3);
  background: var(--bg);
}

.search-divider {
  height: 1px; background: var(--border); margin: 0;
}

.search-loading,
.search-empty {
  padding: 16px; text-align: center;
  font-size: 14px; color: var(--text3);
}

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
#filterBar {
  position: fixed; left: 0; right: 0; z-index: 999;
  background: var(--bg);
  padding: 8px 16px;
  display: flex; gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
#filterBar::-webkit-scrollbar { display: none; }

.filter-btn {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.filter-btn.active          { background: var(--text);   color: var(--bg);  border-color: var(--text); }
.filter-btn.gold.active     { background: var(--gold);   color: #000;       border-color: var(--gold); }
.filter-btn.silver.active   { background: var(--silver); color: #fff;       border-color: var(--silver); }

/* ── Map ─────────────────────────────────────────────────────────────────── */
#map {
  position: fixed;
  top: 150px;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* ── Custom Zoom Controls ────────────────────────────────────────────────── */
#zoomControls {
  position: fixed;
  left: 16px;
  top: 166px;
  z-index: 999;
  display: flex; flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
#zoomControls button {
  width: 40px; height: 40px;
  background: var(--bg);
  border: none; border-bottom: 1px solid var(--border);
  font-size: 22px; font-weight: 400; line-height: 1;
  cursor: pointer; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#zoomControls button:last-child { border-bottom: none; }
#zoomControls button:active { background: var(--surface); }

/* ── Locate Button ───────────────────────────────────────────────────────── */
#locateBtn {
  position: fixed;
  bottom: 230px; right: 16px;
  z-index: 999;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
#locateBtn:active { transform: scale(0.92); }
#locateBtn.locating { animation: spin 1s linear infinite; }

/* Re-center / nearest 명당 button */
#recenterBtn {
  position: fixed;
  bottom: 172px; right: 16px;
  z-index: 999;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
#recenterBtn:active { transform: scale(0.92); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Bottom Sheet ────────────────────────────────────────────────────────── */
#bottomSheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 998;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 75vh;
  display: flex; flex-direction: column;
}
#bottomSheet.collapsed { transform: translateY(calc(100% - 180px)); }
#bottomSheet.expanded  { transform: translateY(0); z-index: 1500; }

.sheet-drag-area {
  padding: 12px 16px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px; justify-content: center;
}
.handle-bar {
  width: 40px; height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  pointer-events: none;
}
.sheet-hint {
  font-size: 12px; color: var(--text3); font-weight: 500;
  pointer-events: none;
}

.sheet-header {
  padding: 0 20px 12px;
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sheet-header h2 { font-size: 19px; font-weight: 700; }
.store-count    { font-size: 14px; color: var(--text3); font-weight: 500; }

/* ── Sort Pills ──────────────────────────────────────────────────────────── */
.sort-pills {
  display: flex; gap: 6px;
  padding: 10px 20px 8px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.sort-pills::-webkit-scrollbar { display: none; }

.sort-pill {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.sort-pill.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ── Top50 toggle ────────────────────────────────────────────────────────── */
.top50-toggle {
  display: flex; gap: 8px; padding: 12px 20px 4px;
  border-bottom: 1px solid var(--border);
}
.top50-toggle-btn {
  flex: 1; padding: 8px 0;
  border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--bg); font-family: var(--font);
  font-size: 13px; font-weight: 600; color: var(--text2);
  cursor: pointer; transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.top50-toggle-btn.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.top50-footnote {
  padding: 12px 20px 16px;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Store List ──────────────────────────────────────────────────────────── */
.store-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px;
  flex: 1;
}

.empty-state {
  padding: 32px 0;
  text-align: center;
  color: var(--text3);
  font-size: 15px;
  line-height: 1.6;
}

.store-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.store-item:active { background: var(--surface); margin: 0 -20px; padding: 16px 20px; }
.store-item:last-child { border-bottom: none; }

.store-top      { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.store-name     { font-size: 17px; font-weight: 700; }
.store-distance { font-size: 14px; color: var(--blue); font-weight: 600; }
.store-address  { font-size: 14px; color: var(--text3); margin-bottom: 8px; }
.store-badges   { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
}
.badge.gold   { background: var(--gold-bg);   color: #B8860B; }
.badge.silver { background: var(--silver-bg); color: var(--silver); }
.badge.blue   { background: var(--blue-bg);   color: var(--blue); }

/* Hot badge in list */
.badge.hot-badge {
  background: #FFF0F0; color: var(--red);
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.75; }
}

/* Rank badge in list */
.badge.rank-list-badge {
  background: var(--gold-bg); color: #B8860B;
}

/* ── Store Detail Modal ──────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px;
  max-height: 80vh;
  padding: 24px;
  position: relative;
  overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); border: none;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
}

.detail-name    { font-size: 24px; font-weight: 800; margin-bottom: 4px; padding-right: 48px; }
.detail-address { font-size: 15px; color: var(--text3); margin-bottom: 12px; }

/* Hot badge in modal */
.hot-badge-modal {
  display: inline-block;
  background: #FFF0F0; color: var(--red);
  border: 1.5px solid #FFCDD2;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 15px; font-weight: 700;
  margin-bottom: 10px;
}

/* Rank badge row */
.rank-badges-row { display: flex; gap: 6px; flex-wrap: wrap; }
.badge.rank-badge-gold {
  background: var(--gold-bg); color: #9A6B00;
  font-size: 13px; font-weight: 700;
  padding: 5px 12px; border-radius: 8px;
}

/* ── Rank drill-down (전국 → 시/도 → 구/군) ─────────────────────────────── */
.rank-drill-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-bottom: 10px;
}
.rank-drill-chip {
  display: inline-flex; align-items: center;
  background: var(--gold-bg); color: #9A6B00;
  font-size: 13px; font-weight: 700;
  padding: 4px 10px; border-radius: 8px;
}
.rank-drill-sep {
  color: var(--text3); font-size: 12px; padding: 0 2px;
}

/* "지도에서 보기" link in modal */
.show-on-map-link {
  display: inline-block;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
  -webkit-tap-highlight-color: transparent;
}
.show-on-map-link:active { opacity: 0.6; }

.detail-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.stat-card           { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.stat-card.gold      { background: var(--gold-bg); }
.stat-card.silver    { background: var(--silver-bg); }
.stat-value          { font-size: 32px; font-weight: 800; }
.stat-card.gold .stat-value   { color: #B8860B; }
.stat-card.silver .stat-value { color: var(--silver); }
.stat-label { font-size: 14px; color: var(--text3); margin-top: 4px; font-weight: 500; }

.detail-prize {
  font-size: 13px; color: var(--text2); font-weight: 500;
  margin-bottom: 14px; padding: 8px 12px;
  background: var(--surface); border-radius: 8px;
}

/* Route info in modal */
.route-info {
  display: flex; align-items: center;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px; font-weight: 600;
  margin-bottom: 10px;
}
.route-info-warn {
  background: var(--surface);
  color: var(--text3);
  font-size: 13px; font-weight: 400;
}

/* Navigation buttons */
.navi-row {
  display: flex; gap: 8px;
  margin-bottom: 10px;
}
.navi-btn {
  flex: 1;
  padding: 12px 8px;
  border-radius: var(--radius-sm); border: none;
  font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.navi-btn:active { transform: scale(0.97); }
.kakao-navi {
  background: #FFEB3B; color: #3C1E1E;
}
.naver-navi {
  background: #03C75A; color: #fff;
}

.action-btn {
  flex: 1; padding: 14px;
  border-radius: var(--radius-sm); border: none;
  font-family: var(--font); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.action-btn:active    { transform: scale(0.97); }
.action-btn.primary   { background: var(--blue);    color: #fff; }
.action-btn.secondary { background: var(--surface); color: var(--text2); }

/* ── Map Markers ─────────────────────────────────────────────────────────── */
/* ── Marker wrapper (non-rotating container for badges) ─────────────────── */
.marker-wrapper {
  position: relative;
  width: 36px;
  height: 44px; /* extra height for crown above pin */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: visible;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.marker-icon {
  position: relative; overflow: visible;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.marker-icon span { transform: rotate(45deg); display: block; }

.marker-gold   { background: var(--gold); }
.marker-silver { background: #B0B8C1; }
.marker-blue   { background: var(--blue-pin); }

/* ── National rank number pins ───────────────────────────────────────────── */
.marker-rank { border-radius: 50% 50% 50% 0; }
.marker-rank span { font-size: 11px; font-weight: 900; transform: rotate(45deg); display: block; letter-spacing: -0.5px; }
.marker-rank-gold   { background: var(--gold); color: #5A3E00; }
.marker-rank-orange { background: var(--orange); color: #fff; }
.marker-rank-blue   { background: var(--blue); color: #fff; }
.marker-rank-gray   { background: #6B7684; color: #fff; }

/* ── Crown badge — sits on top of pin like a hat ────────────────────────── */
.badge-crown {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}
.crown-num {
  font-size: 10px; font-weight: 800;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
}

/* ── Rank badge (top 4–10) ───────────────────────────────────────────────── */
.badge-rank {
  position: absolute;
  top: -8px;
  right: -8px;
  transform: rotate(45deg);
  background: var(--orange);
  color: #fff;
  font-size: 9px; font-weight: 800;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
  pointer-events: none;
}

/* ── Badge bar — single horizontal row of emojis centered above pin ─────── */
.badge-bar {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}
.badge-bar span {
  font-size: 15px;
  line-height: 1;
}

/* ── Selected pin glow — color-matched heartbeat ─────────────────────────── */
.marker-icon.marker-selected { z-index: 50 !important; }

.marker-gold.marker-selected   { animation: glow-gold   1.5s ease-in-out infinite; }
.marker-silver.marker-selected { animation: glow-silver 1.5s ease-in-out infinite; }
.marker-blue.marker-selected   { animation: glow-blue   1.5s ease-in-out infinite; }

@keyframes glow-gold {
  0%   { box-shadow: 0 0 0 2px rgba(255,215,0,0.7), 0 0  6px 2px rgba(255,215,0,0.3); }
  15%  { box-shadow: 0 0 0 5px rgba(255,215,0,1.0), 0 0 20px 8px rgba(255,215,0,0.8); }
  30%  { box-shadow: 0 0 0 2px rgba(255,215,0,0.6), 0 0  7px 2px rgba(255,215,0,0.3); }
  45%  { box-shadow: 0 0 0 4px rgba(255,215,0,0.9), 0 0 14px 5px rgba(255,215,0,0.6); }
  65%  { box-shadow: 0 0 0 2px rgba(255,215,0,0.4), 0 0  4px 1px rgba(255,215,0,0.2); }
  100% { box-shadow: 0 0 0 2px rgba(255,215,0,0.7), 0 0  6px 2px rgba(255,215,0,0.3); }
}
@keyframes glow-silver {
  0%   { box-shadow: 0 0 0 2px rgba(176,184,193,0.7), 0 0  6px 2px rgba(176,184,193,0.3); }
  15%  { box-shadow: 0 0 0 5px rgba(176,184,193,1.0), 0 0 20px 8px rgba(176,184,193,0.8); }
  30%  { box-shadow: 0 0 0 2px rgba(176,184,193,0.6), 0 0  7px 2px rgba(176,184,193,0.3); }
  45%  { box-shadow: 0 0 0 4px rgba(176,184,193,0.9), 0 0 14px 5px rgba(176,184,193,0.6); }
  65%  { box-shadow: 0 0 0 2px rgba(176,184,193,0.4), 0 0  4px 1px rgba(176,184,193,0.2); }
  100% { box-shadow: 0 0 0 2px rgba(176,184,193,0.7), 0 0  6px 2px rgba(176,184,193,0.3); }
}
@keyframes glow-blue {
  0%   { box-shadow: 0 0 0 2px rgba(49,130,246,0.7), 0 0  6px 2px rgba(49,130,246,0.3); }
  15%  { box-shadow: 0 0 0 5px rgba(49,130,246,1.0), 0 0 20px 8px rgba(49,130,246,0.8); }
  30%  { box-shadow: 0 0 0 2px rgba(49,130,246,0.6), 0 0  7px 2px rgba(49,130,246,0.3); }
  45%  { box-shadow: 0 0 0 4px rgba(49,130,246,0.9), 0 0 14px 5px rgba(49,130,246,0.6); }
  65%  { box-shadow: 0 0 0 2px rgba(49,130,246,0.4), 0 0  4px 1px rgba(49,130,246,0.2); }
  100% { box-shadow: 0 0 0 2px rgba(49,130,246,0.7), 0 0  6px 2px rgba(49,130,246,0.3); }
}

/* ── Route label on map ──────────────────────────────────────────────────── */
.route-label {
  background: var(--blue);
  color: #fff;
  font-family: var(--font);
  font-size: 13px; font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(49,130,246,0.45);
  white-space: nowrap;
  pointer-events: none;
}

/* ── Win history rows in modal ───────────────────────────────────────────── */
.wins-title   { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text3); margin-bottom: 8px; }
.wins-loading { font-size: 12px; color: var(--text3); }
.win-row      { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.win-row:last-child { border-bottom: none; }
.win-tier     { font-weight: 500; }
.win-meta     { font-size: 12px; color: var(--text3); }
.win-more     { font-size: 12px; color: var(--text3); text-align: center; margin-top: 6px; }
.win-expand-btn {
  display: block;
  width: 100%;
  padding: 10px 0;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  margin-top: 6px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.win-expand-btn:active { background: var(--surface2); }

/* ── User location marker ────────────────────────────────────────────────── */
.marker-user {
  background: #FF3B30;
  width: 42px; height: 42px;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(255,59,48,0.45);
  animation: user-pulse 2.2s ease-in-out infinite;
}
.user-dot-inner {
  display: block;
  width: 10px; height: 10px;
  background: #fff;
  border-radius: 50%;
  transform: rotate(45deg);
}
@keyframes user-pulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(255,59,48,0.4), 0 0  6px 2px rgba(255,59,48,0.25); }
  50%       { box-shadow: 0 3px 14px rgba(255,59,48,0.6), 0 0 18px 7px rgba(255,59,48,0.45); }
}

/* ── Hamburger menu ──────────────────────────────────────────────────────── */
#hamburgerMenu { position: fixed; inset: 0; z-index: 3000; }
#hamburgerMenu.hidden { display: none; }

.menu-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s;
}
.menu-overlay.visible { background: rgba(0,0,0,0.5); }

.menu-drawer {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--bg);
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}
.menu-drawer.open { transform: translateX(0); }

.menu-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.menu-drawer-header h2 { font-size: 20px; font-weight: 800; }

.menu-close-btn {
  background: var(--surface); border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  color: var(--text3); -webkit-tap-highlight-color: transparent;
}

.menu-list { list-style: none; padding: 8px 0; flex: 1; overflow-y: auto; }

.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  font-size: 16px; font-weight: 600; color: var(--text);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  font-family: var(--font);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.menu-item:active, .menu-item:hover { background: var(--surface); }
.menu-item-icon { font-size: 20px; }

/* ── Menu Page (full-screen overlay) ─────────────────────────────────────── */
#menuPage {
  position: fixed; inset: 0; z-index: 3001;
  background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#menuPage.hidden { display: none; }
#menuPage.open   { transform: translateY(0); }

.menu-page-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.back-btn {
  background: var(--surface); border: none; cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--text2); -webkit-tap-highlight-color: transparent;
}
#menuPageTitle { font-size: 18px; font-weight: 800; flex: 1; }
.menu-page-subtitle { font-size: 13px; color: var(--text3); padding: 12px 16px 4px; }

.menu-page-content {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 120px; /* extra bottom padding = tappable close zone */
}

.menu-page-loading, .menu-empty {
  padding: 32px 20px; text-align: center;
  font-size: 15px; color: var(--text3);
}

/* Menu list items */
.menu-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.menu-list-item:active, .menu-list-item:hover { background: var(--surface); }

.menu-rank {
  font-size: 18px; font-weight: 800;
  min-width: 32px; text-align: center;
  color: var(--text2);
}
.menu-store-info { flex: 1; min-width: 0; }
.menu-store-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-store-sub  { font-size: 13px; color: var(--text3); margin-top: 2px; }
.menu-arrow      { font-size: 20px; color: var(--text3); flex-shrink: 0; }

.menu-sub-list {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.menu-sub-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px 11px 36px;
  font-size: 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.menu-sub-item:last-child { border-bottom: none; }
.menu-sub-item:active { background: var(--surface2); }
.menu-sub-name { flex: 1; font-weight: 600; }

/* Settings page */
.settings-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.settings-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text3);
  margin-bottom: 16px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-label { flex: 1; }
.settings-name  { font-size: 16px; font-weight: 600; }
.settings-desc  { font-size: 13px; color: var(--text3); margin-top: 2px; }
.settings-value { font-size: 14px; color: var(--text3); }
.settings-notice {
  margin-top: 14px;
  font-size: 13px; color: var(--text3);
  background: var(--surface); border-radius: 8px;
  padding: 10px 14px;
}

/* Toggle switch (non-functional in prototype) */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border); border-radius: 28px;
  cursor: not-allowed;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s;
}

/* ── Badge ring redesign (Task 5) ────────────────────────────────────────── */
/* Crown stores: gold ring glow */
.marker-crown-ring .marker-icon {
  box-shadow: 0 0 0 3px gold, 0 0 0 6px orange, 0 0 12px goldenrod;
}

/* Fire/hot stores: red ring glow */
.marker-fire-ring .marker-icon {
  box-shadow: 0 0 0 3px orange, 0 0 0 5px red, 0 0 10px rgba(255,0,0,0.6);
}

/* Auto-jip stores: turquoise ring */
.marker-auto-ring .marker-icon {
  box-shadow: 0 0 0 3px #00B5A5, 0 0 0 5px #007A6E, 0 0 10px rgba(0,181,165,0.5);
}

/* Stacked rings — when multiple badges apply, rings compound (thicker look) */
.marker-crown-ring.marker-auto-ring .marker-icon {
  box-shadow: 0 0 0 3px gold, 0 0 0 5px orange, 0 0 0 8px #00B5A5, 0 0 12px rgba(0,181,165,0.4);
}
.marker-fire-ring.marker-auto-ring .marker-icon {
  box-shadow: 0 0 0 3px orange, 0 0 0 5px red, 0 0 0 7px #00B5A5, 0 0 10px rgba(0,181,165,0.4);
}
.marker-crown-ring.marker-fire-ring .marker-icon {
  box-shadow: 0 0 0 3px gold, 0 0 0 5px orange, 0 0 0 7px red, 0 0 12px rgba(255,0,0,0.4);
}
.marker-crown-ring.marker-fire-ring.marker-auto-ring .marker-icon {
  box-shadow: 0 0 0 2px gold, 0 0 0 4px orange, 0 0 0 6px red, 0 0 0 8px #00B5A5, 0 0 14px rgba(0,181,165,0.4);
}

/* ── Auto-jip badge in store list (Task 6) ───────────────────────────────── */
.badge-auto {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 12px;
  background: #00B5A5; color: #fff;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

/* ── Auto-jip line in modal (Task 6) ─────────────────────────────────────── */
.auto-jip-modal {
  display: inline-block;
  background: #E0F7F5; color: #007A6E;
  border: 1.5px solid #A7DDD9;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 14px; font-weight: 700;
  margin-bottom: 10px;
}

/* ── Recent subtitle (Task 6) ────────────────────────────────────────────── */
#recent-subtitle {
  position: fixed;
  left: 0; right: 0; z-index: 998;
  background: #FFF8E1;
  color: #9A6B00;
  font-size: 12px; font-weight: 600;
  padding: 6px 16px;
  border-bottom: 1px solid #FFE082;
  text-align: center;
}

/* ── Rank scope dropdown (Task 7) ─────────────────────────────────────────── */
#rank-scope-wrapper {
  position: fixed;
  left: 0; right: 0; z-index: 998;
  background: var(--bg);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-scope-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}

.rank-scope-btns {
  display: flex;
  gap: 6px;
}

.rank-scope-btn {
  padding: 5px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}
.rank-scope-btn.active {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.rank-scope-btn:not(.active):hover {
  border-color: var(--gold);
  color: var(--text);
}

#rank-scope-select {
  width: 100%; max-width: 200px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

/* ── Radius filter row (Task 10) ─────────────────────────────────────────── */
.radius-filter-row {
  padding: 10px 16px 4px;
  border-bottom: 1px solid var(--border);
}
.radius-filter {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

/* ── Feedback form (Task 12) ─────────────────────────────────────────────── */
.feedback-panel {
  padding: 20px;
}
.feedback-panel h3 {
  font-size: 20px; font-weight: 800;
  margin-bottom: 8px;
}
.feedback-desc {
  font-size: 14px; color: var(--text3);
  margin-bottom: 16px;
  line-height: 1.5;
}
.feedback-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font); font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
  outline: none;
  cursor: pointer;
}
.feedback-select:focus { border-color: var(--blue); }

.feedback-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font); font-size: 14px;
  color: var(--text);
  resize: vertical;
  margin-bottom: 12px;
  outline: none;
}
.feedback-textarea:focus { border-color: var(--blue); background: var(--bg); }
.feedback-textarea::placeholder { color: var(--text3); }

.feedback-submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--blue); color: #fff;
  font-family: var(--font); font-size: 16px; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.feedback-submit-btn:active { transform: scale(0.97); background: #1a6fd4; }

.feedback-status {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
  text-align: center;
}
.feedback-status.success { color: var(--green); font-weight: 700; }
.feedback-status.error   { color: var(--red); }

/* ── Custom Tooltip (JS-positioned) ──────────────────────────────────────── */
.custom-tooltip {
  position: fixed;
  z-index: 10001;
  background: rgba(25, 31, 40, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  font-family: var(--font);
}
.custom-tooltip.visible { opacity: 1; }

/* ── Location Permission Popup ───────────────────────────────────────────── */
.location-popup-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.location-popup {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 28px 24px 20px;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  text-align: center;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.location-popup-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.location-popup h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
.location-popup p {
  font-size: 14px;
  color: var(--text3);
  line-height: 1.5;
  margin-bottom: 20px;
}
.location-popup-guide {
  font-size: 12px;
  color: var(--text3);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  line-height: 1.5;
  text-align: left;
}
.location-popup-btns {
  display: flex;
  gap: 8px;
}
.location-popup-btns button {
  flex: 1;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.location-popup-btns .btn-primary {
  background: var(--blue);
  color: #fff;
}
.location-popup-btns .btn-secondary {
  background: var(--surface);
  color: var(--text2);
}

/* ── Notice red dot badge ────────────────────────────────────────────────── */
.notice-badge {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 9px;
  height: 9px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  pointer-events: none;
}
.menu-item { position: relative; }

/* ── Large-text accessibility guards ─────────────────────────────────────── */
header {
  min-height: 44px;
  overflow: visible;
}
#filterBar {
  min-height: 40px;
  flex-wrap: nowrap;
}
.filter-btn {
  min-height: 34px;
  white-space: nowrap;
}
.search-box {
  min-height: 40px;
}
#searchInput {
  min-width: 0;
  font-size: clamp(12px, 3.5vw, 14px);
}
.sheet-header h2 {
  font-size: clamp(16px, 4.5vw, 19px);
}
.sort-pill {
  font-size: clamp(11px, 3.2vw, 13px);
}

/* ── Mobile-specific bottom sheet & controls ─────────────────────────────── */
@media (max-width: 767px) {
  /* When sheet is expanded, hide zoom/locate/recenter controls */
  #bottomSheet.expanded ~ #zoomControls,
  body.sheet-open #zoomControls,
  body.sheet-open #locateBtn,
  body.sheet-open #recenterBtn {
    display: none !important;
  }
}

/* ── Responsive (desktop sidebar) ───────────────────────────────────────── */
@media (min-width: 768px) {
  #bottomSheet {
    left: 16px; right: auto; width: 380px;
    border-radius: var(--radius); bottom: 16px;
  }
  #bottomSheet.collapsed { transform: translateY(calc(100% - 200px)); }
  .modal-content { border-radius: var(--radius); margin-bottom: 16px; }
  #menuPage { max-width: 480px; left: 50%; transform: translate(-50%, 100%); }
  #menuPage.open { transform: translate(-50%, 0); }
}

/* ── Notice list in hamburger ────────────────────────────────────────────── */
.notice-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.notice-item:last-child { border-bottom: none; }
.notice-date {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 4px;
}
.notice-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.notice-title-row h3 {
  font-size: 16px;
  font-weight: 700;
}
.notice-type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.notice-type-badge.result {
  background: var(--gold-bg);
  color: #9A6B00;
}
.notice-type-badge.update {
  background: var(--blue-bg);
  color: var(--blue);
}
.notice-type-badge.event {
  background: #E8F5E9;
  color: #2E7D32;
}
.notice-body {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}
.notice-store-link {
  display: inline-block;
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed var(--blue);
  margin: 2px 0;
}
.notice-store-link:active {
  opacity: 0.7;
}
.notice-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 15px;
}
