:root {
  --ink: #262220;
  --moss: #4a5d3a;
  --moss-light: #5f7a4c;
  --brass: #d9a441;
  --brass-light: #e6bd6f;
  --copper: #c1591a;
  --parchment: #f2e8d5;
  --parchment-dim: #e1d2b3;
  --white: #fbf8f2;
  --danger: #b03a2e;

  --font-display: "Bitter", Georgia, serif;
  --font-body: "Karla", -apple-system, sans-serif;

  --radius: 10px;
  --shadow: 0 4px 16px rgba(38, 34, 32, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--parchment);
}

button, input, textarea {
  font-family: inherit;
}

.topbar {
  height: 60px;
  background: var(--moss);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: relative;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.brand-mark {
  color: var(--brass-light);
  font-size: 1.4rem;
}
.brand-name-short {
  display: none;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-area img.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--brass-light);
}

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

.btn-topbar-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--copper);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(38, 34, 32, 0.2);
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-topbar-add::before {
  content: "+";
  font-size: 1.05rem;
  line-height: 1;
}
.btn-topbar-add:hover { background: #8f4f27; }
.btn-topbar-add:active { transform: scale(0.97); }

.welcome-list {
  text-align: left;
  padding-left: 20px;
  margin: 0 0 18px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.welcome-list li { margin-bottom: 7px; }

.auth-area .user-name {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--parchment);
  padding: 3px 10px;
  border-radius: 999px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  color: inherit;
}
.user-chip:hover {
  background: var(--moss-light);
}

.notif-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--white);
  vertical-align: middle;
}
.notif-dot.hidden { display: none; }

.btn-google {
  background: var(--brass);
  color: var(--ink);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.btn-google:hover { background: var(--brass-light); }

.btn-logout {
  background: transparent;
  color: var(--parchment-dim);
  border: 1px solid var(--moss-light);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
}
.btn-logout:hover { color: var(--white); border-color: var(--brass-light); }

main {
  position: relative;
  height: calc(100% - 60px);
  width: 100%;
}

#map {
  height: 100%;
  width: 100%;
  background: var(--parchment-dim);
}

/* custom leaflet popup look */
.leaflet-popup-content-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.popup-card {
  min-width: 200px;
  max-width: 240px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.popup-card img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 8px;
  display: block;
  max-height: 150px;
  object-fit: cover;
}
.popup-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.popup-card .meta {
  font-size: 0.75rem;
  color: #6b6355;
  margin-bottom: 6px;
}
.popup-card .log-meta {
  font-size: 0.68rem;
  font-style: italic;
  opacity: 0.85;
}
.popup-card p { font-size: 0.85rem; margin: 0 0 6px; line-height: 1.4; }
.popup-desc { word-break: break-word; }
.desc-full.hidden, .desc-short.hidden { display: none; }
.desc-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: var(--copper);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.desc-toggle:hover { color: #8f4f27; }
.popup-gallery-wrap {
  position: relative;
  margin-bottom: 6px;
}
.popup-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 8px;
  scrollbar-width: none;
}
.popup-gallery::-webkit-scrollbar { display: none; }
.popup-gallery img {
  width: 100%;
  flex: 0 0 100%;
  scroll-snap-align: start;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 27, 24, 0.55);
  color: var(--white);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.popup-gallery-wrap:hover .gallery-nav { opacity: 1; }
.gallery-nav.prev { left: 6px; }
.gallery-nav.next { right: 6px; }

.gallery-expand {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: rgba(28, 27, 24, 0.55);
  color: var(--white);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.lightbox-overlay.hidden { display: none; }
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: none;
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 1.6rem;
  cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }
.lightbox-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--white);
  font-size: 0.85rem;
  opacity: 0.8;
}
.popup-gallery-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
}
.popup-gallery-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--parchment-dim);
  transition: background 0.15s ease;
}
.popup-gallery-dots span.active {
  background: var(--copper);
}
.category-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.category-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.popup-card .popup-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.share-link {
  font-size: 0.75rem;
  color: var(--moss);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
}
.popup-owner-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.popup-card .edit-link {
  font-size: 0.75rem;
  color: var(--copper);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
}
.popup-card .delete-link {
  font-size: 0.75rem;
  color: var(--danger);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.popup-comments {
  margin-top: 8px;
  border-top: 1px solid var(--parchment-dim);
  padding-top: 8px;
}
.comments-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--moss);
  cursor: pointer;
}
.comments-toggle:hover { color: var(--copper); }

.comments-panel {
  margin-top: 8px;
}
.comments-panel.hidden { display: none; }

.comments-list {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.comments-empty, .comments-loading {
  font-size: 0.78rem;
  margin: 4px 0;
}

.comment-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--parchment-dim);
}
.comment-item:last-child { border-bottom: none; }
.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
}
.comment-author {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-underline-offset: 2px;
}
.comment-author:hover { opacity: 0.8; }
.comment-author-badge {
  display: inline-block;
  background: var(--brass);
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
}
.comment-time {
  font-size: 0.68rem;
  color: #6b6355;
  flex-basis: 100%;
  order: 3;
}
.comment-delete {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin-left: auto;
}
.comment-body {
  font-size: 0.82rem;
  margin: 2px 0 0;
  line-height: 1.4;
  word-break: break-word;
}

.comment-form {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.comment-input {
  flex: 1;
  resize: vertical;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.8rem;
  background: var(--parchment);
  color: var(--ink);
}
.comment-input:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}
.comment-submit {
  background: var(--copper);
  color: var(--white);
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.comment-submit:hover { background: #8f4f27; }
.comment-submit:disabled { opacity: 0.6; cursor: default; }

.comment-signin-hint {
  font-size: 0.78rem;
  margin: 4px 0 0;
}

/* find target marker */
.find-marker {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  background: var(--copper);
  border: 2px solid var(--white);
  transform: rotate(-45deg);
  box-shadow: var(--shadow);
}

.fab {
  position: absolute;
  bottom: 26px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--copper);
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 900;
}
.fab:hover { background: #8f4f27; }

.locate-btn {
  position: absolute;
  bottom: 92px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 900;
}
.locate-btn:hover { background: var(--parchment); }

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 900;
}

.filter-btn {
  background: var(--white);
  color: var(--ink);
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.filter-btn:hover { background: var(--parchment); }
.filter-btn.has-active {
  background: var(--copper);
  color: var(--white);
}

.beaches-btn {
  background: var(--white);
  color: var(--ink);
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.beaches-btn:hover { background: var(--parchment); }
.beaches-btn:disabled { opacity: 0.7; cursor: default; }
.beaches-btn.has-active {
  background: var(--brass);
  color: var(--ink);
}

.beach-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--brass);
  border: 2px solid var(--white);
  transform: rotate(-45deg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.beach-pin > * { transform: rotate(45deg); }

.leaflet-tooltip.beach-label {
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.leaflet-tooltip.beach-label::before {
  border-top-color: var(--ink);
}

.beach-popup {
  min-width: 200px;
  max-width: 240px;
}
.beach-popup-label {
  display: inline-block;
  background: var(--brass);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.beach-popup h4 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1rem;
}
.beach-no-historic {
  font-size: 0.8rem;
  margin: 4px 0 0;
}
.beach-historic-list {
  margin-top: 6px;
  border-top: 1px solid var(--parchment-dim);
  padding-top: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.beach-historic-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--parchment-dim);
}
.beach-historic-item:last-child { border-bottom: none; }
.beach-historic-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.3;
}
.beach-historic-text {
  font-size: 0.8rem;
  line-height: 1.4;
}
.beach-historic-text strong {
  color: var(--moss);
}
.beach-historic-text p {
  margin: 2px 0 0;
  font-size: 0.78rem;
}

/* Recolor Leaflet.markercluster's default bubbles to match the app's
   earthy palette instead of the plugin's default green/yellow/orange. */
.marker-cluster-small {
  background-color: rgba(95, 122, 76, 0.5); /* moss-light */
}
.marker-cluster-small div {
  background-color: rgba(74, 93, 58, 0.8); /* moss */
}
.marker-cluster-medium {
  background-color: rgba(217, 164, 65, 0.5); /* brass */
}
.marker-cluster-medium div {
  background-color: rgba(193, 89, 26, 0.8); /* copper */
}
.marker-cluster-large {
  background-color: rgba(193, 89, 26, 0.45); /* copper */
}
.marker-cluster-large div {
  background-color: rgba(176, 58, 46, 0.85); /* danger/rust */
}
.marker-cluster span {
  color: var(--white);
  font-weight: 700;
  font-family: var(--font-body);
}

.user-location-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2f6690;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px rgba(47, 102, 144, 0.35), var(--shadow);
  position: relative;
}
.user-location-dot::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: rgba(47, 102, 144, 0.25);
  animation: user-location-pulse 2s ease-out infinite;
}
@keyframes user-location-pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.filter-panel {
  position: absolute;
  top: 60px;
  left: 16px;
  width: 260px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  z-index: 900;
}
.filter-panel.hidden { display: none; }

.filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.filter-panel-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0;
}
.filter-summary {
  font-size: 0.75rem;
  margin-bottom: 8px;
}
.filter-group {
  margin-top: 10px;
}
.filter-group h4 {
  margin: 0 0 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--moss);
}
.filter-group .category-chips {
  margin-top: 0;
}
.filter-group .category-chip {
  opacity: 0.45;
  border: none;
  padding: 5px 10px;
  font-size: 0.72rem;
}
.filter-group .category-chip.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--ink) inset;
}

.filter-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--parchment-dim);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  opacity: 0.55;
}
.filter-user-chip.active {
  opacity: 1;
  border-color: var(--ink);
}
.filter-user-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.filter-date-preset {
  background: var(--parchment);
  color: var(--ink);
  border: 1px solid var(--parchment-dim);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.filter-date-preset:hover { border-color: var(--brass); }
.filter-date-preset.active {
  background: var(--copper);
  color: var(--white);
  border-color: var(--copper);
}
.filter-date-custom {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.82rem;
  background: var(--parchment);
  color: var(--ink);
}
.filter-date-custom:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: var(--white);
  box-shadow: -4px 0 16px rgba(28,27,24,0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 950;
  display: flex;
  flex-direction: column;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--parchment-dim);
}
.sidebar-header h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.15rem;
}

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

.btn-sidebar-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--parchment);
  color: var(--moss);
  border: 1px solid var(--brass);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-sidebar-add::before {
  content: "+";
  font-size: 0.95rem;
  line-height: 1;
  color: var(--copper);
}
.btn-sidebar-add:hover {
  background: var(--brass);
  color: var(--ink);
}
.btn-sidebar-add:hover::before { color: var(--ink); }

.finds-list {
  overflow-y: auto;
  padding: 10px 14px;
  flex: 1;
}

.find-item {
  display: flex;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--parchment-dim);
  cursor: pointer;
}
.find-item.filtered-out { display: none; }
.find-item:hover { background: var(--parchment); }
.find-item img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--parchment-dim);
}
.find-item .info h4 {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-family: var(--font-display);
}
.find-item .info p {
  margin: 0;
  font-size: 0.75rem;
  color: #6b6355;
}

.sidebar-tab {
  position: absolute;
  top: 16px;
  right: 0;
  background: var(--moss);
  color: var(--white);
  border: none;
  padding: 8px 14px;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  z-index: 900;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 22px 24px 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow);
}
.modal-narrow { max-width: 340px; text-align: center; }
.modal-forum { max-width: 560px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.3rem;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover {
  background: var(--parchment-dim);
  color: var(--danger);
}

/* .help-btn also carries .icon-btn for base button reset, but needs its
   own compact circular size — this compound selector outranks the plain
   .icon-btn rule above regardless of source order. */
.help-btn.icon-btn {
  width: 28px;
  height: 28px;
  font-size: 0.95rem;
  color: var(--white);
  border: 1px solid var(--moss-light);
  background: none;
}
.help-btn.icon-btn:hover {
  color: var(--brass-light);
  border-color: var(--brass-light);
  background: none;
}

#find-form label,
#find-form .form-field {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--moss);
}
.photo-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.photo-input-btn {
  flex: 1 1 120px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--parchment-dim);
  background: var(--parchment);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.photo-input-btn:hover { border-color: var(--brass); }

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.photo-preview-item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--parchment-dim);
}
.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 27, 24, 0.7);
  color: var(--white);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.label-hint {
  font-weight: 400;
  font-size: 0.72rem;
  color: #6b6355;
  text-transform: none;
}
.existing-photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 10px;
}
.existing-photo-item {
  position: relative;
  width: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--parchment-dim);
}
.existing-photo-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}
.existing-photo-controls {
  display: flex;
  justify-content: center;
  gap: 2px;
  background: rgba(28, 27, 24, 0.65);
  padding: 3px 0;
}
.existing-photo-controls button {
  background: none;
  border: none;
  color: var(--white);
  font-size: 0.8rem;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
  border-radius: 4px;
}
.existing-photo-controls button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}
.existing-photo-controls button:disabled {
  opacity: 0.3;
  cursor: default;
}
.existing-photo-controls .existing-photo-remove {
  color: #ff9a8a;
}
#find-form input,
#find-form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--parchment);
  color: var(--ink);
}
#find-form textarea { resize: vertical; }
#find-form input:focus,
#find-form textarea:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

/* the general "#find-form input" rule above sets display:block on every
   input, which overrides these two file inputs' [hidden] attribute — they
   should never be visible, since "Choose files" / "Take a picture" are
   what trigger them via .click() in JS */
#find-form input#f-photo,
#find-form input#f-photo-camera {
  display: none;
}

#find-form select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 34px 9px 10px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.9rem;
  background-color: var(--parchment);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%234a5d3a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
#find-form select:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}
#find-form select:hover {
  border-color: var(--brass);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.category-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--parchment-dim);
  background: var(--parchment);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.category-chip:hover {
  border-color: var(--brass);
}
.category-chip.active {
  background: var(--copper);
  color: var(--white);
  border-color: var(--copper);
}

.location-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.loc-mode-btn {
  flex: 1 1 130px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--parchment-dim);
  background: var(--parchment);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.loc-mode-btn.active {
  background: var(--copper);
  color: var(--white);
  border-color: var(--copper);
}

.pick-location-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  z-index: 1500;
}
.pick-location-banner.hidden { display: none; }
.pick-location-banner .link-btn { color: var(--brass-light); }

.location-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #6b6355;
  margin-bottom: 16px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--copper);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
}
#profile-activity-all, #profile-finds-all, #profile-export-pdf {
  display: block;
  margin-top: 6px;
}
#profile-export-pdf:disabled {
  opacity: 0.6;
  cursor: default;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  flex: 1 1 auto;
  min-width: 0;
}

.btn-primary, .btn-secondary {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary { background: var(--copper); color: var(--white); }
.btn-primary:hover { background: #8f4f27; }
.btn-secondary { background: var(--parchment-dim); color: var(--ink); }
.btn-secondary:hover { background: #cfc4a9; }
.btn-block { display: block; width: 100%; margin-top: 10px; }

.muted { color: #6b6355; font-size: 0.85rem; }

/* profile modal */
.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.profile-header img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--brass-light);
  object-fit: cover;
}
.profile-header .joined {
  font-size: 0.78rem;
  color: #6b6355;
}

.profile-section {
  margin-bottom: 18px;
}
.profile-section h4 {
  margin: 0 0 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--moss);
}
.profile-section p {
  margin: 0;
  font-size: 0.9rem;
}

.equipment-edit {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.equipment-edit input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--parchment);
}
.equipment-edit button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--copper);
  color: var(--white);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.profile-finds-count {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--copper);
}

.profile-mini-map {
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--parchment-dim);
}

.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--parchment-dim);
  cursor: pointer;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--parchment); }
.activity-find-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--moss);
}
.activity-body {
  font-size: 0.85rem;
  margin: 2px 0;
  line-height: 1.4;
  word-break: break-word;
}
.activity-time {
  font-size: 0.68rem;
  color: #6b6355;
}

.name-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-underline-offset: 2px;
}
.name-link:hover { opacity: 0.8; }

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--parchment-dim);
  cursor: pointer;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--parchment); }
.leaderboard-rank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--moss);
  width: 28px;
  flex-shrink: 0;
}
.leaderboard-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.leaderboard-name {
  font-weight: 700;
  flex: 1;
}
.leaderboard-stats {
  font-size: 0.78rem;
  color: #6b6355;
  white-space: nowrap;
}


@media (max-width: 480px) {
  .brand-name { display: none; }
  .brand-name-short { display: inline; }
  .fab { bottom: 18px; right: 14px; }
  .locate-btn { bottom: 78px; right: 16px; }
  /* the floating + button already covers this on small screens */
  .btn-topbar-add { display: none; }

  .modal-backdrop { padding: 10px; }
  .modal { padding: 18px 16px 18px; }
}

/* ---------- forum ---------- */

.forum-list-header {
  margin-bottom: 12px;
}

.forum-topic-item {
  padding: 12px 8px;
  border-bottom: 1px solid var(--parchment-dim);
  cursor: pointer;
}
.forum-topic-item:hover { background: var(--parchment); }
.forum-topic-item:last-child { border-bottom: none; }
.forum-topic-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}
.forum-topic-meta {
  font-size: 0.78rem;
  color: #6b6355;
}

.forum-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--moss);
}
.forum-field-label input,
.forum-field-label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--parchment);
  color: var(--ink);
}
.forum-field-label textarea { resize: vertical; }
.forum-field-label input:focus,
.forum-field-label textarea:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.forum-topic-heading {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 10px 0 14px;
}

.forum-post {
  padding: 12px 0;
  border-bottom: 1px solid var(--parchment-dim);
}
.forum-post:last-child { border-bottom: none; }
.forum-post-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.forum-post-author {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-underline-offset: 2px;
}
.forum-post-author:hover { opacity: 0.8; }
.forum-post-time {
  font-size: 0.72rem;
  color: #6b6355;
}
.forum-post-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.forum-post-body {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.forum-post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.forum-post-images img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  background: var(--parchment-dim);
}

.forum-reply-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--parchment-dim);
}
.forum-reply-form textarea {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--parchment);
  color: var(--ink);
  resize: vertical;
  margin-bottom: 10px;
}
.forum-reply-form textarea:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}
.forum-reply-form .btn-primary {
  margin-top: 10px;
}

/* ---------- expeditions ---------- */

.expedition-status-chip {
  background: var(--brass);
  color: var(--ink);
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.expedition-status-chip.hidden { display: none; }
.expedition-status-chip:hover { background: var(--brass-light); }

.expedition-list-header {
  margin-bottom: 16px;
}
.expedition-new-form {
  display: flex;
  gap: 8px;
}
.expedition-new-form input {
  flex: 1;
  padding: 9px 10px;
  border: 1px solid var(--parchment-dim);
  border-radius: 8px;
  font-size: 0.88rem;
  background: var(--parchment);
  color: var(--ink);
}
.expedition-new-form input:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.expedition-section-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--moss);
  margin: 18px 0 8px;
}

.expedition-item {
  padding: 10px 8px;
  border-bottom: 1px solid var(--parchment-dim);
  cursor: pointer;
}
.expedition-item:hover { background: var(--parchment); }
.expedition-item:last-child { border-bottom: none; }
.expedition-item-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.expedition-item-meta {
  font-size: 0.78rem;
  color: #6b6355;
  margin-top: 2px;
}

.expedition-active-badge {
  display: inline-block;
  background: var(--moss);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
}

.expedition-detail-header h3 {
  font-family: var(--font-display);
  margin: 0 0 4px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expedition-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0 6px;
  flex-wrap: wrap;
}

.expedition-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.expedition-participant-chip {
  background: var(--parchment);
  border: 1px solid var(--parchment-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.expedition-participant-chip:hover { border-color: var(--brass); }

.expedition-find-badge {
  display: inline-block;
  background: var(--brass);
  color: var(--ink);
  border: none;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 6px;
}
.expedition-find-badge:hover { background: var(--brass-light); }

.expedition-avatar-stack {
  display: flex;
  margin-top: 8px;
}
.expedition-avatar-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--white);
  padding: 0;
  margin-left: -8px;
  cursor: pointer;
  overflow: hidden;
  background: var(--parchment-dim);
  flex-shrink: 0;
}
.expedition-avatar-btn:first-child { margin-left: 0; }
.expedition-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.expedition-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
}

.expedition-delete-link {
  color: var(--danger);
}