:root {
  --bg: #0c1117;
  --panel: #131b24;
  --card: #19222d;
  --elev: #212c38;
  --text: #e7edf3;
  --muted: #93a1b2;
  --accent: #2ec3a6;
  --accent-ink: #06231d;
  --accent-2: #efb23c;
  --border: #253341;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 12px 34px rgba(0, 0, 0, 0.5);
  --ring: 0 0 0 3px rgba(46, 195, 166, 0.32);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
}

/* ---- Icon system (inline SVG glyphs) ---- */
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.h-ico { color: var(--accent); }
.h-ico .ico { width: 20px; height: 20px; }

button {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, filter 0.15s ease;
}
:focus-visible { outline: none; box-shadow: var(--ring); }

body {
  margin: 0;
  position: relative;
  overflow: hidden;
  height: 100vh; /* fallback for old browsers */
  height: 100dvh; /* dynamic viewport */
  height: var(--app-h, 100dvh); /* JS sets --app-h = innerHeight — reliable on foldables/iOS */
}

/* ---- Collapsible left nav column (map stays the hero) ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  width: 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 10px 10px
    calc(env(safe-area-inset-left) + 10px);
  background: rgba(12, 17, 23, 0.9);
  backdrop-filter: saturate(140%) blur(12px);
  border-right: 1px solid var(--border);
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.sidebar.open {
  width: min(300px, 88vw);
  overflow: visible;
  box-shadow: var(--shadow-2);
}

.nav-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.nav-toggle {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); cursor: pointer;
}
.nav-toggle .ico { width: 20px; height: 20px; }
.nav-toggle:hover { border-color: var(--accent); background: var(--elev); }

.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; white-space: nowrap; }
.brand span { color: var(--accent); }
.sidebar:not(.open) .brand { display: none; }

.search { display: flex; gap: 6px; position: relative; }
.search input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.sidebar:not(.open) .search input { display: none; }
.search button, #review-form button[type="submit"] {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  padding: 9px 14px;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}
.search button:hover, #review-form button[type="submit"]:hover { filter: brightness(1.06); }
.search-go {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
}
.search-go .ico { width: 18px; height: 18px; }

.nav-actions { display: flex; flex-direction: column; gap: 6px; }
.nav-spacer { flex: 1 1 auto; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.icon-btn .ico { width: 19px; height: 19px; flex: 0 0 auto; color: var(--muted); transition: color 0.15s ease; }
.icon-btn:hover { border-color: var(--accent); background: var(--elev); }
.icon-btn:hover .ico { color: var(--accent); }
.icon-btn.hidden { display: none; }
.sidebar:not(.open) .icon-btn { justify-content: center; padding: 9px; }
.sidebar:not(.open) .nav-label { display: none; }

.nav-account { display: none; }
.sidebar:not(.open) .nav-account { display: inline-flex; }

.auth { display: flex; flex-direction: column; align-items: stretch; gap: 6px; font-size: 14px; }
.sidebar:not(.open) .auth { display: none; }
.auth button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}
.auth button:hover { border-color: var(--accent); background: var(--elev); }
.auth .who { color: var(--muted); }
.auth .who-btn { display: flex; align-items: center; gap: 8px; }
.auth .google-btn {
  background: #fff;
  color: #1f2328;
  border: 0;
  font-weight: 700;
  text-align: center;
}
.auth .google-btn:hover { filter: brightness(0.96); }


/* ---- Search autocomplete ---- */
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 34px;
  list-style: none; margin: 0; padding: 4px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  max-height: 320px; overflow: auto; z-index: 20;
}
/* In the nav column let results overflow the column so they stay readable. */
.sidebar .search-results { right: auto; width: min(320px, 78vw); }
.search-results.hidden { display: none; }
.search-results li {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.search-results li:hover { background: var(--card); }
.search-results .sr-main { color: var(--text); font-weight: 600; font-size: 14px; }
.search-results .sr-sub { color: var(--muted); font-size: 12px; }
.search-results .empty { color: var(--muted); cursor: default; }
.search-results .empty:hover { background: transparent; }

/* ---- Basemap switcher ---- */
.basemap-switch { position: absolute; top: 12px; right: 12px; z-index: 5; }
.basemap-switch select {
  background: rgba(15, 23, 32, 0.92); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.basemap-switch select:hover { border-color: var(--accent); }

/* ---- Leaderboard modal ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 22px;
}
.modal-card h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 9px; font-size: 20px; letter-spacing: -0.02em; }
.modal-sub { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.leaderboard-count { margin: 0 0 12px; color: var(--accent); font-weight: 700; font-size: 13px; }
.leaderboard-list { list-style: none; margin: 0; padding: 0; }
.lb-row {
  display: grid;
  grid-template-columns: 28px 32px 1fr auto;
  grid-template-areas: "rank avatar name points" "rank avatar stats points";
  align-items: center;
  gap: 2px 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.lb-row:hover { background: var(--card); }
.lb-row:last-child { border-bottom: 0; }
.lb-rank { grid-area: rank; font-weight: 800; color: var(--accent-2); text-align: center; }
.lb-avatar { grid-area: avatar; }
.lb-name { grid-area: name; font-weight: 700; }
.lb-stats { grid-area: stats; color: var(--muted); font-size: 12px; }
.lb-points { grid-area: points; font-weight: 800; color: var(--accent); white-space: nowrap; }
.leaderboard-list .empty { color: var(--muted); padding: 12px 4px; }

/* ---- Avatars ---- */
.avatar, .auth-avatar, .lb-avatar, .profile-avatar, .ep-avatar-img {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover; background: var(--card); overflow: hidden;
  font-weight: 700; color: var(--text);
}
.auth-avatar { width: 24px; height: 24px; font-size: 12px; }
.lb-avatar { width: 30px; height: 30px; font-size: 13px; }
.profile-avatar { width: 64px; height: 64px; font-size: 26px; }
.ep-avatar-img { width: 56px; height: 56px; font-size: 24px; }
.avatar-fallback { background: var(--accent); color: #06231d; }

/* ---- Edit-profile avatar preview ---- */
.ep-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.ep-name-preview { font-weight: 700; font-size: 15px; color: var(--text); }
.photo-hint { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

/* ---- Auth "me" button (avatar + name) ---- */
.who-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer;
}
.who-btn:hover { border-color: var(--accent); }

/* ---- Profile modal ---- */
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.profile-id h2 { margin: 0; }
.profile-location { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.profile-bio { color: var(--text); font-size: 14px; margin: 8px 0 12px; white-space: pre-wrap; }
.profile-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.profile-stats span { color: var(--text); font-weight: 600; }

/* Clickable review author + place links */
.user-link, .place-link {
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer; font: inherit;
  color: var(--accent); font-weight: 600;
}
.user-link:hover, .place-link:hover { text-decoration: underline; }
.place-link { color: var(--accent-2); }

/* Edit-profile form reuses review-form field styling */
#editprofile-form { display: flex; flex-direction: column; gap: 10px; }
#editprofile-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
#editprofile-form input, #editprofile-form textarea {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 8px; outline: none; font: inherit;
}
#editprofile-form textarea { min-height: 72px; resize: vertical; }
#editprofile-form button[type="submit"] {
  background: var(--accent); color: #06231d; border: 0; padding: 9px 14px;
  border-radius: 8px; font-weight: 700; cursor: pointer;
}

main { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; }

.panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 40;
  width: min(420px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  padding: 20px;
  overflow-y: auto;
  animation: panelIn 0.2s ease;
}
/* display:none (not an off-screen transform) so it is reliably hidden on every
   browser — an Android transform quirk was leaving the empty panel visible. */
.panel.hidden { display: none; }
@keyframes panelIn {
  from { transform: translateX(16px); opacity: 0.35; }
  to { transform: none; opacity: 1; }
}

.panel-close {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent; border: 0; border-radius: 50%; color: var(--muted);
  font-size: 24px; line-height: 1; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.panel-close:hover { background: var(--elev); color: var(--text); }

.panel h2 { margin: 0 30px 4px 0; font-size: 22px; }
.place-meta { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.score-summary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; row-gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; margin-bottom: 18px;
  box-shadow: var(--shadow-1);
}
.avg-score { font-size: 34px; font-weight: 800; color: var(--accent-2); min-width: 56px; text-align: center; }
.score-label { color: var(--muted); font-size: 13px; line-height: 1.4; white-space: nowrap; }
.score-label span { color: var(--text); }

h3 { font-size: 15px; margin: 18px 0 8px; }

.reviews-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; }
.reviews-head h3 { margin: 0; }
.add-review-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--accent); color: var(--accent);
  padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.add-review-btn .ico { width: 14px; height: 14px; }
.add-review-btn:hover { background: var(--accent); color: var(--accent-ink); }
.add-review { margin: 12px 0 4px; }
.add-review.hidden { display: none; }

#review-form { display: flex; flex-direction: column; gap: 8px; }
#review-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
#review-form select, #review-form input, #review-form textarea {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 8px; outline: none; font: inherit;
}
#review-form textarea { min-height: 72px; resize: vertical; }
.status { font-size: 13px; color: var(--muted); min-height: 16px; margin: 4px 0 0; }

.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.review-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
}
.review-item .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.review-item .rating { color: var(--accent-2); font-weight: 800; }
.review-item .title { font-weight: 600; margin: 4px 0; }
.review-item .body { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.review-item .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.review-photo {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.photo-label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0; }
.photo-label input { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; max-width: 100%; }
/* Make the native file picker match the dark theme instead of a white button */
input[type="file"]::file-selector-button {
  margin-right: 10px;
  background: var(--elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); background: var(--card); }

/* ---- Landmark autocomplete ---- */
.landmarks-field { position: relative; }
.landmarks-field > label { display: block; font-size: 13px; color: var(--muted); margin: 4px 0; }
.landmark-results {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  position: absolute;
  left: 0; right: 0;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow: auto;
}
.landmark-results.hidden { display: none; }
.landmark-results li {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.landmark-results li:last-child { border-bottom: 0; }
.landmark-results li:hover { background: var(--panel); }
.landmark-results li.empty { color: var(--muted); cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
}
.chip button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.chip button:hover { color: var(--text); }
.review-landmarks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.landmark-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-family: inherit;
}
.landmark-tag .ico { width: 13px; height: 13px; }
button.landmark-tag { cursor: pointer; color: var(--accent); }
button.landmark-tag:hover { border-color: var(--accent); background: var(--panel); }

/* ---- My reviews ---- */
.myreviews-list { list-style: none; margin: 0; padding: 0; }
.mr-row { border-bottom: 1px solid var(--border); padding: 12px 4px; }
.mr-row:last-child { border-bottom: 0; }
.mr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mr-place { font-weight: 700; }
.mr-actions { display: flex; gap: 8px; margin-top: 8px; }
.mr-actions button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.mr-actions .mr-delete:hover { border-color: #e5534b; color: #e5534b; }
.mr-actions .mr-save { border-color: var(--accent); color: var(--accent); }
.mr-row select, .mr-row input, .mr-row textarea {
  width: 100%;
  margin: 6px 0;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
.mr-row textarea { min-height: 70px; resize: vertical; }
.myreviews-list .empty { color: var(--muted); padding: 12px 4px; }

.empty { color: var(--muted); font-size: 14px; }

/* Rating pin for reviewed towns */
.town-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: var(--accent);
  color: #06231d;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  border-radius: 999px;
  border: 2px solid #06231d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  white-space: nowrap;
  transform: translateY(-16px);
}
.town-badge .star { display: inline-flex; align-items: center; }
.town-badge .star .ico { width: 12px; height: 12px; }
.town-badge:hover { filter: brightness(1.08); }

/* Cluster bubble for grouped reviewed towns */
.town-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  background: var(--accent);
  color: #06231d;
  font-weight: 800;
  font-size: 13px;
  border-radius: 999px;
  border: 2px solid #06231d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.town-cluster:hover { filter: brightness(1.08); }

/* ---- Share button + review sort ---- */
.score-summary { position: relative; }
.share-btn {
  margin-left: auto; align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
  white-space: nowrap;
}
.share-btn .ico { width: 15px; height: 15px; color: var(--muted); transition: color 0.15s ease; }
.share-btn:hover { border-color: var(--accent); }
.share-btn:hover .ico { color: var(--accent); }
#save-place { margin-left: 6px; }
#save-place.active { border-color: var(--accent); color: var(--accent); }
#save-place.active .ico { color: var(--accent); }

/* ---- Review actions (helpful / report) ---- */
.review-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.vote-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px;
}
.vote-btn .ico { width: 14px; height: 14px; }
.vote-btn:hover { border-color: var(--accent); color: var(--text); }
.vote-btn.voted { border-color: var(--accent); color: var(--accent); background: rgba(46,195,166,.12); }
.vote-btn .vote-n { font-weight: 700; }
.report-btn {
  margin-left: auto; display: inline-flex; align-items: center;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 4px 8px; border-radius: 999px; cursor: pointer; line-height: 1;
}
.report-btn .ico { width: 15px; height: 15px; }
.report-btn:hover { color: var(--accent-2); border-color: var(--border); }
.comment-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px;
}
.comment-toggle .ico { width: 14px; height: 14px; }
.comment-toggle:hover { border-color: var(--accent); color: var(--text); }
.comment-toggle .comment-n { font-weight: 700; }

/* ---- Comments ---- */
.comments { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.comments.hidden { display: none; }
.comments-loading, .comments-empty { color: var(--muted); font-size: 13px; margin: 4px 0; }
.comment-list { display: grid; gap: 10px; margin-bottom: 10px; }
.comment-item { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.comment-head .user-link { color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 600; }
.comment-head .comment-delete {
  margin-left: auto; background: transparent; border: 0; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px;
}
.comment-head .comment-delete:hover { color: var(--accent-2); }
.comment-body { margin-top: 4px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; flex-direction: column; gap: 6px; }
.comment-input {
  width: 100%; box-sizing: border-box; resize: vertical; background: var(--card);
  border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px; font: inherit;
}
.comment-form button {
  align-self: flex-end; background: var(--accent); color: #06231d; border: 0;
  border-radius: 8px; padding: 6px 14px; cursor: pointer; font: inherit; font-weight: 700;
}
.comment-form button:disabled { opacity: .6; cursor: default; }
.mention { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 600; }
.mention:hover { text-decoration: underline; }

/* ---- Follows ---- */
.profile-follow { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.follow-stat { color: var(--muted); font-size: 13px; }
.follow-stat strong { color: var(--text); }
.follow-btn {
  background: var(--accent); color: #06231d; border: 0; border-radius: 999px;
  padding: 6px 16px; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px;
}
.follow-btn.following { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.follow-btn:disabled { opacity: .6; cursor: default; }

/* ---- Notifications ---- */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent-2); color: #1a1200; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1; box-sizing: border-box;
}
.notif-badge.hidden { display: none; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notif-item {
  display: flex; gap: 10px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px;
}
.notif-item.unread { border-color: var(--accent); background: rgba(46,195,166,.08); }
.notif-avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; }
.notif-body { min-width: 0; flex: 1; }
.notif-text { font-size: 14px; }
.notif-place { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 600; }
.notif-excerpt { color: var(--muted); font-size: 13px; margin-top: 3px; word-break: break-word; }
.notif-time { color: var(--muted); font-size: 11px; margin-top: 4px; }


/* ---- Review tags + multi-photo gallery ---- */
.tags-field { margin: 8px 0; }
.tags-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-opt {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px;
}
.tag-opt:hover { border-color: var(--accent); color: var(--text); }
.tag-opt.on { border-color: var(--accent); color: var(--accent); background: rgba(46,195,166,.12); }
.link-btn {
  background: none; border: 0; padding: 0; margin-left: 4px;
  color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.rv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rv-tag {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 2px 9px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12px;
}
.rv-tag:hover { border-color: var(--accent); color: var(--accent); }
.review-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 8px; }
.review-gallery .review-photo { margin-top: 0; height: 100%; object-fit: cover; }
.rv-filter {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(46,195,166,.10); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px;
}
.rv-filter button {
  background: transparent; border: 0; color: var(--accent); cursor: pointer; font: inherit;
}

/* ---- Saved places ---- */
.saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.saved-place {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; color: var(--text); text-align: left; font: inherit;
}
.saved-place:hover { border-color: var(--accent); }
.saved-name { font-weight: 600; }
.saved-sub { color: var(--muted); font-size: 12px; }

/* ---- Admin moderation ---- */
.admin-report {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 10px;
}
.admin-report-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.admin-report-head .rating { color: var(--accent-2); font-weight: 800; }
.admin-report-place { font-weight: 600; }
.admin-report-head .meta { color: var(--muted); font-size: 12px; }
.admin-report .title { font-weight: 600; margin: 6px 0 2px; }
.admin-report .body { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.admin-report-reason { color: var(--accent-2); font-size: 13px; margin-top: 6px; }
.admin-report-actions { display: flex; gap: 8px; margin-top: 10px; }
.admin-report-actions button {
  border: 1px solid var(--border); background: transparent; color: var(--text);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
}
.admin-report-del:hover { border-color: #e5534b; color: #e5534b; }
.admin-report-dismiss:hover { border-color: var(--accent); }

.review-sort {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; cursor: pointer;
}

/* ---- Latest reviews feed ---- */
.latest-list { list-style: none; margin: 0; padding: 0; }
.latest-item { padding: 12px 4px; border-bottom: 1px solid var(--border); }
.latest-item:last-child { border-bottom: 0; }
.latest-top { display: flex; align-items: center; gap: 10px; }
.latest-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.latest-meta { color: var(--muted); font-size: 12px; }
.latest-place {
  margin-left: auto; background: transparent; border: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 700; white-space: nowrap;
}
.latest-place:hover { text-decoration: underline; }
.latest-item .title { font-weight: 600; margin-top: 6px; }
.latest-item .body { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---- Discover tabs (Latest / Trending / Near me) ---- */
.discover-tabs { display: flex; gap: 6px; margin: 4px 0 8px; }
.discover-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 8px 8px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
  white-space: nowrap;
}
.discover-tab .ico { width: 15px; height: 15px; }
.discover-tab:hover { border-color: var(--accent); color: var(--text); }
.discover-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(46,195,166,.12); }
.discover-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.discover-item:last-child { border-bottom: 0; }
.discover-place {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: transparent; border: 0; cursor: pointer; color: var(--text);
  font: inherit; text-align: left; min-width: 0; flex: 1;
}
.di-name { font-weight: 600; }
.discover-place:hover .di-name { color: var(--accent); }
.di-sub { color: var(--muted); font-size: 12px; }
.di-metric { color: var(--accent-2); font-weight: 700; white-space: nowrap; font-size: 13px; }

/* ---- Admin portal ---- */
.admin-card { max-width: 640px; }
.admin-body h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.admin-stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.admin-stat-value { font-size: 22px; font-weight: 800; color: var(--text); }
.admin-stat-label { font-size: 12px; color: var(--muted); }
.admin-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 120px; padding: 6px 0;
}
.admin-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; height: 100%; gap: 4px;
}
.admin-bar-fill {
  width: 100%; min-height: 2px; background: var(--accent);
  border-radius: 4px 4px 0 0;
}
.admin-bar-x { font-size: 10px; color: var(--muted); }
.admin-top { list-style: none; margin: 0; padding: 0; }
.admin-top li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 4px; border-bottom: 1px solid var(--border);
}
.admin-top li:last-child { border-bottom: 0; }
.admin-top-name { color: var(--text); }
.admin-top-n { font-weight: 700; color: var(--accent); }

@media (max-width: 640px) {
  /* Prevent iOS Safari from auto-zooming when focusing an input */
  .search input,
  #review-form input,
  #review-form textarea,
  #editprofile-form input,
  #editprofile-form textarea { font-size: 16px; }

  /* Full-screen detail panel with safe-area padding around the notch/home bar */
  .panel {
    width: 100%;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .panel-close { top: max(12px, env(safe-area-inset-top)); }
  .panel h2 { font-size: 20px; }

  /* Modals fill more of the small screen and clear the home indicator */
  .modal { padding: 10px; align-items: flex-end; }
  .modal-card {
    max-width: none;
    max-height: 88vh;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-radius: 14px;
  }

  /* Keep map controls clear of the notch/edges */
  .basemap-switch { top: 10px; right: 10px; }
  .maplibregl-ctrl-top-right { margin-top: 6px; }
}

