/* ==========================================================================
   P・SPO 店舗マップ＆ナビゲーション CSS
   ========================================================================== */

:root {
  --primary: #ff5500;
  --primary-dark: #d94800;
  --primary-light: #fff0e6;
  --apple-black: #1c1c1e;
  --apple-blue: #0071e3;
  --apple-green: #34c759;
  --crunch-accent: #ff4500;
  --crunch-bg: #fff5eb;
  --study-accent: #0284c7;
  --study-bg: #e0f2fe;
  --sauna-accent: #9333ea;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --header-height: 120px;
  --bottom-nav-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  max-width: 1600px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--apple-black);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-locate {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--apple-black);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-locate:active {
  transform: scale(0.96);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-mypage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #0071e3 0%, #005bb5 100%);
  color: #ffffff !important;
  text-decoration: none;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.28);
  white-space: nowrap;
}

.btn-mypage:hover {
  background: linear-gradient(135deg, #0077ed 0%, #0064c7 100%);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.38);
  transform: translateY(-1px);
}

.btn-mypage:active {
  transform: scale(0.96);
}

.btn-mypage .icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* Quick Filter Bar (Sticky Horizontal Filter) */
.quick-filter-bar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 950;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}

.quick-filter-bar::-webkit-scrollbar {
  display: none;
}

.quick-filter-scroll {
  display: flex;
  gap: 8px;
  max-width: 1600px;
  margin: 0 auto;
  padding-bottom: 2px;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.quick-btn:hover {
  background: #f1f5f9;
}

.quick-btn.active {
  background: var(--apple-black);
  color: #ffffff;
  border-color: var(--apple-black);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.quick-btn.q-crunch.active {
  background: var(--crunch-accent);
  border-color: var(--crunch-accent);
  color: #fff;
}

.quick-btn.q-study.active {
  background: var(--study-accent);
  border-color: var(--study-accent);
  color: #fff;
}

.quick-btn.q-sauna.active {
  background: var(--sauna-accent);
  border-color: var(--sauna-accent);
  color: #fff;
}

.quick-btn.q-tennis.active {
  background: #65a30d;
  border-color: #65a30d;
  color: #fff;
}

.quick-btn.q-boulder.active {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}

.quick-btn.q-office.active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #fff;
}

.btn-quiz {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 12px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff !important;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.btn-quiz:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
  transform: translateY(-1px);
}

.btn-quiz:active {
  transform: scale(0.96);
}

.btn-quiz .icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.btn-quiz .btn-text {
  display: inline-block;
  line-height: 1.15;
}

/* Main Container Split View */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Left: List Panel */
.list-panel {
  width: 440px;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 500;
  overflow: hidden;
}

.filter-box {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

#keyword-search {
  width: 100%;
  padding: 10px 36px 10px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s;
}

#keyword-search:focus {
  outline: none;
  border-color: var(--apple-blue);
  background: #ffffff;
}

.btn-clear {
  position: absolute;
  right: 10px;
  background: #e2e8f0;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.select-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  background-color: #ffffff;
  color: var(--text-main);
  cursor: pointer;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn.active {
  background: #e2e8f0;
  color: var(--apple-black);
  border-color: #cbd5e1;
  font-weight: 700;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.pill-dot.crunch { background: var(--crunch-accent); }
.pill-dot.study { background: var(--study-accent); }
.pill-dot.gym { background: #10b981; }
.pill-dot.esthe { background: #ec4899; }
.pill-dot.sauna { background: var(--sauna-accent); }
.pill-dot.tennis { background: #84cc16; }
.pill-dot.boulder { background: #f97316; }
.pill-dot.office { background: #1e3a8a; }
.pill-dot.staffed { background: #f59e0b; }

/* Status Bar */
.result-status {
  padding: 8px 16px;
  background: #f1f5f9;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.result-status strong {
  color: var(--apple-black);
  font-size: 0.95rem;
}

/* Spotlight Banner */
.spotlight-banner {
  padding: 12px 16px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-bottom: 1px solid #fed7aa;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s ease;
  flex-shrink: 0;
}

.spotlight-banner.study {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-bottom: 1px solid #bae6fd;
}

.spotlight-banner.tennis {
  background: linear-gradient(135deg, #f7fee7 0%, #ecfccb 100%);
  border-bottom: 1px solid #d9f99d;
}

.spotlight-banner.boulder {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-bottom: 1px solid #fed7aa;
}

.spotlight-banner img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.spotlight-info h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--apple-black);
  margin-bottom: 2px;
}

.spotlight-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Store Cards Scroll List */
.stores-scroll-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* Store Card */
.store-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.store-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.store-card.selected {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 2px var(--apple-blue), var(--shadow-md);
}

.store-card.is-favorite {
  border-left: 5px solid #f59e0b;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}

.btn-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.btn-fav:hover {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #f59e0b;
  transform: scale(1.1);
}

.btn-fav.active {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #f59e0b;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.quick-btn.q-fav.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
}

.card-top {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.card-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.card-header-info {
  flex: 1;
  min-width: 0;
}

.card-area-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--apple-black);
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.card-distance {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--apple-blue);
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-address {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-specs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.75rem;
  color: #475569;
  margin-bottom: 10px;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-icon {
  font-size: 0.8rem;
  width: 16px;
  text-align: center;
}

/* Feature Badges */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.tag-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.tag-badge.crunch-badge {
  background: #fff0e6;
  color: #d94800;
  border: 1px solid #ffd8bf;
  font-weight: 700;
}

.tag-badge.study-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-weight: 700;
}

.tag-badge.tennis-badge {
  background: #f7fee7;
  color: #4d7c0f;
  border: 1px solid #d9f99d;
  font-weight: 700;
}

.tag-badge.boulder-badge {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  font-weight: 700;
}

.tag-badge.office-badge {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 700;
}

/* ==========================================================================
   CARPLAY / APPLE MAPS NAVIGATION BUTTON (MOST CRITICAL CTA)
   ========================================================================== */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.btn-carplay-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  background: #000000;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.btn-carplay-nav:hover {
  background: #27272a;
  transform: translateY(-1px);
}

.btn-carplay-nav:active {
  transform: scale(0.98);
}

.btn-carplay-nav .apple-icon {
  font-size: 1.15rem;
}

.btn-carplay-nav .nav-label-main {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-carplay-nav .nav-carplay-tag {
  font-size: 0.68rem;
  background: #3f3f46;
  padding: 2px 6px;
  border-radius: 4px;
  color: #e4e4e7;
  font-weight: 600;
  letter-spacing: 0;
}

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-sub:hover {
  background: #e2e8f0;
}

.btn-sub.google-map {
  color: #1a73e8;
}

/* Right: Map Panel */
.map-panel {
  flex: 1;
  position: relative;
  background: #e5e7eb;
  height: 100%;
  min-height: 400px;
}

.map-view {
  width: 100%;
  height: 100%;
  min-height: 400px;
  z-index: 1;
}

/* Floating Controls */
.map-floating-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.float-btn {
  padding: 9px 14px;
  background: #ffffff;
  color: var(--apple-black);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.float-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.float-btn.float-locate {
  background: var(--apple-black);
  color: #ffffff;
}

.float-btn.float-scroll-down {
  background: #ff5500;
  color: #ffffff;
  border-color: #ff5500;
  box-shadow: 0 4px 10px rgba(255, 85, 0, 0.3);
}

/* Custom Leaflet Markers */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  border: 2px solid #ffffff;
}

.custom-pin-inner {
  transform: rotate(45deg);
  font-size: 1.05rem;
}

.pin-crunch {
  background: linear-gradient(135deg, #ff6b35, #ff3300);
}

.pin-study {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.pin-gym {
  background: linear-gradient(135deg, #10b981, #059669);
}

.pin-sauna {
  background: linear-gradient(135deg, #a855f7, #7e22ce);
}

.pin-office {
  background: linear-gradient(135deg, #3b82f6, #1e3a8a);
}

.pin-tennis {
  background: linear-gradient(135deg, #84cc16, #65a30d);
}

.pin-boulder {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

.pin-default {
  background: linear-gradient(135deg, #64748b, #475569);
}

/* Popup Style */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  line-height: 1.4;
  min-width: 260px;
  max-width: 320px;
}

.popup-card {
  padding: 12px;
}

.popup-header {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.popup-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.popup-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--apple-black);
  line-height: 1.25;
  margin-bottom: 2px;
}

.popup-address {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 10px;
}

/* Mobile Preview Card */
.mobile-preview-card {
  position: absolute;
  bottom: 74px;
  left: 12px;
  right: 12px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 14px;
  border: 1px solid var(--border-color);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-close-preview {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #f1f5f9;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile Bottom Navigation */
.mobile-nav {
  display: none;
  height: var(--bottom-nav-height);
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 6px 12px;
  z-index: 1000;
  flex-shrink: 0;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  gap: 2px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-item.active {
  color: var(--apple-blue);
  font-weight: 700;
}

.nav-icon {
  font-size: 1.25rem;
}

.nav-item.q-crunch-nav {
  color: var(--crunch-accent);
}

.nav-item.q-study-nav {
  color: var(--study-accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  z-index: 10;
}

/* Favorite Pin and Popup Styles */
.custom-pin.is-fav-pin {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5), var(--shadow-md) !important;
}

.popup-btn-fav {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.popup-btn-fav:hover,
.popup-btn-fav.active {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #d97706;
}

.modal-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  z-index: 5;
}

.modal-fav-btn:hover,
.modal-fav-btn.active {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-popup-detail {
  font-size: 0.76rem !important;
  padding: 6px 10px !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   MOBILE RESPONSIVE BREAKPOINT
   ========================================================================== */
@media (max-width: 768px) {
  body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
  }

  .app-layout {
    height: auto !important;
    min-height: 100vh;
    overflow: visible !important;
    display: block !important;
  }

  .header-inner {
    padding: 6px 10px;
    gap: 6px;
  }
  
  .brand {
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .brand-logo {
    height: 30px;
  }

  .brand-title {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .btn-mypage {
    padding: 6px 9px;
    font-size: 0.74rem;
    gap: 3px;
    border-radius: 20px;
  }

  .btn-mypage .icon {
    font-size: 0.82rem;
  }

  .btn-quiz {
    padding: 4px 8px;
    font-size: 0.70rem;
    gap: 4px;
    border-radius: 16px;
    line-height: 1.1;
  }

  .btn-quiz .icon {
    font-size: 0.85rem;
  }

  .main-container {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
    position: relative;
  }

  /* Map is placed at the top with a comfortable fixed height */
  .map-panel {
    width: 100% !important;
    height: 360px !important;
    min-height: 360px !important;
    display: block !important;
    flex-shrink: 0;
    order: 1;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    scroll-margin-top: 52px;
  }

  .map-view {
    width: 100% !important;
    height: 360px !important;
    min-height: 360px !important;
    display: block !important;
  }

  /* List and filters scroll naturally beneath the map */
  .list-panel {
    width: 100% !important;
    height: auto !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    border-right: none;
    order: 2;
    overflow: visible !important;
    scroll-margin-top: 52px;
  }

  .filter-box {
    padding: 12px;
    gap: 8px;
  }

  .stores-scroll-list {
    overflow: visible !important;
    height: auto !important;
    padding: 12px 12px 80px 12px !important;
    gap: 12px;
  }

  .store-card {
    padding: 14px;
  }

  .map-floating-controls {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  .float-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  /* Sticky Jump to Map bar for mobile */
  .mobile-nav {
    display: flex !important;
    position: sticky;
    bottom: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  }

  /* Modal bottom-sheet on mobile */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-card {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 85vh !important;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom)) !important;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
}

/* ==========================================================================
   PSPO EXAM QUIZ MODAL & UI STYLES
   ========================================================================== */
.quiz-modal-card {
  max-width: 780px !important;
  width: 95% !important;
  max-height: 90vh !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

.quiz-header-bar {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  border-bottom: 2px solid #f59e0b;
}

.quiz-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-header-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.quiz-header-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  color: #ffffff;
}

.quiz-header-sub {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 500;
}

.quiz-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* Quiz Navigation Tabs */
.quiz-mode-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 6px 12px 0 12px;
  gap: 6px;
  overflow-x: auto;
}

.quiz-tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.quiz-tab-btn:hover {
  color: #1e293b;
}

.quiz-tab-btn.active {
  color: #d97706;
  border-bottom-color: #f59e0b;
  background: #ffffff;
  border-radius: 8px 8px 0 0;
}

/* Quiz Content Body */
.quiz-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

/* Question Section */
.quiz-box {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.quiz-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.quiz-genre-badge {
  background: #fef3c7;
  color: #b45309;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.quiz-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
}

.quiz-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: width 0.3s ease;
}

.quiz-question-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Option Buttons */
.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-opt-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-opt-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.quiz-opt-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.quiz-opt-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.quiz-opt-btn.correct {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}

.quiz-opt-btn.correct .quiz-opt-prefix {
  background: #10b981 !important;
  color: #ffffff !important;
}

.quiz-opt-btn.wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

.quiz-opt-btn.wrong .quiz-opt-prefix {
  background: #ef4444 !important;
  color: #ffffff !important;
}

/* Explanation / Feedback */
.quiz-feedback-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 12px;
  animation: fadeIn 0.3s ease;
}

.quiz-feedback-box.is-correct {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.quiz-feedback-box.is-wrong {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.quiz-feedback-header {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-feedback-box.is-correct .quiz-feedback-header {
  color: #15803d;
}

.quiz-feedback-box.is-wrong .quiz-feedback-header {
  color: #b91c1c;
}

.quiz-feedback-exp {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.55;
}

.quiz-next-btn {
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #0071e3 0%, #005bb5 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.quiz-next-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.4);
}

/* Result Screen */
.quiz-result-view {
  text-align: center;
  padding: 24px 12px;
}

.quiz-result-crown {
  font-size: 3.5rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.4));
  animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-result-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 6px;
}

.quiz-score-badge {
  display: inline-block;
  font-size: 2.2rem;
  font-weight: 900;
  color: #d97706;
  background: #fffbeb;
  border: 2px solid #fde68a;
  padding: 4px 24px;
  border-radius: var(--radius-full);
  margin: 12px 0 16px 0;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
}

.quiz-eval-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 8px;
}

.quiz-eval-msg {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto 24px auto;
}

.quiz-result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-quiz-retry {
  padding: 12px 24px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  transition: all 0.2s ease;
}

.btn-quiz-retry:hover {
  transform: translateY(-1px);
}

.btn-quiz-mode {
  padding: 12px 20px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Genre Cards Grid */
.quiz-genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.genre-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.genre-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.15);
  transform: translateY(-2px);
}

.genre-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.genre-card-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 12px;
}

.genre-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #d97706;
}

/* 100 Questions Archive List */
.quiz-archive-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-search-box {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8fafc;
  padding-bottom: 8px;
}

.archive-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.88rem;
  background: #ffffff;
}

.archive-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.archive-card-q {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.archive-card-ans {
  font-size: 0.85rem;
  font-weight: 700;
  color: #15803d;
  background: #f0fdf4;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.archive-card-exp {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.5;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

