:root {
  --bg: #111315;
  --surface: #171a1d;
  --surface2: #1f2327;
  --border: #2b3136;
  --accent: #e1754f;
  --accent2: #45b7a8;
  --text: #f3f1ed;
  --muted: #a5a099;
  --heat1: #e1754f;
  --heat2: #45b7a8;
}

body[data-theme='light'] {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface2: #eef3f9;
  --border: #d9e2ec;
  --accent: #ff7a59;
  --accent2: #2ec4b6;
  --text: #1a2433;
  --muted: #66758a;
  --heat1: #ff7a59;
  --heat2: #2ec4b6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(circle at 20% -10%, rgba(214,107,77,0.15), transparent 48%),
    radial-gradient(circle at 90% 120%, rgba(92,163,154,0.12), transparent 44%),
    var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* HEADER */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--surface);
  flex-shrink: 0;
  z-index: 100;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.city-switcher {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
}

.theme-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.theme-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 11px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}

.theme-btn.active {
  background: var(--accent2);
  color: #0d2220;
  font-weight: 600;
}

.header-tabs {
  display: flex;
  gap: 4px;
}
.header-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all 0.2s;
}
.header-tab.active {
  background: var(--accent);
  color: white;
}
.header-tab:hover:not(.active) {
  background: var(--surface2);
  color: var(--text);
}

.header-tab:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.add-btn:hover { background: #bf5d43; transform: translateY(-1px); }
.add-btn svg { width: 14px; height: 14px; }

/* MAIN LAYOUT */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* SIDEBAR */
.sidebar {
  width: 360px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-resizer {
  width: 8px;
  cursor: col-resize;
  background: linear-gradient(to right, transparent 0%, rgba(214,107,77,0.28) 50%, transparent 100%);
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.map-pane {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.map-header {
  padding: 10px 20px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.map-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  line-height: 1.3;
}
.map-header p {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
  line-height: 1.3;
}

body.resizing-sidebar,
body.resizing-sidebar * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sidebar-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.sidebar-sub {
  font-size: 12px;
  color: var(--muted);
}

/* Filter Control */
.filter-control {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(214,107,77,0.15);
  padding: 4px 12px;
  border-radius: 12px;
  min-width: 40px;
  text-align: center;
}

#filter-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface2);
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 8px;
}

#filter-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(214,107,77,0.45);
  transition: all 0.2s;
}

#filter-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(214,107,77,0.65);
}

#filter-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(214,107,77,0.45);
  transition: all 0.2s;
}

#filter-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(214,107,77,0.65);
}

.filter-range {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  padding: 0 2px;
}

.sort-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
.sort-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.sort-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(214,107,77,0.12);
}

.list-search-wrap {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.list-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
}

.list-search:focus {
  border-color: var(--accent2);
}

.filter-control.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.restaurant-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}
.restaurant-list::-webkit-scrollbar { width: 4px; }
.restaurant-list::-webkit-scrollbar-track { background: transparent; }
.restaurant-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.empty-state {
  padding: 60px 30px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
  opacity: 0.7;
}
.empty-state p {
  font-size: 13px;
  line-height: 1.6;
}

.restaurant-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid transparent;
  position: relative;
}
.restaurant-card:hover { background: var(--surface2); }
.restaurant-card.active { background: var(--surface2); border-left: 3px solid var(--accent); padding-left: 17px; }

.rank-badge {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 900;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--surface2);
  border: 2px solid var(--border);
}

.rank-number {
  color: var(--muted);
}

/* Rank styling - Gold, Silver, Bronze */
.rank-badge.rank-gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  border-color: #FFD700;
  box-shadow: 0 4px 12px rgba(255,215,0,0.3);
}
.rank-badge.rank-gold .rank-number {
  color: #000;
  font-weight: 900;
}

.rank-badge.rank-silver {
  background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%);
  border-color: #C0C0C0;
  box-shadow: 0 4px 12px rgba(192,192,192,0.3);
}
.rank-badge.rank-silver .rank-number {
  color: #000;
  font-weight: 900;
}

.rank-badge.rank-bronze {
  background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
  border-color: #CD7F32;
  box-shadow: 0 4px 12px rgba(205,127,50,0.3);
}
.rank-badge.rank-bronze .rank-number {
  color: #fff;
  font-weight: 900;
}

.rank-badge.rank-top10 {
  background: rgba(232,99,58,0.15);
  border-color: var(--accent);
}
.rank-badge.rank-top10 .rank-number {
  color: var(--accent);
  font-weight: 700;
}

.card-info { flex: 1; min-width: 0; }
.card-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.card-tag {
  background: var(--surface2);
  padding: 1px 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.timestamp {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
.vote-btn:hover { border-color: var(--accent); background: rgba(214,107,77,0.12); }
.vote-btn.voted { border-color: var(--accent); background: rgba(214,107,77,0.16); color: var(--accent); }
.vote-btn svg { width: 14px; height: 14px; }
.vote-count { font-size: 13px; font-weight: 600; }

.card-map-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--accent2);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.card-map-btn:hover {
  border-color: var(--accent2);
  background: rgba(69,183,168,0.16);
}

/* Vote Animation */
@keyframes voteClick {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.vote-btn.vote-animate {
  animation: voteClick 0.3s ease;
}

/* Marker Hover Tooltip */
.marker-tooltip {
  position: fixed;
  z-index: 1200;
  background: var(--surface);
  border: 1px solid rgba(214,107,77,0.6);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.45);
  padding: 8px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  min-width: 240px;
  max-width: 300px;
}

.marker-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.marker-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-right: 1px solid rgba(214,107,77,0.6);
  border-bottom: 1px solid rgba(214,107,77,0.6);
  transform: translateX(-50%) rotate(45deg);
}

.tooltip-image {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--surface2);
}

.tooltip-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tooltip-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.tooltip-rank {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent);
  font-family: 'Playfair Display', serif;
}

.tooltip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Photo Preview in Modal */
.photo-preview {
  width: 100%;
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--surface2);
}

.photo-preview img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.photo-caption {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* Card Thumbnail */
.card-thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface2);
}

.card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumbnail-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

/* MAP */
#map {
  flex: 1;
  background: var(--bg);
  width: 100%;
  height: 100%;
  min-height: 400px;
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 480px;
  max-width: 95vw;
  animation: slideUp 0.25s ease;
}

.suggestions-modal {
  width: 560px;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}

.form-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.form-note.success {
  color: var(--accent2);
}

.form-note.warning {
  color: #ffb07d;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--surface2); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Error Banners */
.radius-error,
.restaurant-error {
  display: none;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.radius-error {
  background: rgba(255,68,68,0.1);
  border: 1px solid #ff4444;
}

.radius-error .error-text {
  color: #ff6666;
}

.restaurant-error {
  background: rgba(255,152,0,0.1);
  border: 1px solid #ff9800;
}

.restaurant-error .error-text {
  color: #ff9800;
}

.error-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.modal-hint {
  font-size: 12px;
  color: var(--muted);
  background: rgba(214,107,77,0.10);
  border: 1px solid rgba(214,107,77,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn-cancel {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-cancel:hover { color: var(--text); border-color: var(--muted); }
.btn-submit {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-submit:hover { background: #d4562f; }

.btn-submit:disabled {
  background: #3b4147;
  color: #8d98a3;
  cursor: not-allowed;
}

.btn-submit:disabled:hover {
  background: #3b4147;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
  color: var(--text);
  font-size: 13px;
}

.choice-item input {
  accent-color: var(--accent2);
}

/* MAP PIN CLICK PROMPT */
.map-prompt {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--accent);
  pointer-events: none;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}
.map-prompt.visible { opacity: 1; }

/* Leaflet dark overrides */
.leaflet-tile-pane { filter: brightness(0.85) saturate(0.8); }
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-family: 'DM Sans', sans-serif; font-size: 13px; }

.popup-name { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.popup-tag { font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.popup-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.popup-votes { font-size: 12px; color: var(--accent2); font-weight: 600; }

/* heat dot custom marker */
.heat-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white;
  font-family: 'DM Sans', sans-serif;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  transition: transform 0.2s;
}

.count-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

/* Google Extended Component Library Place Picker */
.place-picker-wrapper {
  width: 100%;
}

gmpx-place-picker {
  width: 100%;
  --gmpx-color-surface: var(--surface2);
  --gmpx-color-on-surface: var(--text);
  --gmpx-color-on-surface-variant: var(--muted);
  --gmpx-color-primary: var(--accent);
  --gmpx-font-family-base: 'DM Sans', sans-serif;
  --gmpx-font-size-base: 14px;
  --gmpx-rating-color: var(--accent2);
  --gmpx-rating-color-empty: var(--border);
}

gmpx-place-picker::part(input) {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  color: var(--text) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 14px !important;
  outline: none !important;
  width: 100% !important;
}

gmpx-place-picker::part(input):focus {
  border-color: var(--accent) !important;
}

gmpx-place-picker::part(listbox) {
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  margin-top: 4px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
  max-height: 300px !important;
}

gmpx-place-picker::part(option) {
  background-color: var(--surface) !important;
  color: var(--text) !important;
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--border) !important;
  cursor: pointer !important;
  font-size: 13px !important;
}

gmpx-place-picker::part(option):hover {
  background-color: var(--surface2) !important;
}

gmpx-place-picker::part(option-selected) {
  background-color: var(--surface2) !important;
}

/* Google Places Autocomplete Styling (fallback) */
.pac-container {
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  margin-top: 4px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
  font-family: 'DM Sans', sans-serif !important;
  padding: 4px 0 !important;
  max-height: 300px !important;
  overflow-y: auto !important;
  z-index: 2000 !important;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION
   ========================================================================== */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  z-index: 1000;
  gap: 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  min-height: 48px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.mobile-nav-btn.active {
  color: var(--accent);
  background: rgba(225, 117, 79, 0.12);
}

.mobile-nav-btn:active {
  transform: scale(0.92);
  background: rgba(225, 117, 79, 0.08);
}

/* ==========================================================================
   TABLET BREAKPOINT (max-width: 900px)
   ========================================================================== */

@media (max-width: 900px) {
  .header-actions {
    gap: 6px;
  }

  .theme-toggle {
    display: none;
  }

  .sidebar {
    width: 100% !important;
    max-width: 100%;
  }

  .sidebar-resizer {
    display: none;
  }

  .main {
    flex-direction: column;
  }

  .map-pane {
    min-height: 42vh;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MOBILE BREAKPOINT (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
  /* === ROOT MOBILE LAYOUT FIXES === */
  
  /* Use dynamic viewport height for mobile browsers (handles address bar) */
  html {
    height: 100%;
  }
  
  body {
    height: 100%;
    height: 100dvh; /* Dynamic viewport height - handles mobile browser chrome */
    min-height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
  }

  /* Show mobile navigation */
  .mobile-nav {
    display: flex;
  }

  /* Hide desktop header tabs */
  .header-tabs {
    display: none;
  }

  /* === HEADER - Compact mobile header === */
  header {
    padding: 0 12px;
    height: 52px;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
  }

  .logo {
    font-size: 18px;
  }

  /* Add button: icon only on mobile */
  .add-btn .btn-text {
    display: none;
  }

  .add-btn {
    padding: 10px 12px;
    border-radius: 50%;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .add-btn svg {
    width: 20px;
    height: 20px;
  }

  /* === MAIN LAYOUT === */
  .main {
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    /* Height = viewport - header - mobile nav */
    height: calc(100dvh - 52px - 64px);
    height: calc(100% - 52px - 64px);
    position: relative;
  }

  /* === SIDEBAR (List View) === */
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 100% !important;
    height: 100%;
    border-right: none;
    overflow: hidden;
    flex: 1;
  }

  .sidebar-resizer {
    display: none !important;
  }

  /* Sidebar header - stays at top */
  .sidebar-header {
    padding: 12px 16px 8px;
    flex-shrink: 0;
  }

  .sidebar-title {
    font-size: 20px;
    margin-bottom: 2px;
  }

  .sidebar-sub {
    font-size: 12px;
  }

  /* Filter control - compact and sticky */
  .filter-control {
    padding: 10px 16px;
    flex-shrink: 0;
    background: var(--surface);
  }

  .filter-header {
    margin-bottom: 8px;
  }

  /* Sort bar - horizontal scroll */
  .sort-bar {
    padding: 8px 16px;
    gap: 8px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .sort-bar::-webkit-scrollbar {
    display: none;
  }

  .sort-btn {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 40px;
  }

  /* Search bar */
  .list-search-wrap {
    padding: 8px 16px 12px;
    flex-shrink: 0;
  }

  .list-search {
    padding: 12px 14px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  /* === RESTAURANT LIST - SCROLLABLE === */
  .restaurant-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 0 0 16px 0;
    /* Ensure it takes remaining space */
    min-height: 0;
  }

  /* Restaurant cards - touch optimized */
  .restaurant-card {
    padding: 14px 16px;
    gap: 12px;
    min-height: 72px;
    border-bottom: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
  }

  .restaurant-card:active {
    background: var(--surface2);
  }

  .rank-badge {
    width: 40px;
    height: 40px;
    font-size: 14px;
    flex-shrink: 0;
  }

  .card-thumbnail,
  .card-thumbnail-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    flex-shrink: 0;
  }

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

  .card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
  }

  .card-meta {
    font-size: 12px;
  }

  /* Vote button - larger touch target */
  .vote-btn {
    min-width: 48px;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .vote-btn svg {
    width: 18px;
    height: 18px;
  }

  .vote-count {
    font-size: 14px;
  }

  /* Map button - larger touch target */
  .card-map-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    font-size: 16px;
    flex-shrink: 0;
  }

  /* === MAP PANE (Hidden by default on mobile) === */
  .map-pane {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  /* Map header compact */
  .map-header {
    padding: 10px 16px;
    flex-shrink: 0;
  }

  .map-header h1 {
    font-size: 15px;
  }

  .map-header p {
    font-size: 12px;
    margin-top: 2px;
  }

  /* Map container */
  #map {
    flex: 1;
    min-height: 0 !important;
    height: 100% !important;
    width: 100%;
  }

  /* === MAP VIEW ACTIVE STATE === */
  body.view-map .sidebar {
    display: none !important;
  }

  body.view-map .map-pane {
    display: flex !important;
    flex: 1;
  }

  /* === MODALS - Bottom Sheet Style === */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 20px 20px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUpMobile 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* Drag handle indicator for bottom sheet */
  .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  .suggestions-modal {
    width: 100%;
    max-width: 100%;
  }

  @keyframes slideUpMobile {
    from { 
      transform: translateY(100%);
      opacity: 0.8;
    }
    to { 
      transform: translateY(0);
      opacity: 1;
    }
  }

  .modal-title {
    font-size: 22px;
    text-align: center;
  }

  .modal-sub {
    font-size: 13px;
    text-align: center;
    margin-bottom: 20px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
  }

  .modal-actions button {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    border-radius: 12px;
    min-height: 52px;
  }

  .btn-submit {
    order: -1; /* Primary action first */
  }

  /* Form inputs - prevent iOS zoom */
  .form-input,
  .form-select,
  .form-textarea {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  .form-label {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .form-note {
    font-size: 12px;
    margin-top: 6px;
  }

  /* Choice items touch-friendly */
  .choice-item {
    padding: 14px 16px;
    min-height: 48px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* === TOAST NOTIFICATIONS === */
  #toast-container {
    top: auto;
    bottom: calc(72px + env(safe-area-inset-bottom, 0));
    left: 16px;
    right: 16px;
    transform: none;
  }

  .toast {
    padding: 14px 20px;
    font-size: 14px;
    border-radius: 12px;
  }

  /* === MAP PROMPT === */
  .map-prompt {
    bottom: calc(72px + env(safe-area-inset-bottom, 0));
    left: 16px;
    right: 16px;
    font-size: 14px;
    padding: 12px 20px;
    border-radius: 12px;
  }

  /* === MARKER TOOLTIP - Mobile optimized === */
  .marker-tooltip {
    max-width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px;
    width: auto !important;
  }

  /* === EMPTY STATE === */
  .empty-state {
    padding: 40px 24px;
  }

  .empty-state .empty-icon {
    font-size: 56px;
  }

  .empty-state h3 {
    font-size: 20px;
  }

  .empty-state p {
    font-size: 14px;
  }
}

/* ==========================================================================
   SMALL PHONE BREAKPOINT (max-width: 380px)
   ========================================================================== */

@media (max-width: 380px) {
  header {
    padding: 0 10px;
    height: 48px;
  }

  .logo {
    font-size: 16px;
  }

  .city-switcher {
    padding: 6px 10px;
    font-size: 12px;
  }

  .add-btn {
    padding: 8px 10px;
    min-width: 40px;
    min-height: 40px;
  }

  .add-btn svg {
    width: 18px;
    height: 18px;
  }

  .main {
    height: calc(100dvh - 48px - 60px);
    height: calc(100% - 48px - 60px);
  }

  .mobile-nav {
    padding: 6px 12px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
  }

  .mobile-nav-btn {
    font-size: 10px;
    padding: 6px 4px;
    min-height: 44px;
  }

  .mobile-nav-btn svg {
    width: 22px;
    height: 22px;
  }

  .sidebar-header {
    padding: 10px 14px 6px;
  }

  .sidebar-title {
    font-size: 18px;
  }

  .filter-control {
    padding: 8px 14px;
  }

  .sort-bar {
    padding: 6px 14px;
  }

  .sort-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .list-search-wrap {
    padding: 6px 14px 10px;
  }

  .restaurant-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .rank-badge {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .card-thumbnail,
  .card-thumbnail-placeholder {
    width: 48px;
    height: 48px;
  }

  .card-name {
    font-size: 14px;
  }

  .vote-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 6px 10px;
  }

  .card-map-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .modal {
    padding: 16px 16px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-actions button {
    padding: 14px;
    min-height: 48px;
  }
}

.pac-container:after {
  background-image: none !important;
  height: 0 !important;
}

.pac-item {
  background-color: var(--surface) !important;
  border-top: 1px solid var(--border) !important;
  padding: 10px 14px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  color: var(--text) !important;
  line-height: 1.4 !important;
}

.pac-item:first-child {
  border-top: none !important;
}

.pac-item:hover {
  background-color: var(--surface2) !important;
}

.pac-item-selected {
  background-color: var(--surface2) !important;
}

.pac-item-query {
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.pac-matched {
  color: var(--accent) !important;
  font-weight: 600 !important;
}

.pac-icon {
  display: none !important;
}

.pac-item span {
  color: var(--muted) !important;
  font-size: 12px !important;
}

/* Scrollbar for autocomplete */
.pac-container::-webkit-scrollbar { 
  width: 4px !important;
}
.pac-container::-webkit-scrollbar-track { 
  background: transparent !important;
}
.pac-container::-webkit-scrollbar-thumb { 
  background: var(--border) !important;
  border-radius: 2px !important;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: toast-in 0.3s ease-out;
  pointer-events: auto;
  max-width: 90vw;
  text-align: center;
}

.toast.success {
  background: var(--accent2);
  color: #fff;
}

.toast.error {
  background: #e74c3c;
  color: #fff;
}

.toast.fade-out {
  animation: toast-out 0.3s ease-in forwards;
}

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

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