:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #efece4;
  --text: #1f2421;
  --text-muted: #5c635e;
  --border: #dfd9cc;
  --c-11: #d97706; /* 국보 */
  --c-12: #0d9488; /* 보물 */
  --c-13: #be123c; /* 사적 */
  --c-cleared: #16a34a;
  --c-gold: #eab308;
  --shadow: 0 6px 24px rgba(24, 28, 24, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: #1f2421;
  color: #f8f6f0;
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge { font-size: 1.6rem; }
.brand h1 { margin: 0; font-size: 1.08rem; font-weight: 700; }
.brand p { margin: 2px 0 0; font-size: 0.78rem; color: #c7c2b6; }

.tab-nav { display: flex; gap: 6px; }
.tab-btn {
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  color: #e2dfd7;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.tab-btn.active {
  background: #eab308;
  color: #1a1c19;
  border-color: #eab308;
}

.main-container {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}
.tab-panel { display: none; height: 100%; overflow-y: auto; }
.tab-panel.active { display: flex; flex-direction: column; }

/* Map Toolbar */
.map-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
}
.filter-row, .control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: #1f2421; color: #fff; border-color: #1f2421; }
.chip-11.active { background: var(--c-11); border-color: var(--c-11); }
.chip-12.active { background: var(--c-12); border-color: var(--c-12); }
.chip-13.active { background: var(--c-13); border-color: var(--c-13); }
.chip-unesco { border-color: #c4b5fd; color: #5b21b6; }
.chip-unesco.active { background: #6d28d9; border-color: #6d28d9; color: #fff; }

.map-search-wrap { position: relative; width: 100%; }
.map-search-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.86rem;
  background: var(--bg);
  color: var(--text);
}
.map-search-input:focus { outline: none; border-color: #2563eb; background: #fff; }
.map-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1200;
}
.map-search-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--surface-alt);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
}
.map-search-item:last-child { border-bottom: none; }
.map-search-item:hover { background: #f8fafc; }

.pin-unesco {
  background: #7c3aed !important;
  border-color: #fde047 !important;
  box-shadow: 0 0 0 2px #facc15, 0 2px 8px rgba(109, 40, 217, 0.45);
}
.unesco-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: linear-gradient(90deg, #4c1d95, #7c3aed);
  color: #fef08a;
}
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary.watching { background: #16a34a; }
.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-outline.active { background: #fef3c7; border-color: #d97706; color: #92400e; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-success { background: #16a34a; color: #fff; }

.radius-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  background: var(--surface-alt);
  padding: 4px 10px;
  border-radius: 10px;
}
.select-input, .search-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.84rem;
  background: var(--surface);
  color: var(--text);
}
.search-input { flex: 1; min-width: 220px; }

.sim-bar {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.sim-hint { font-size: 0.8rem; color: #92400e; }
.teleport-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-mini {
  border: 1px solid #f59e0b;
  background: #fff;
  color: #92400e;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-mini:hover { background: #fef3c7; }

/* Proximity Banner */
.proximity-banner {
  background: linear-gradient(90deg, #ecfdf5, #fefce8);
  border-bottom: 1px solid #bbf7d0;
  padding: 8px 14px;
  z-index: 490;
}
.prox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 6px;
}
.prox-coords { font-weight: 400; font-size: 0.76rem; color: var(--text-muted); }
.prox-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.prox-card {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 6px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.prox-card.cleared { border-color: var(--c-gold); background: #fefce8; }
.prox-dist { font-weight: 700; color: #16a34a; font-size: 0.78rem; }

/* Map */
.mobile-only { display: none !important; }
.map-canvas { flex: 1; width: 100%; min-height: 360px; z-index: 1; position: relative; }

.custom-pin {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.pin-11 { background: var(--c-11); }
.pin-12 { background: var(--c-12); }
.pin-13 { background: var(--c-13); }
.pin-cleared {
  background: var(--c-cleared);
  border-color: #fde047;
  box-shadow: 0 0 0 2px #eab308, 0 2px 8px rgba(0,0,0,0.35);
}

/* Collection, Badges, Ranking, Diary Tabs */
#tab-collection, #tab-badges, #tab-ranking, #tab-diary { padding: 18px; max-width: 1180px; width: 100%; margin: 0 auto; }

.user-actions { display: flex; align-items: center; gap: 6px; }
.user-pill {
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
  color: #f8f6f0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.checkin-btn {
  border: none;
  background: #22c55e;
  color: #052e16;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}
.checkin-btn.done { background: #334155; color: #cbd5e1; }
.sound-btn {
  border: 1px solid rgba(255,255,255,0.22);
  background: transparent;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-mini-accent { background: #fef3c7; border-color: #d97706; color: #78350f; }

.radar-hud {
  background: #18211b;
  color: #f0fdf4;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #2e4034;
  z-index: 495;
}
.compass-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.16);
  border: 2px solid #4ade80;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.compass-arrow {
  display: inline-block;
  font-size: 1rem;
  color: #fde047;
  transition: transform 0.25s ease-out;
}
.radar-text { flex: 1; min-width: 0; }
.radar-main { font-size: 0.86rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radar-sub { font-size: 0.75rem; color: #bbf7d0; margin-top: 1px; }

.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.quest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.quest-card.done { border-color: #86efac; background: #f0fdf4; }

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}
.rank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.rank-card h3 { margin: 0 0 10px; font-size: 0.98rem; }
.rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
}
.rank-row:nth-child(even) { background: var(--surface-alt); }
.rank-row.me { background: #fef9c3; font-weight: 800; }

.visitor-box {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 0.83rem;
}

/* Region Drilldown */
.region-drilldown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.region-drill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.region-drill-title {
  font-size: 0.94rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.region-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.region-card {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: 0.12s;
}
.region-card:hover { border-color: #1f2421; background: #fff; }
.region-card.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #2563eb;
}
.region-card-name {
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.region-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Mayor Banner, Multi-visit History, Theme Courses, Timeline, Google Box */
.mayor-banner {
  background: linear-gradient(90deg, #fef08a, #fde047);
  color: #713f12;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.visit-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
}
.visit-entry-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
}
.visit-entry-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
}
.course-card.done { border-color: #eab308; background: #fffbeb; }
.timeline-year-header {
  grid-column: 1 / -1;
  font-size: 1.02rem;
  font-weight: 800;
  padding: 10px 4px 4px;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}
.google-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.badge-group { margin-bottom: 24px; }
.badge-group-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.badge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0.72;
  transition: transform 0.15s, box-shadow 0.15s;
}
.badge-card.unlocked {
  opacity: 1;
  border-color: #facc15;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.14);
}
.badge-top { display: flex; align-items: center; gap: 10px; }
.badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  filter: grayscale(1);
}
.badge-card.unlocked .badge-icon {
  background: #fef08a;
  border: 2px solid #eab308;
  filter: none;
}
.badge-name { font-size: 0.96rem; font-weight: 800; margin: 0; }
.badge-desc { font-size: 0.79rem; color: var(--text-muted); margin: 2px 0 0; }
.badge-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}
.badge-card.unlocked .badge-meta { color: #b45309; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
  pointer-events: none;
}
.badge-toast {
  background: #1f2421;
  color: #fff;
  border: 2px solid #eab308;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  animation: toast-in 0.25s ease-out;
}
.badge-toast-icon { font-size: 1.7rem; }
.badge-toast-title { font-size: 0.75rem; color: #fde047; font-weight: 700; }
.badge-toast-name { font-size: 0.95rem; font-weight: 800; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.stat-title { font-size: 0.84rem; color: var(--text-muted); font-weight: 600; }
.stat-val { font-size: 1.3rem; font-weight: 800; margin: 4px 0 8px; }
.progress-track { height: 8px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--c-cleared); transition: width 0.3s; }

.collection-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.result-count { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 10px; }
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.col-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: transform 0.12s;
  position: relative;
}
.col-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.col-card.cleared { border-color: #86efac; background: linear-gradient(180deg, #ffffff, #f0fdf4); }
.col-card.undisclosed { opacity: 0.72; background: #f3f1eb; border-style: dashed; }
.stamp-pill.locked { background: #e5e7eb; color: #374151; }
.col-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 8px; }
.kind-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.kind-11 { background: var(--c-11); }
.kind-12 { background: var(--c-12); }
.kind-13 { background: var(--c-13); }
.stamp-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}
.col-name { font-size: 1rem; font-weight: 700; margin: 0 0 4px; }
.col-loc { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.load-more-wrap { text-align: center; padding: 18px 0 32px; }

/* Diary Tab */
.diary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.diary-header h2 { margin: 0; font-size: 1.25rem; }
.diary-header p { margin: 4px 0 0; font-size: 0.84rem; color: var(--text-muted); }
.diary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-label { cursor: pointer; }

.diary-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.diary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.diary-photos { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.diary-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.diary-memo { font-size: 0.88rem; margin: 8px 0 0; white-space: pre-wrap; color: var(--text); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 18, 16, 0.62); }
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: 18px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  padding: 20px;
  z-index: 1;
}
.modal-close {
  position: sticky;
  top: 0;
  float: right;
  border: none;
  background: var(--surface-alt);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}
.gallery-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px 0;
}
.gallery-strip img {
  height: 170px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.meta-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  background: var(--surface-alt);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.83rem;
  margin: 10px 0;
}
.audio-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
}
.audio-box audio { width: 100%; margin-top: 6px; height: 36px; }
.desc-box {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #2b302c;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
  margin: 10px 0;
}
.stamp-section {
  border-top: 2px dashed var(--border);
  margin-top: 14px;
  padding-top: 14px;
}
.dist-box {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.dist-in { background: #dcfce7; color: #166534; }
.dist-out { background: #fef3c7; color: #92400e; }
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; }
.form-group input[type="date"], .form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
}
.photo-preview-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.photo-thumb-wrap { position: relative; }
.photo-thumb-wrap img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.photo-del-btn {
  position: absolute; top: -5px; right: -5px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: #ef4444; color: #fff; font-size: 11px; cursor: pointer;
}
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media (max-width: 768px) {
  .mobile-only { display: inline-flex !important; }
  .top-bar {
    padding: 6px 10px;
    height: 50px;
    flex-wrap: nowrap;
  }
  .brand-badge { font-size: 1.3rem; }
  .brand h1 { font-size: 0.96rem; white-space: nowrap; }
  .brand p { display: none; }
  .user-pill { max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; padding: 4px 8px; }
  .checkin-btn { font-size: 0.74rem; padding: 5px 9px; white-space: nowrap; }
  .sound-btn { width: 28px; height: 28px; font-size: 0.82rem; }

  /* Bottom Fixed Navigation */
  .tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(58px + env(safe-area-inset-bottom));
    padding: 4px 4px env(safe-area-inset-bottom);
    background: #1f2421;
    border-top: 1px solid rgba(255,255,255,0.14);
    z-index: 1500;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
  }
  .tab-btn {
    border: none;
    border-radius: 10px;
    padding: 4px 2px;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    line-height: 1.15;
  }

  .main-container {
    height: calc(100dvh - 50px - 58px - env(safe-area-inset-bottom));
  }

  /* Collapsible Map Toolbar on Mobile */
  .map-toolbar { padding: 7px 10px; gap: 6px; }
  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row .select-input { display: none; }
  .filter-row .chip, .filter-row .toggle-chip, .filter-row .btn-mini { flex: 0 0 auto; white-space: nowrap; }
  .map-toolbar .control-row { display: none; }
  .map-toolbar.mobile-expanded .filter-row { flex-wrap: wrap; }
  .map-toolbar.mobile-expanded .filter-row .select-input { display: inline-block; flex: 1 1 46%; }
  .map-toolbar.mobile-expanded .control-row { display: flex; }

  /* Map Floating Action Buttons */
  .map-fabs {
    position: absolute;
    right: 12px;
    bottom: 18px;
    z-index: 600;
    display: flex !important;
    flex-direction: column;
    gap: 10px;
  }
  .fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .fab-btn.fab-primary { background: #2563eb; color: #fff; border-color: #1d4ed8; }
  .fab-btn.fab-primary.watching { background: #16a34a; border-color: #15803d; }
  .fab-btn.active { background: #fef3c7; border-color: #d97706; }

  /* Slide-Up Bottom Sheet Modals */
  .modal { align-items: flex-end; padding: 0; }
  .modal-card {
    border-radius: 20px 20px 0 0;
    max-height: 86dvh;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-up 0.22s ease-out;
  }
  @keyframes sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .toast-container {
    bottom: calc(68px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    max-width: none;
  }
  #tab-collection, #tab-badges, #tab-ranking, #tab-diary { padding: 12px; }
}
