/* Styles for Eryri 75 Passport web app */
:root {
  --bg: #ffffff;
  --panel: #16243f;
  --text: #e8eef5;
  --muted: #a6b3c1;
  --brand: #2aa198;
  --danger: #e65f5c;
  --accent: #88c0d0;
  --success: #22c55e;  /* green */
  --amber: #f59e0b;   /* amber */
  --mobile-footer-height: 0px;
  --header-height: 60px;
}

* { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html, body {  display: flex;  flex-direction: column;  min-height: 100vh;  min-height: 100vh; height: 100%; }
html {
  background: var(--bg, #ffffff);
  position: relative;
  z-index: 0;
  scrollbar-gutter: auto;
}
body {  display: flex;  flex-direction: column;  min-height: 100vh;  min-height: 100vh;
  margin: 0;
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: transparent;
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 100vh;
  z-index: 0;
}
html::before {
  /* Fixed overlay ensures the background never scrolls on tablets */
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.75), rgba(255,255,255,0.75)),
    url('assets/Background1.jpg') top center / cover no-repeat;
  z-index: -1;
  pointer-events: none;
}
body > main,
body > .layout {
  flex: 1 0 auto;
}
body.settings-page {
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4000;
  min-height: var(--header-height);
  height: var(--header-height);
}
.app-header h1 { margin: 0; font-size: 16px; }
.app-header .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-username {
  font-size: 12px;
  color: rgba(232,238,245,0.7);
}
.brand-logo { height: 32px; width: auto; display: block; object-fit: contain; }
.brand-picture { display: inline-flex; align-items: center; }
.header-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.header-link {
  color: #f1f5f9;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.header-link:hover,
.header-link:focus {
  color: #ffffff;
  border-color: rgba(255,255,255,0.55);
  background: transparent;
}
.header-link.is-active {
  color: #16243f;
  border-color: transparent;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.header-link.is-disabled,
.header-link.is-disabled:hover,
.header-link.is-disabled:focus {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  border-color: rgba(255,255,255,0.14);
  color: rgba(232,238,245,0.6);
  background: transparent;
}
.header-actions {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-actions .settings-link {
  display: none;
}
.account-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.account-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(232,238,245,0.8);
}
.lang-separator {
  opacity: 0.6;
}
.lang-toggle,
.lang-option {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(232,238,245,0.85);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.lang-toggle.is-active,
.lang-option.is-active {
  color: #16243f;
  background: #ffffff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.account-name {
  display: none;
}
.account-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.account-pill:focus-visible {
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}
.account-pill-caret {
  font-size: 11px;
  opacity: 0.75;
}
.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(22,36,63,0.98);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 18px 36px rgba(0,0,0,0.4);
  display: none;
  z-index: 4200;
}
.account-zone.is-open .account-dropdown {
  display: block;
}
.account-dropdown-lang {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.account-dropdown-link {
  display: block;
  text-decoration: none;
  text-align: center;
  padding: 6px 8px;
  border-radius: 8px;
  color: rgba(248,250,252,0.9);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}
.account-dropdown-link:hover,
.account-dropdown-link:focus {
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
}
.header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.header-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.header-icon:hover,
.header-icon:focus {
  border-color: rgba(255,255,255,0.55);
  color: #ffffff;
  background: transparent;
}
.header-icon:focus {
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}
.header-icon.exit-link {
  color: #f87171;
  border-color: rgba(248,113,113,0.45);
}
.header-icon.exit-link:hover,
.header-icon.exit-link:focus {
  color: #f87171;
  border-color: rgba(248,113,113,0.85);
}
.header-icon.is-disabled,
.header-icon.is-disabled:hover,
.header-icon.is-disabled:focus {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(255,255,255,0.18);
  color: rgba(248,113,113,0.45);
  background: transparent;
}
.header-status {
  display: none;
  align-items: center;
  gap: 8px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #e8eef5;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.header-status .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(34,197,94,0.18);
}
.header-status.is-offline .dot { background: var(--danger); box-shadow: 0 0 0 2px rgba(230,95,92,0.18); }
.header-status.is-offline { color: #fca5a5; }
.header-status.is-online { color: #d1fae5; }

@media (min-width: 901px) {
  .header-actions .settings-link {
    display: none;
  }
}
/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  height: calc(100vh - var(--header-height));
  flex: 1 0 auto;
}
.map-column {
  display: flex;
  flex-direction: column;
  margin: 14px;
  gap: 0;
  flex: 1 1 auto;
}
.map-shell {
  display: flex;
  flex-direction: column;
  border: 6px solid #16243f;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(12,18,30,0.9);
  flex: 1 1 auto;
}
body.map-drawer-open {
  overflow: hidden;
}
.mobile-progress-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(22,36,63,0.92);
  color: #f8fafc;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  z-index: 3400;
}
.mobile-progress-toggle:focus-visible {
  outline: 3px solid rgba(255,255,255,0.45);
  outline-offset: 2px;
}
.list-close-btn {
  display: none;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.18);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.list-close-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.45);
  outline-offset: 2px;
}

/* Map fills remaining height; lets the accuracy bar sit underneath */
#map {
  flex: 1 1 auto;
  height: 100%;
  min-height: 320px;
  width: 100%;
  position: relative; /* for popup positioning */
}

/* Top-right pill bar (counter + GPS) */
.map-topbar {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 1200;           /* ABOVE Leaflet controls */
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.map-pill {
  pointer-events: auto;
  min-width: 78px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--text);

  -webkit-appearance: none;
  appearance: none;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Counter pill (non-interactive, plain) */
.map-pill#progress {
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.35);
  color: var(--text);
}

/* GPS pill (interactive button) */
.map-pill#gps-toggle {
  cursor: pointer;
  min-width: 64px;
  font-size: 15px;
  border: 2px solid rgba(255,255,255,0.6); /* stronger border to look clickable */
  transition: background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}
.map-pill#gps-toggle.green {
  cursor: default;
  border-color: rgba(255,255,255,0.35);
}

/* keep style stable */
.map-pill:focus,
.map-pill:active {
  background: inherit;
  border-color: inherit;
}

/* GPS states change background colour */
.map-pill.green {
  background: rgba(34,197,94,0.90);   /* green */
  border-color: rgba(34,197,94,1);    /* strong green border */
  color: #0b1d0f;
}
.map-pill.amber {
  background: rgba(245,158,11,0.92);  /* amber */
  border-color: rgba(245,158,11,1);   /* strong amber border */
  color: #1a1000;
}

/* Hover/focus effect to make GPS pill stand out */
.map-pill#gps-toggle:not(.green):hover,
.map-pill#gps-toggle:not(.green):focus {
  filter: brightness(1.08);
}
.map-pill#gps-toggle:focus-visible {
  outline: 3px solid rgba(255,255,255,0.75);
  outline-offset: 3px;
}
.map-pill.locate-pill {
  min-width: 44px;
  width: 44px;
  padding: 8px;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.35);
  color: var(--text);
  cursor: pointer;
}
.map-pill.locate-pill:hover,
.map-pill.locate-pill:focus {
  filter: brightness(1.08);
}
.map-pill.locate-pill:focus-visible {
  outline: 3px solid rgba(255,255,255,0.75);
  outline-offset: 3px;
}
.map-pill.locate-pill svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
  pointer-events: none;
}

/* --- GPS helper popup (center of map, auto fade) --- */
.gps-pop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1300;
  max-width: min(480px, 95vw);
  padding: 18px 20px;
  background: rgba(0,0,0,0.92);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  display: none;
  opacity: 0;
  text-align: center;
}
.gps-pop.visible { display: block; opacity: 1; transition: opacity 0.25s ease; }
.gps-pop.fade-out { animation: gpsPopFadeOut 0.4s ease forwards; }
@keyframes gpsPopFadeOut { from {opacity:1;} to {opacity:0;} }

/* GPS accuracy bar under the map */
.gps-accuracy-bar {
  padding: 8px 10px;
  text-align: center;
  font-size: 13px;
  color: #ffffff;
  background: #16243f;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.offline-tiles-notice {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 900;
  max-width: min(92%, 420px);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
  pointer-events: none;
}

/* Sidebar */
.sidebar {
  background: #16243f;
  border: 6px solid #16243f;
  border-radius: 10px;
  margin: 14px;
  padding: 12px;
  height: calc(100% - 28px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .map-page .layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--header-height));
  }
  .map-page .map-column {
    margin: 0;
    padding: 0;
    flex: 1 0 auto;
  }
  .map-page .map-shell {
    border: none;
    border-radius: 0;
    height: calc(100vh - var(--header-height) - var(--mobile-footer-height, 0px));
  }
  .map-page #map {
    min-height: 100%;
    border-radius: 0;
  }
  .map-page .mobile-progress-toggle {
    display: inline-flex;
    position: fixed;
    bottom: calc(0px + var(--mobile-footer-height, 0px));
    left: 50%;
    transform: translateX(-50%);
  }
  .map-page .sidebar {
    position: fixed;
    inset: var(--header-height) 0 0;
    margin: 0;
    border-radius: 0;
    border-width: 0;
    padding: 16px 20px 8px;
    height: calc(100vh - var(--header-height));
    max-height: none;
    box-shadow: 0 -18px 40px rgba(0,0,0,0.55);
    background: rgba(22,36,63,0.98);
    transform: translateY(102%);
    transition: transform 0.32s ease;
    overflow: hidden;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    visibility: hidden;
  }
  .map-page .sidebar.is-mobile-open {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
  }
  .map-page .sidebar .list-close-btn {
    display: inline-flex;
  }
  .map-page .sidebar .search-box {
    flex-shrink: 0;
  }
  .map-page .location-list {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    margin-bottom: calc(80px + env(safe-area-inset-bottom, 0)); /* leave room for floating Map button */
  }
  .map-page .list-pad {
    flex-shrink: 0;
    height: calc(80px + env(safe-area-inset-bottom, 0));
  }
  .map-page #map .leaflet-control-container .leaflet-top {
    top: 16px;
    left: 16px;
  }
  .map-page #map .leaflet-control-container .leaflet-bottom.leaflet-right {
    bottom: calc(12px + var(--mobile-footer-height, 0px));
    right: 12px;
  }
  .map-page #map .leaflet-control-zoom a {
    width: 40px;
    height: 40px;
    font-size: 22px;
    line-height: 36px;
  }
  .map-page .leaflet-control-container .leaflet-bottom.leaflet-right .leaflet-control-attribution {
    position: fixed;
    right: 16px !important;
    bottom: calc(-20px + var(--mobile-footer-height, 0px)) !important;
    left: auto;
    font-size: 11px;
    padding: 0;
    margin: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(15,23,42,0.9);
    text-align: right;
    width: auto;
    display: inline-block;
    box-shadow: none;
    z-index: 3500;
  }
.map-page .map-topbar {
    top: 20px;
    right: 20px;
    left: auto;
  }
}

.location-list {
  scrollbar-color: rgba(255,255,255,0.25) #16243f;
}
.location-list::-webkit-scrollbar {
  width: 10px;
}
.location-list::-webkit-scrollbar-track {
  background: #16243f;
}
.location-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 999px;
}
.location-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.45);
}

/* Location header (no accuracy here anymore) */
.location-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.location-title { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; text-align: center; }

.search-box { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.search-box input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #0f1318;
  color: var(--text);
}
.location-list { list-style: none; margin: 0; padding: 0 0 16px; overflow: auto; flex: 1; }
.location-list .list-header { padding: 8px 12px; color: var(--muted); font-size: 12px; letter-spacing: 0.02em; background: rgba(255,255,255,0.02); border-top: 1px solid rgba(255,255,255,0.06); }
.location-list .list-header.collapsible { padding: 0; background: transparent; border-top: none; }
.location-list .list-header .collapse-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.18);
  border: none;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.location-list .list-header .collapse-toggle .toggle-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s ease, transform 0.2s ease;
}
.location-list .list-header .collapse-toggle:hover,
.location-list .list-header .collapse-toggle:focus {
  background: rgba(0,0,0,0.28);
  color: var(--text);
}
.location-list .list-header .collapse-toggle:hover .toggle-icon,
.location-list .list-header .collapse-toggle:focus .toggle-icon {
  color: #ffffff;
}
.location-list .group-label {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.location-list .group-label .count {
  font-weight: 500;
  opacity: 0.75;
}
.location-list .list-header.static-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.18);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.location-item { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); display: grid; grid-template-columns: auto max-content; gap: 8px; align-items: center; }
.location-item h3 { margin: 0; font-size: 14px; font-weight: 400; }
.location-item .meta { color: var(--muted); font-size: 12px; }
.location-item .meta .range-text { margin-left: 6px; color: var(--amber); font-weight: 600; white-space: nowrap; }
.location-item .controls { display: flex; gap: 6px; align-items: center; }
.location-item .action-btn {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(15,19,24,0.85);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.location-item .action-btn:not([disabled]):hover,
.location-item .action-btn:not([disabled]):focus {
  border-color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  transform: translateY(-1px);
}
.location-item .action-btn:focus {
  outline: 2px solid rgba(255,255,255,0.32);
  outline-offset: 2px;
}
.location-item .action-btn[disabled] {
  opacity: 1;
  cursor: default;
  background: rgba(15,19,24,0.85);
  border-color: rgba(255,255,255,0.18);
  color: var(--text);
}
.location-item .action-btn.action-completed {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--success);
  font-weight: 600;
  box-shadow: none;
}
.location-item .action-btn.action-check-ready {
  background: rgba(245,158,11,0.18);
  border-color: rgba(245,158,11,0.65);
  color: #fcd34d;
}
.location-item .action-btn.action-check-ready:hover,
.location-item .action-btn.action-check-ready:focus {
  background: rgba(245,158,11,0.26);
  border-color: rgba(245,158,11,0.82);
  color: #fee9a8;
}
.location-item .action-btn.action-check-pending {
  padding: 0;
  background: transparent;
  border: none;
  color: #fca5a5;
  font-weight: 600;
  box-shadow: none;
}
.location-item .action-btn.action-check[disabled]:not(.action-check-pending) {
  color: var(--muted);
  border-color: rgba(255,255,255,0.12);
  background: rgba(12,16,22,0.6);
}
.location-item.checked { background: rgba(34,197,94,0.12); border-left: 3px solid var(--success); }
.location-item.pending { background: rgba(239,68,68,0.12); border-left: 3px solid rgba(239,68,68,0.8); }
.location-item.in-range { background: rgba(245,158,11,0.12); border-left: 3px solid var(--amber); }
html[lang="cy"] .location-item > div:first-child {
  min-width: 0;
}
html[lang="cy"] .location-item h3 {
  overflow-wrap: normal;
}

/* Footer */
.app-footer {  margin-top: auto;  margin-bottom: 0;  margin-top: auto;  margin-bottom: 0;  margin-top: auto;
  display: block;
  padding: 10px;
  font-size: 11px;
  color: rgba(166,179,193,0.85);
  text-align: center;
  background: var(--panel);
  border-top: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 -12px 24px rgba(0,0,0,0.35);
}
.footer-copy {
  display: block;
  font-family: Arial, sans-serif;
}
.footer-copy a {
  color: inherit;
  text-decoration: underline;
}
.footer-copy a:hover,
.footer-copy a:focus-visible {
  text-decoration-thickness: 2px;
}

/* Mobile bottom navigation */
.mobile-bottom-nav {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  width: 100%;
}
.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 12px;
  text-decoration: none;
  color: rgba(232,238,245,0.72);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.mobile-nav-link:hover,
.mobile-nav-link:focus {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}
.mobile-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}
.mobile-nav-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.mobile-nav-label {
  line-height: 1;
}
.mobile-nav-link.is-active,
.dashboard-page .mobile-nav-link[data-page="dashboard"],
.map-page .mobile-nav-link[data-page="map"],
.progress-page .mobile-nav-link[data-page="progress"],
.settings-page .mobile-nav-link[data-page="settings"],
.leaderboard-page .mobile-nav-link[data-page="leaderboard"] {
  color: #ffffff;
  background: rgba(136,192,208,0.18);
}
.mobile-nav-link[data-page="exit"] {
  color: rgba(248,113,113,0.85);
}
.mobile-nav-link[data-page="exit"]:hover,
.mobile-nav-link[data-page="exit"]:focus {
  color: #f87171;
  background: rgba(248,113,113,0.18);
}
.mobile-nav-link.is-disabled,
.mobile-nav-link.is-disabled:hover,
.mobile-nav-link.is-disabled:focus {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  color: inherit;
  background: transparent;
}
.mobile-nav-link[data-page="exit"].is-disabled,
.mobile-nav-link[data-page="exit"].is-disabled:hover,
.mobile-nav-link[data-page="exit"].is-disabled:focus {
  color: rgba(248,113,113,0.45);
}

/* Leaflet dark tweaks */
.leaflet-container { background: #0b0f13; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #11161c; color: var(--text); }
.leaflet-control-zoom a { background: #11161c; color: var(--text); border: 1px solid rgba(255,255,255,0.12); }

/* Map popup check-in button styling */
.leaflet-popup-content .popup-checkin {
  border-radius: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(245,158,11,0.75);
  background: rgba(245,158,11,0.22);
  color: #fff6da;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.leaflet-popup-content .popup-checkin:hover,
.leaflet-popup-content .popup-checkin:focus {
  background: rgba(245,158,11,0.32);
  border-color: rgba(245,158,11,0.9);
  transform: translateY(-1px);
  outline: none;
}
.leaflet-popup-content .popup-checkin:focus-visible {
  outline: 2px solid rgba(255,255,255,0.45);
  outline-offset: 2px;
}
.leaflet-popup-content .popup-status { margin-top: 6px; font-size: 12px; color: #a6b3c1; }
.leaflet-popup-content .popup-status.green { color: #22c55e; font-weight: 700; }
.leaflet-popup-content .popup-status.amber { color: #f59e0b; font-weight: 700; }

/* Center all content inside Leaflet popups */
.leaflet-popup-content {
  text-align: center;
}
.leaflet-popup-content .popup-title {
  display: block;
  margin-bottom: 2px;
  line-height: 1.25;
}

/* Ensure the "Check in" button is centered too */
.leaflet-popup-content .popup-checkin {
  display: inline-block;    /* inline-block so text-align works */
  margin: 8px auto 0;       /* add a little top space and center */
}
.leaflet-control-container .leaflet-bottom .leaflet-control-attribution {
  margin: 0 !important;
  right: 16px !important;
  left: auto !important;
  bottom: 12px !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: rgba(15,23,42,0.9) !important;
}

/* Progress page */
body.progress-page {
  min-height: 100vh;
}
.progress-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  padding: 28px 20px 80px;
  margin: 0;
}
.progress-page .dashboard-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.progress-overview {
  background: #16243f;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  width: min(960px, 100%);
}
.progress-overview h2 { margin-top: 0; margin-bottom: 16px; font-size: 24px; }
.progress-stat {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  font-size: 18px;
  margin-bottom: 16px;
}
.progress-count { font-size: 42px; font-weight: 700; color: var(--success); }
.progress-total {
  color: var(--muted);
  font-size: 42px;
  line-height: 1;
}
.progress-bar {
  height: 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--accent));
  transition: width 0.4s ease;
}
.progress-next {
  margin-top: 20px;
  font-size: 16px;
  color: rgba(232,238,245,0.82);
}
.progress-ladder {
  background: #16243f;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 28px 24px;
  width: min(960px, 100%);
}
.progress-ladder h2 { margin-top: 0; margin-bottom: 20px; font-size: 22px; }
.ladder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.ladder-tier {
  display: flex;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.22);
  align-items: center;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.ladder-tier .tier-content h3 { margin: 0 0 6px; font-size: 18px; }
.ladder-tier .tier-content p { margin: 0; color: rgba(232,238,245,0.7); font-size: 14px; }
.ladder-tier .tier-badge {
  min-width: 80px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: #0b0e10;
}
.tier-badge.bronze { background: linear-gradient(135deg, #c08a55, #a86e3a); }
.tier-badge.silver { background: linear-gradient(135deg, #d1d7e0, #aeb4c2); }
.tier-badge.gold { background: linear-gradient(135deg, #f6d365, #fda085); }
.tier-badge.platinum { background: linear-gradient(135deg, #cfd8dc, #8ea6c1); }
.ladder-tier.achieved {
  border-color: rgba(34,197,94,0.55);
  background: rgba(34,197,94,0.15);
  transform: translateY(-2px);
}
.ladder-tier.achieved .tier-content p { color: rgba(232,238,245,0.92); }
.ladder-tier.achieved .tier-badge { color: #041108; }

/* About & Help page */
.about-help-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 80px;
  gap: 28px;
  text-align: center;
}
.about-help-content {
  width: min(960px, 100%);
  display: grid;
  gap: 18px;
}
.about-help-card {
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(22,36,63,0.12);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(22,36,63,0.18);
  color: #16243f;
  padding: 24px;
  text-align: center;
}
.about-help-card h3 {
  margin: 0 0 12px;
  color: #16243f;
  font-size: 21px;
  line-height: 1.25;
}
.about-help-card h4 {
  margin: 18px 0 8px;
  color: #16243f;
  font-size: 16px;
  line-height: 1.3;
}
.about-help-card p,
.about-help-card li {
  color: #1d2b47;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.about-help-card p {
  margin: 0 auto;
  max-width: 760px;
}
.about-help-card a {
  color: #16243f;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.about-help-card ol,
.about-help-card ul {
  margin: 0 auto;
  padding-left: 22px;
  width: min(720px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}
.about-help-card li + li {
  margin-top: 6px;
}
.help-steps {
  margin-top: 18px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(22,36,63,0.12);
  width: min(720px, 100%);
  max-width: 100%;
  box-sizing: border-box;
}

/* Settings page */
.settings-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 80px;
  gap: 28px;
  text-align: center;
}
.settings-hero h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  color: #16243f;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.settings-account-line {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 600;
  color: #1d2b47;
  max-width: min(92vw, 760px);
}
.settings-grid {
  width: min(960px, 100%);
  margin: 0 auto;
}
.settings-card {
  text-align: center;
  justify-content: flex-start;
}
.settings-action-card {
  width: 100%;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(160deg, rgba(20,34,58,0.92), rgba(12,22,40,0.88));
  color: inherit;
  font: inherit;
  text-align: center;
}
.dashboard-card.settings-signout-card {
  background: linear-gradient(160deg, rgba(202,58,58,0.95), rgba(156,32,32,0.95));
  border-color: rgba(248,113,113,1);
  color: #ffffff;
}
.dashboard-card.settings-signout-card:hover,
.dashboard-card.settings-signout-card:focus {
  border-color: rgba(255,209,209,0.95);
}
.dashboard-card.settings-signout-card h3,
.dashboard-card.settings-signout-card .settings-status {
  color: #ffffff !important;
  text-shadow: none;
}
.dashboard-card.settings-signout-card p {
  color: rgba(232,238,245,0.75) !important;
  text-shadow: none;
}
.dashboard-card.settings-signout-card .dashboard-card-text {
  color: rgba(232,238,245,0.75) !important;
  text-shadow: none;
}
.dashboard-card.settings-signout-card .dashboard-card-icon {
  background: rgba(120,28,28,0.25);
  color: #ffffff;
}
.dashboard-card.settings-signout-card .signout-card-icon {
  width: 32px;
  height: 32px;
  fill: currentColor;
}
.settings-card h3 { margin-top: 0; margin-bottom: 10px; }
.settings-card p { margin: 0 0 18px; color: rgba(232,238,245,0.82); font-size: 15px; }
.settings-account-email {
  color: #16243f;
  font-weight: 600;
  font-size: 16px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.settings-username-field {
  margin-top: 12px;
  margin-bottom: 10px;
  text-align: left;
}
.settings-username-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: rgba(232,238,245,0.9);
  margin-bottom: 6px;
}
.settings-username-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(12,19,32,0.85);
  color: #f8fafc;
  font-size: 14px;
  outline: none;
}
.settings-username-field input:focus {
  border-color: rgba(136,192,208,0.8);
  box-shadow: 0 0 0 3px rgba(136,192,208,0.25);
  background: rgba(12,19,32,0.95);
}
.settings-reset-btn {
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(230,95,92,0.2);
  border: 1px solid rgba(230,95,92,0.7);
  color: #fef2f2;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  margin-top: auto;
  margin-bottom: 10px;
}
.settings-reset-btn:hover,
.settings-reset-btn:focus {
  background: rgba(230,95,92,0.32);
  border-color: rgba(230,95,92,0.85);
  transform: translateY(-1px);
}
.settings-reset-btn:active {
  transform: translateY(0);
}
.settings-status {
  display: block;
  margin: 8px 0 0;
  font-size: 14px;
  min-height: 21px;
}
.settings-page .settings-status:empty {
  display: none;
  min-height: 0;
  margin: 0;
}
.settings-status.success { color: var(--success); }
.settings-status.error { color: var(--danger); }
.settings-status.muted { color: var(--muted); }
#reset-password-icon.is-success,
#reset-progress-icon.is-success {
  color: #22c55e;
  font-weight: 800;
}

.dashboard-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.dashboard-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 80px;
  gap: 28px;
  text-align: center;
}
.dashboard-hero {
  text-align: center;
}
.dashboard-hero h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  color: #16243f;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.dashboard-hero-logo {
  width: 72px;
  height: auto;
  display: block;
  margin: 0 auto 4px;
}

@media (min-width: 901px) {
  .dashboard-hero h2 {
    font-size: 34px;
  }
  .settings-hero h2 {
    font-size: 34px;
  }
}
.dashboard-hero p {
  margin: 0;
  max-width: 560px;
  font-size: 17px;
  color: #1d2b47;
}
.dashboard-account-line {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  color: #1d2b47;
  font-weight: 600;
  max-width: min(92vw, 760px);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.dashboard-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 250px));
  justify-content: center;
  width: min(1360px, 100%);
  margin: 0 auto;
}
.dashboard-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 28px;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(160deg, rgba(20,34,58,0.92), rgba(12,22,40,0.88));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 48px rgba(0,0,0,0.45);
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.dashboard-card:hover,
.dashboard-card:focus {
  transform: translateY(-6px);
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.dashboard-card.is-disabled,
.dashboard-card.is-disabled:hover,
.dashboard-card.is-disabled:focus {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 24px 48px rgba(0,0,0,0.45);
}
.dashboard-card:focus {
  outline: 2px solid rgba(255,255,255,0.3);
  outline-offset: 4px;
}
.dashboard-card-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 32px;
  background: linear-gradient(135deg, rgba(59,130,246,0.35), rgba(148,163,184,0.35));
  color: #f8fafc;
}
.dashboard-card-icon .install-icon {
  width: 34px;
  height: 34px;
  fill: currentColor;
  display: block;
}
.dashboard-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
}
.dashboard-card-title {
  display: block;
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
}
.dashboard-card p {
  margin: 0;
  font-size: 15px;
  color: rgba(232,238,245,0.75);
}
.dashboard-card-text {
  display: block;
  margin: 0;
  font-size: 15px;
  color: rgba(232,238,245,0.75);
}
.dashboard-card.install-card {
  align-items: center;
  text-align: center;
  background: #3e5580;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 24px 48px rgba(0,0,0,0.45);
  cursor: pointer;
}
.dashboard-card.install-card .dashboard-card-icon {
  background: linear-gradient(135deg, rgba(34,197,94,0.35), rgba(59,130,246,0.35));
}
.install-btn {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(136,192,208,0.5);
  background: rgba(136,192,208,0.2);
  color: #f8fafc;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.install-btn:hover,
.install-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  border-color: rgba(136,192,208,0.85);
  background: rgba(136,192,208,0.3);
}
.install-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 3px;
}
.install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
}
.install-overlay.is-open {
  display: flex;
}
.install-dialog {
  background: rgb(46, 125, 190);
  color: rgb(255, 255, 255);
  padding: 22px 20px 18px;
  border-radius: 14px;
  width: min(420px, 92vw);
  box-shadow: 0 22px 50px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  text-align: center;
}
.install-dialog h3 {
  margin: 0 0 10px;
  font-size: 20px;
}
.install-steps {
  margin: 0 0 14px;
  color: rgba(232,238,245,0.85);
  font-size: 15px;
}
ul.install-steps {
  list-style: disc;
  padding-left: 20px;
  text-align: left;
}
ul.install-steps li + li {
  margin-top: 6px;
}
.install-close {
  border: none;
  background: rgb(36, 110, 170);
  color: rgb(255, 255, 255);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  display: block;
  margin: 0 auto;
}
.install-close:hover,
.install-close:focus {
  transform: translateY(-1px);
  background: rgb(32, 102, 160);
  box-shadow: 0 10px 22px rgba(0,0,0,0.35);
}
.install-close:focus-visible {
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}

.milestone-toast {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 3200;
}
.milestone-toast.visible {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 900px) {
  .milestone-toast {
    align-items: center;
    padding-top: clamp(5px, 2vh, 20px);
    padding-bottom: clamp(70px, 15vh, 150px);
  }
}

@media (max-width: 600px) {
  .milestone-toast {
    padding-top: clamp(5px, 3vh, 30px);
    padding-bottom: clamp(80px, 16vh, 160px);
  }
}

.milestone-toast .milestone-card {
  background: rgba(15,20,32,0.78);
  border-radius: 18px;
  padding: 28px 32px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.45);
  text-align: center;
  max-width: 320px;
  pointer-events: auto;
  position: relative;
  overflow: visible;
  isolation: isolate;
}
.milestone-toast .milestone-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.25);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.milestone-toast .milestone-close:hover,
.milestone-toast .milestone-close:focus-visible {
  background: rgba(0,0,0,0.45);
  border-color: rgba(255,255,255,0.85);
  transform: scale(1.05);
  outline: none;
}
.milestone-toast .milestone-card.flash-anim {
  animation: milestoneCardPop 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.milestone-toast .milestone-glow {
  position: absolute;
  inset: -35%;
  background: radial-gradient(circle at center, rgba(250,204,21,0.6), rgba(249,115,22,0));
  filter: blur(36px);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 0;
  pointer-events: none;
}
.milestone-toast .milestone-card.flash-anim .milestone-glow {
  animation: milestoneGlowPulse 1.4s ease-out forwards;
}
.milestone-toast .milestone-card.flash-bronze .milestone-glow {
  background: radial-gradient(circle at center, rgba(192,138,85,0.7), rgba(120,74,42,0.08));
}
.milestone-toast .milestone-card.flash-silver .milestone-glow {
  background: radial-gradient(circle at center, rgba(209,215,224,0.72), rgba(142,166,193,0.08));
}
.milestone-toast .milestone-card.flash-gold .milestone-glow {
  background: radial-gradient(circle at center, rgba(246,211,101,0.74), rgba(253,160,133,0.08));
}
.milestone-toast .milestone-card.flash-platinum .milestone-glow {
  background: radial-gradient(circle at center, rgba(207,216,220,0.75), rgba(142,166,193,0.08));
}
.milestone-toast .milestone-card.flash-default .milestone-glow {
  background: radial-gradient(circle at center, rgba(244,114,182,0.7), rgba(59,130,246,0.08));
}
.milestone-toast .milestone-effects {
  position: absolute;
  inset: -20%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}
.milestone-toast .confetti-piece {
  position: absolute;
  top: var(--confetti-origin-y, 50%);
  left: var(--confetti-origin-x, 50%);
  width: var(--confetti-size, 10px);
  height: calc(var(--confetti-size, 10px) * 0.6);
  border-radius: 2px;
  opacity: 0;
  filter: blur(var(--confetti-blur, 0px));
  transform: translate3d(-50%, -50%, 0) scale(0.4);
  animation: confettiBurst var(--confetti-duration, 2s) ease-out var(--confetti-delay, 0s) forwards;
  box-shadow: 0 0 12px rgba(255,255,255,0.25);
}
.milestone-toast .milestone-card.flash-anim .milestone-icon,
.milestone-toast .milestone-card.flash-anim .milestone-title,
.milestone-toast .milestone-card.flash-anim .milestone-text {
  position: relative;
  z-index: 4;
}

.milestone-toast .milestone-card::before {
  content: '';
  position: absolute;
  inset: -6% -12%;
  background: radial-gradient(circle at top, rgba(255,255,255,0.45), transparent 70%);
  opacity: 0;
  transform: scale(0.8);
  filter: blur(12px);
  pointer-events: none;
  z-index: 1;
}
.milestone-toast .milestone-card.flash-anim::before {
  animation: milestoneAura 1.1s ease-out forwards;
}

.milestone-toast .milestone-card.bronze {
  background: linear-gradient(135deg, #c08a55 0%, #a86e3a 100%);
}
.milestone-toast .milestone-card.silver {
  background: linear-gradient(135deg, #d1d7e0 0%, #aeb4c2 100%);
}
.milestone-toast .milestone-card.gold {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}
.milestone-toast .milestone-card.platinum {
  background: linear-gradient(135deg, #cfd8dc 0%, #8ea6c1 100%);
}
.milestone-toast .milestone-card.flash-default {
  background: linear-gradient(150deg, rgba(15,23,42,0.55) 0%, rgba(79,70,229,0.85) 35%, rgba(244,114,182,0.85) 80%, rgba(253,186,116,0.82) 100%);
}

.milestone-toast .milestone-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #facc15;
}
.milestone-toast .milestone-icon-svg {
  width: 56px;
  height: 56px;
  display: block;
}
.milestone-toast .milestone-trophy-svg {
  width: 112px;
  height: 112px;
  filter: drop-shadow(0 20px 22px rgba(0,0,0,0.42));
}
.milestone-toast .milestone-title {
  font-size: 24px;
  font-weight: 800;
  margin: 4px 0 6px;
  color: #f8fafc;
  letter-spacing: 0.02em;
  text-shadow: 0 6px 18px rgba(0,0,0,0.55);
}
.milestone-toast .milestone-text {
  font-size: 16px;
  color: rgba(248,250,252,0.85);
  margin: 0;
  text-shadow: 0 6px 16px rgba(15,23,42,0.45);
}

.milestone-toast .milestone-card.flash-anim::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 24px;
  border: 3px solid rgba(255,255,255,0.28);
  opacity: 0;
  transform: scale(0.85);
  filter: blur(0);
  pointer-events: none;
  z-index: 2;
  animation: milestoneRing 1s ease-out forwards;
}
.milestone-toast .milestone-card.flash-bronze::after { border-color: rgba(192,138,85,0.52); }
.milestone-toast .milestone-card.flash-silver::after { border-color: rgba(209,215,224,0.52); }
.milestone-toast .milestone-card.flash-gold::after { border-color: rgba(246,211,101,0.52); }
.milestone-toast .milestone-card.flash-platinum::after { border-color: rgba(207,216,220,0.55); }
.milestone-toast .milestone-card.flash-default::after { border-color: rgba(244,114,182,0.55); }

@keyframes milestoneCardPop {
  0% { transform: scale(0.85) rotateX(12deg); box-shadow: 0 24px 48px rgba(0,0,0,0.45); }
  30% { transform: scale(1.05) rotateX(0deg); box-shadow: 0 30px 70px rgba(0,0,0,0.55); }
  60% { transform: scale(0.98); box-shadow: 0 24px 50px rgba(0,0,0,0.48); }
  100% { transform: scale(1); box-shadow: 0 24px 48px rgba(0,0,0,0.45); }
}
@keyframes milestoneGlowPulse {
  0% { opacity: 0; transform: scale(0.6); }
  30% { opacity: 0.9; transform: scale(1.1); }
  70% { opacity: 0.45; transform: scale(0.85); }
  100% { opacity: 0; transform: scale(0.7); }
}
@keyframes milestoneRing {
  0% { opacity: 0.9; transform: scale(0.6); filter: blur(4px); }
  60% { opacity: 0.35; transform: scale(1.05); filter: blur(1px); }
  100% { opacity: 0; transform: scale(1.25); filter: blur(6px); }
}
@keyframes confettiBurst {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(0.4) rotate(0deg);
  }
  22% {
    opacity: var(--confetti-opacity, 1);
    transform: translate3d(
      calc(-50% + var(--confetti-travel-x-mid, 0px)),
      calc(-50% + var(--confetti-travel-y-mid, 0px)),
      0
    ) scale(1) rotate(0deg);
  }
  62% {
    opacity: var(--confetti-opacity, 1);
    transform: translate3d(
      calc(-50% + var(--confetti-travel-x-mid2, 0px)),
      calc(-50% + var(--confetti-travel-y-mid2, 0px)),
      0
    ) rotate(var(--confetti-rotate-mid, 0deg));
  }
  100% {
    opacity: 0;
    transform: translate3d(
      calc(-50% + var(--confetti-travel-x, 0px)),
      calc(-50% + var(--confetti-travel-y, 0px)),
      0
    ) rotate(var(--confetti-rotate, 0deg));
  }
}
@keyframes milestoneAura {
  0% { opacity: 0; transform: scale(0.5); filter: blur(18px); }
  40% { opacity: 0.75; transform: scale(1); filter: blur(8px); }
  100% { opacity: 0; transform: scale(1.3); filter: blur(28px); }
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,10,18,0.72);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 4000;
  pointer-events: none;
}
.confirm-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.confirm-dialog {
  width: min(360px, 90vw);
  padding: 28px 26px;
  background: rgba(15,20,32,0.95);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 18px 36px rgba(0,0,0,0.45);
  text-align: center;
}
.confirm-dialog h3 { margin: 0 0 12px; font-size: 22px; }
.confirm-dialog p { margin: 0 0 24px; font-size: 15px; color: var(--muted); }
.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.confirm-btn {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  min-width: 120px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.confirm-primary {
  background: rgba(230,95,92,0.9);
  color: #1a0606;
  border-color: rgba(230,95,92,1);
}
.confirm-primary:hover,
.confirm-primary:focus { filter: brightness(1.05); transform: translateY(-1px); }
.confirm-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: rgba(255,255,255,0.18);
}
.confirm-secondary:hover,
.confirm-secondary:focus { border-color: rgba(255,255,255,0.3); transform: translateY(-1px); }

/* Responsive */
@media (max-width: 1200px) {
  .layout { display: flex; flex-direction: column; height: auto; min-height: calc(100vh - var(--header-height)); gap: 0; }
  #map { width: 100%; height: min(60vh, 520px); }
  .sidebar { height: auto; max-height: none; }
}
@media (max-width: 1200px) {
  :root {
    --mobile-footer-height: calc(160px + env(safe-area-inset-bottom, 0));
  }
}
@media (min-width: 901px) and (max-width: 1024px) {
  :root {
    --mobile-footer-height: 0px;
  }
  .map-page .mobile-progress-toggle {
    bottom: 20px;
  }
  .map-page #map .leaflet-control-container .leaflet-bottom.leaflet-right .leaflet-control-attribution {
    bottom: 9px !important;
  }
}
@media (max-width: 900px) {
  :root {
    --mobile-footer-height: calc(118px + env(safe-area-inset-bottom, 0));
  }
  body {  display: flex;  flex-direction: column;  min-height: 100vh;  min-height: 100vh; padding-bottom: var(--mobile-footer-height); }
  .app-header { padding: 10px 16px; min-height: var(--header-height); }
  .header-status { display: inline-flex; }
  .map-page #map .leaflet-control-container .leaflet-bottom.leaflet-right .leaflet-control-attribution {
    bottom: calc(-16px + var(--mobile-footer-height, 0px)) !important;
  }
  .brand-logo { height: 32px; }
  .app-header h1 { font-size: 13px; }
  .app-header .brand { gap: 10px; }
  .header-nav { display: none; }
  .header-link { font-size: 12px; padding: 5px 9px; }
  .header-icon { width: 34px; height: 34px; }
  .app-footer {  margin-top: auto;  margin-bottom: 0;  margin-top: auto;  margin-bottom: 0;  margin-top: auto;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0));
    background: var(--panel);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -12px 24px rgba(0,0,0,0.35);
    backdrop-filter: blur(16px);
    z-index: 3200;
  }
  .app-footer .footer-copy {
    color: rgba(166,179,193,0.85);
    font-size: 11px;
  }
  .mobile-bottom-nav {
    display: grid;
    padding: 0 14px;
  }
  .sidebar {
    padding-bottom: 24px;
    margin-bottom: calc(var(--mobile-footer-height) + 20px);
  }
  .dashboard-main,
  .progress-main,
  .settings-main,
  .about-help-main,
  .leaderboard-main {
    padding-bottom: calc(var(--mobile-footer-height) + 20px);
  }
  .app-header .header-actions {
    display: flex;
    gap: 8px;
  }
  .account-lang {
    display: inline-flex;
  }
  .account-name {
    display: none;
  }
  .account-pill {
    display: none;
  }
  .account-dropdown {
    display: none !important;
  }
  .header-actions .exit-link {
    display: none;
  }
}

@media (max-width: 900px) {
  .header-install {
    transform: none;
  }
}

@media (max-width: 760px) {
  #map { height: min(55vh, 440px); }
  .brand-logo { height: 32px; }
  .app-header h1 { font-size: 13px; }
  .app-header .brand { gap: 10px; }
}
@media (max-width: 620px) {
  .app-header { padding: 10px 16px; column-gap: 12px; min-height: var(--header-height); }
  .brand-logo { height: 32px; }
  .app-header h1 { font-size: 13px; }
  .header-nav { gap: 8px; }
  .header-link { font-size: 11px; padding: 5px 8px; }
}
@media (max-width: 520px) {
  .app-header { padding: 10px 16px; min-height: var(--header-height); }
  .brand-logo { height: 32px; }
  .app-header h1 { font-size: 13px; }
  .header-nav { gap: 6px; }
  .header-link { font-size: 10px; padding: 4px 7px; }
  .header-actions { gap: 6px; }
  .header-icon { width: 30px; height: 30px; }
  .mobile-nav-label {
    font-size: 9px;
    letter-spacing: 0;
  }
  .mobile-nav-link {
    gap: 3px;
    padding: 6px 2px;
  }
}
@media (max-width: 720px) {
  .progress-main {
    padding: 14px 16px calc(6px + var(--mobile-footer-height));
    gap: 24px;
    margin-top: 0;
  }
  .ladder-tier { flex-direction: column; align-items: flex-start; }
  .ladder-tier .tier-badge { align-self: center; }
  .settings-main {
    padding: 14px 16px calc(6px + var(--mobile-footer-height));
    gap: 20px;
  }
  .about-help-main {
    padding: 14px 16px calc(6px + var(--mobile-footer-height));
    gap: 20px;
  }
  .dashboard-main {
    padding: 14px 16px calc(6px + var(--mobile-footer-height));
    gap: 20px;
  }
  .dashboard-hero h2 {
    font-size: 38px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 0 auto;
    gap: 14px;
  }
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 0 auto;
    gap: 14px;
  }
  .dashboard-card {
    padding: 18px 16px;
  }
  .settings-card {
    padding: 18px 16px;
  }
  .dashboard-card-icon {
    width: 60px;
    height: 60px;
    font-size: 26px;
    margin-bottom: 14px;
  }
  .dashboard-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .dashboard-card-title {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .dashboard-card p {
    font-size: 14px;
  }
  .dashboard-card-text {
    font-size: 14px;
  }
  .about-help-card {
    padding: 18px 16px;
  }
  .about-help-card h3 {
    font-size: 18px;
  }
  .about-help-card p,
  .about-help-card li {
    font-size: 14px;
  }
}

/* Keep hero headings consistent across viewport sizes */
.dashboard-hero h2,
.settings-hero h2,
.login-hero h2 {
  font-size: 32px !important;
  line-height: 1.2;
}
.leaflet-marker-icon.pin-icon {
  transition: transform 0.12s ease, filter 0.12s ease;
}
.leaflet-marker-icon.pin-icon:hover,
.leaflet-marker-icon.pin-icon.is-hovered {
  transform: translateY(-2px) scale(1.06);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
  z-index: 10000 !important;
}

  .brand-username {
    display: inline;
  }


.confirm-password-wrap {
  margin: -10px 0 12px;
  text-align: left;
}
.confirm-password-wrap label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  color: rgba(232,238,245,0.9);
  font-weight: 600;
}
.confirm-password-wrap input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(6,10,18,0.65);
  color: #f8fafc;
  font-size: 14px;
}
.confirm-password-wrap input:focus {
  outline: 2px solid rgba(136,192,208,0.45);
  outline-offset: 1px;
  border-color: rgba(136,192,208,0.8);
}

.settings-action-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed !important;
}

.settings-offline-actions-message {
  margin-top: 10px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
