:root {
  --bg: #2e3f4f;
  --bg-deep: #253545;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.06);
  --border-warm: rgba(245, 166, 35, 0.25);
  --text: rgba(255, 255, 255, 0.85);
  --text-strong: #ffffff;
  --text-headline: #ffffff;
  --muted: rgba(255, 255, 255, 0.45);
  --muted-dim: rgba(255, 255, 255, 0.28);
  --accent: #f5a623;
  --accent-dim: rgba(245, 166, 35, 0.15);
  --accent-glow: rgba(245, 166, 35, 0.35);
  --hike: #f5a623;
  --hike-bright: #f7b84b;
  --bike: #b84a18;
  --bike-bright: #c4703a;
  --gold: #f5a623;
  --hike-soft: rgba(245, 166, 35, 0.18);
  --bike-soft: rgba(184, 74, 24, 0.15);
  /* Safe-area top inset. JS overrides this for native Capacitor (where
     env() returns 0 in WKWebView) and for iOS standalone PWA. The 47px
     fallback guards against env() resolving to 0 before layout is ready. */
  --sat: env(safe-area-inset-top, 47px);
  /* Approximate topbar height — used to push map controls below the header */
  --topbar-h: calc(58px + var(--sat));
}

/* Standalone PWA (saved to home screen): bypass env() entirely and
   hardcode the safe-area top inset so the topbar clears the notch /
   Dynamic Island on any iPhone. */
@media all and (display-mode: standalone) {
  :root { --sat: 59px; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  margin: 0;
  min-height: 100%;
  background: #1a2530;
}

body {
  margin: 0 auto;
  min-height: 100vh;
  width: 100%;
  max-width: 430px;
  overflow-x: hidden;
  background: var(--bg);
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
  position: relative;
  color: var(--text);
  font-family: "DM Sans", "Inter", -apple-system, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.app-header-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding: calc(11px + var(--sat)) 18px 11px;
  min-height: 58px;
  background: rgba(46, 63, 79, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
/* Capacitor native: bypass --sat entirely. Swift corrects to real device value. */
.cap-native .topbar { padding-top: 70px; }
.cap-native { --topbar-h: 120px; }
.screen-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { width: 44px; height: 44px; object-fit: contain; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border: 0.5px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.header-icon-btn svg { width: 17px; height: 17px; }
.header-icon-btn:hover { color: var(--text); }
.header-icon-btn.active { color: var(--accent); border-color: var(--accent); }

/* Filter bar — toggles below header */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  
  /* Match bottom-nav transparency */
  background: rgba(46, 63, 79, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  
  border-bottom: 1px solid var(--border);
  
  /* If sticky to top */
  position: sticky;
  top: 0;
  z-index: 100;
}
.fb-search {
  flex: 1;
  min-width: 140px;
  background: rgba(255, 255, 255, 0.08);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
.fb-search::placeholder {
  color: var(--muted);
}
.fb-search:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.12);
}

/* Log feed */
.log-feed { padding-bottom: 110px; }
.log-group-header {
  padding: 28px 0 4px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px; font-weight: 700;
  color: var(--text); letter-spacing: 0em;
}
.log-feed > .log-group-header:first-child { padding-top: 12px; }
.log-month-stats { padding: 0 0 10px; }
.log-month-pill {
  display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 5px 13px; border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  font-size: 12px; color: var(--muted);
}
.log-month-stat { font-family: "Playfair Display", Georgia, serif; font-weight: 500; color: #f5a623; }
.log-month-sep { color: rgba(255,255,255,0.2); }
.log-stat-num { font-family: "Playfair Display", Georgia, serif; }
/* ======================================================================
   App Tour (onboarding walkthrough)
   ====================================================================== */
.tour-overlay { align-items: flex-end; padding: 0; background: rgba(10,18,28,0.82); }
@media (min-height: 600px) { .tour-overlay { align-items: center; padding: 20px; } }
.tour-card {
  width: 100%; max-width: 400px;
  border-radius: 24px 24px 16px 16px;
  background: linear-gradient(180deg, #243547 0%, #1a2b3a 100%);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5), 0 30px 80px rgba(0,0,0,0.5);
  color: #fff; overflow: hidden; display: flex; flex-direction: column;
}
@media (min-height: 600px) { .tour-card { border-radius: 24px; } }
.tour-visual {
  height: 210px; flex-shrink: 0; overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.tour-body {
  padding: 22px 24px 16px; flex-shrink: 0;
}
.tour-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 21px; font-weight: 600; margin-bottom: 8px; line-height: 1.15;
}
.tour-desc {
  font-size: 14px; color: rgba(255,255,255,0.58); line-height: 1.65;
}
.tour-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px 22px; flex-shrink: 0; gap: 12px;
}
.tour-dots {
  display: flex; gap: 7px; align-items: center; flex: 1;
}
.tour-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.18); transition: background 0.2s, width 0.2s;
}
.tour-dot--on {
  width: 18px; border-radius: 3px; background: #f5a623;
}
.tour-btns { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.tour-btn {
  border: none; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 600; padding: 10px 20px;
  transition: opacity 0.15s;
}
.tour-btn--skip {
  background: transparent; color: rgba(255,255,255,0.36); padding: 10px 4px;
  font-weight: 400;
}
.tour-btn--skip:hover { color: rgba(255,255,255,0.6); }
.tour-btn--next {
  background: #f5a623; color: #1a2b3a; min-width: 90px;
}
.tour-btn--next:hover { opacity: 0.9; }

.log-month-pill--tap { cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.log-month-pill--tap:hover { background: rgba(255,255,255,0.09); border-color: rgba(245,166,35,0.3); }
.log-month-pill--tap:active { background: rgba(255,255,255,0.13); }

/* ======================================================================
   Month Dashboard Modal
   ====================================================================== */
.month-dash-card {
  position: relative; width: 100%; max-width: 430px;
  border-radius: 22px;
  background: linear-gradient(180deg, #2b3d50 0%, #1e2e3c 100%);
  box-shadow: 0 30px 80px rgba(0,0,0,0.65); color: #fff;
  display: flex; flex-direction: column; overflow: hidden;
  max-height: 88vh;
}
.month-dash-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 14px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.07); flex-shrink: 0;
}
.month-dash-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 19px; font-weight: 600; flex: 1;
}
.month-dash-close {
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7);
  font-size: 17px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: background 0.15s;
}
.month-dash-close:hover { background: rgba(255,255,255,0.14); }
.month-dash-totals {
  padding: 8px 22px 10px;
  font-size: 11.5px; color: rgba(255,255,255,0.38);
  letter-spacing: 0.02em; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.month-dash-charts {
  display: flex; padding: 0 10px 4px; flex-shrink: 0;
}
.month-dash-chart-col {
  flex: 1; min-width: 0; padding: 12px 6px 8px;
}
.month-dash-chart-col + .month-dash-chart-col {
  border-left: 1px solid rgba(255,255,255,0.06);
}
.month-dash-chart-lbl {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.32); text-align: center; margin-bottom: 5px;
}
.month-dash-chart { height: 108px; }
.month-dash-list {
  flex: 1; overflow-y: auto; border-top: 1px solid rgba(255,255,255,0.07);
  padding: 6px 0 10px;
}
.month-dash-list::-webkit-scrollbar { width: 0; }
.month-dash-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background 0.12s;
}
.month-dash-entry:hover { background: rgba(255,255,255,0.04); }
.month-dash-entry:active { background: rgba(255,255,255,0.08); }
.month-dash-entry-day {
  font-size: 11.5px; color: rgba(255,255,255,0.28);
  min-width: 18px; text-align: right; flex-shrink: 0;
}
.month-dash-entry-name {
  flex: 1; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.month-dash-entry-stats {
  font-size: 11.5px; color: #f5a623;
  font-family: "Playfair Display", Georgia, serif;
  flex-shrink: 0; text-align: right; white-space: nowrap;
}
.log-card {
  background: var(--card); border-radius: 16px;
  margin: 0 0 14px; overflow: hidden;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 2px 12px rgba(0,0,0,0.28);
}
.log-card:active { opacity: 0.82; }
.log-card-photos { display: grid; height: 175px; gap: 2px; position: relative; }
.log-gpx-badge {
  position: absolute;
  bottom: 7px;
  right: 7px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(46, 63, 79, 0.72);
  border: 1px solid rgba(245, 166, 35, 0.45);
  color: #f5a623;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.log-card-photos-1 { grid-template-columns: 1fr; }
.log-card-photos-2 { grid-template-columns: 1fr 1fr; }
.log-card-photos-3 { grid-template-columns: 2fr 1fr; }
.log-card-photos-3 .log-card-photos-side { display: flex; flex-direction: column; gap: 2px; }
.log-card-photos-route { display: block; height: 175px; overflow: hidden; }
.log-card-photos-route .log-route-svg { display: block; width: 100%; height: 175px; }
.log-card-photo-main { background: center/cover no-repeat; min-height: 100%; }
.log-card-photo-sm { flex: 1; background: center/cover no-repeat; }
.log-card-body { padding: 14px 16px 12px; }
.log-card-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px; font-weight: 700; color: #fff;
  line-height: 1.2; margin-bottom: 4px;
}
.log-card-stats {
  font-size: 13px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.log-stat-sep { color: var(--border); font-size: 11px; }
.log-card-narrative {
  font-size: 14px; line-height: 1.55; color: var(--text);
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.log-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.log-card-date { font-size: 12px; color: var(--muted); }
.log-card-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.log-badge-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 20px;
  background: var(--accent-dim); color: var(--accent); font-weight: 500;
}
.log-empty { padding: 60px 24px; text-align: center; color: var(--muted); font-size: 15px; }

/* ── Onboarding (empty state) ───────────────────────────────────────────── */
.log-feed.onboard-mode { overflow: hidden; }
.onboard { padding: 24px 20px 40px; max-width: 480px; margin: 0 auto; }
.onboard-hero { text-align: center; margin-bottom: 24px; }
.onboard-logo { width: 60px; height: 60px; margin-bottom: 12px; }
.onboard-title { font-family: "Playfair Display", Georgia, serif; font-size: 24px; font-weight: 600; color: #fff; margin: 0 0 6px; }
.onboard-sub { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.5; }
.onboard-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.onboard-step { display: flex; gap: 16px; align-items: flex-start; }
.onboard-step-icon { flex-shrink: 0; width: 44px; height: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.onboard-step-title { font-size: 15px; font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.onboard-step-desc { font-size: 13px; color: var(--muted); line-height: 1.55; }
.onboard-step-desc strong { color: var(--text); font-weight: 500; }
.onboard-packs { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 32px; }
.onboard-packs-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.onboard-pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.onboard-pack { display: flex; flex-direction: column; gap: 3px; }
.onboard-pack-name { font-size: 13px; font-weight: 600; color: var(--accent); }
.onboard-pack-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.onboard-cta { text-align: center; font-size: 15px; color: var(--muted); line-height: 1.5; }
.onboard-cta strong { color: var(--accent); font-size: 18px; }
.log-sentinel { height: 1px; } /* IntersectionObserver trigger at bottom of rendered entries */
.book-placeholder { display: flex; align-items: center; justify-content: center; height: 60vh; color: var(--muted); font-size: 15px; }

/* ======= Entry detail view (Screen 2) ======= */
body.entry-open main { padding: 0; }
[data-panel="entry"].active { padding: 0; min-height: 100dvh; background: var(--bg); }

/* Sticky wrapper: nav + photos stay pinned as user scrolls body */
.ev-header {}

.ev-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
}
.ev-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px 7px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: none;
  font-family: "DM Sans", sans-serif; font-size: 12px; font-weight: 400;
  color: rgba(255,255,255,0.6); cursor: pointer;
}
.ev-back-btn svg { flex-shrink: 0; }
.ev-back-btn:active { opacity: 0.7; }
.ev-more-btn {
  padding: 7px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: none;
  font-family: "DM Sans", sans-serif; font-size: 18px; font-weight: 400;
  color: rgba(255,255,255,0.7); cursor: pointer; line-height: 1;
}
.ev-more-btn:active { opacity: 0.7; }
.ev-more-menu {
  position: fixed;
  background: rgba(22, 32, 46, 0.97); border: 0.5px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  z-index: 200; min-width: 200px;
  animation: ddrop-in 0.15s ease;
}
.ev-more-item-row {
  display: flex; align-items: stretch;
}
.ev-more-item-row .ev-more-item {
  flex: 1;
}
.ev-more-info-btn {
  padding: 0 14px; border: none; border-left: 0.5px solid var(--border);
  background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ev-more-info-btn:active { background: rgba(255,255,255,0.05); }
.ev-more-info-btn svg { display: block; }
.ev-more-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 15px;
  background: transparent; border: none;
  font-family: "DM Sans", sans-serif; font-size: 14px; font-weight: 500;
  color: var(--text); text-align: left; cursor: pointer;
  transition: background 0.1s;
}
.ev-more-item svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--muted); }
.ev-more-item:hover, .ev-more-item:active { background: rgba(255,255,255,0.06); }
.ev-more-dead { opacity: 0.35; cursor: default; pointer-events: none; }
.ev-nav-right { display: flex; align-items: center; gap: 6px; }
.ev-map-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px 7px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: none;
  font-family: "DM Sans", sans-serif; font-size: 13px; font-weight: 400;
  color: rgba(255,255,255,0.7); cursor: pointer;
}
.ev-map-btn:active { opacity: 0.7; }

.ev-photos {
  display: grid; gap: 3px;
  height: 220px;
  padding: 0 12px 12px;
}
.ev-photos > div {
  border-radius: 10px;
  background: center/cover no-repeat;
  box-shadow: 0 2px 12px rgba(0,0,0,0.28);
}
/* 1 photo — full width */
.ev-photos-1 { grid-template-columns: 1fr; }
/* 2 photos — 50/50 */
.ev-photos-2 { grid-template-columns: 1fr 1fr; }
/* 3 photos — large left, two stacked right */
.ev-photos-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.ev-photos-3 > div:first-child { grid-row: 1 / 3; }
/* Coordinate label — bottom-right of largest photo (or SVG track hero) */
.ev-coord-label {
  position: absolute; bottom: 7px; right: 9px;
  font-family: monospace; font-size: 9.5px; letter-spacing: 0.3px;
  color: rgba(255,255,255,0.72);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
/* Route map hero (0 photos) */
.ev-photos-route { display: block; overflow: hidden; padding: 0 12px 12px; }
.ev-photos-route svg { display: block; width: 100%; height: 220px; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.28); }

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

.ev-trail-name {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px; font-weight: 600; color: #fff;
  line-height: 1.15; margin: 0 0 3px;
}
.ev-meta {
  font-family: "DM Sans", sans-serif;
  font-size: 12px; font-weight: 400;
  color: rgba(255,255,255,0.35); margin-bottom: 16px;
}

/* Stats block */
.ev-stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(0,0,0,0.2); border-radius: 12px;
  overflow: hidden; margin-top: 16px; margin-bottom: 16px;
}
.ev-stat-cell {
  padding: 10px 4px; text-align: center; position: relative;
}
/* Vertical cell dividers (not on 4th in each row) */
.ev-stat-cell:not(:nth-child(4n))::after {
  content: ""; position: absolute;
  right: 0; top: 15%; bottom: 15%;
  width: 0.5px; background: rgba(255,255,255,0.06);
}
/* Horizontal divider between rows */
.ev-stat-cell.ev-numeric {
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
/* Row 1 — numeric: Playfair, amber */
.ev-stat-cell.ev-numeric .ev-stat-value {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px; font-weight: 500;
  color: #f5a623; line-height: 1;
}
.ev-stat-cell.ev-numeric .ev-stat-unit {
  font-family: "DM Sans", sans-serif;
  font-size: 9px; color: rgba(245,166,35,0.5);
}
/* Row 2 — text: DM Sans, dimmed white */
.ev-stat-cell:not(.ev-numeric) .ev-stat-value {
  font-family: "DM Sans", sans-serif;
  font-size: 12px; font-weight: 400;
  color: rgba(255,255,255,0.65); line-height: 1.2; word-break: break-word;
}
.ev-stat-label {
  font-family: "DM Sans", sans-serif;
  font-size: 9px; font-weight: 400; letter-spacing: 0.05em;
  text-transform: uppercase; color: rgba(255,255,255,0.28); margin-top: 2px;
}

/* Weather bar — sits between date/loc and stats grid */
.ev-weather { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 9px 16px; margin: 8px -16px 0; background: rgba(255,255,255,0.04); border-top: 0.5px solid rgba(255,255,255,0.06); border-bottom: 0.5px solid rgba(255,255,255,0.06); font-size: 12px; color: rgba(255,255,255,0.6); }
.ev-wx-dot { margin: 0 2px; opacity: 0.35; }

/* Post-save success sheet action buttons */
.ss-trail-name { font-family: "Playfair Display", serif; font-size: 19px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.ss-trail-meta { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.ss-actions { display: flex; flex-direction: column; gap: 3px; margin: 20px 0 14px; }
.ss-action-btn { display: flex; align-items: center; gap: 13px; width: 100%; background: rgba(255,255,255,0.05); border: none; border-radius: 11px; color: var(--text); font-size: 15px; font-family: "DM Sans", sans-serif; font-weight: 500; padding: 14px 16px; cursor: pointer; text-align: left; }
.ss-action-btn:active { background: rgba(255,255,255,0.1); }
.ss-action-btn svg { opacity: 0.65; flex-shrink: 0; }
.ss-done-btn { display: block; width: 100%; background: none; border: none; color: var(--muted); font-size: 14px; font-family: "DM Sans", sans-serif; padding: 6px; cursor: pointer; text-align: center; }
/* Post-save badge celebration modal */
.save-cheer { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); padding: 24px; }
.save-cheer[hidden] { display: none !important; }
.save-cheer-card { width: 100%; max-width: 360px; max-height: 85vh; overflow-y: auto; overscroll-behavior: contain; background: #1a2233; border-radius: 18px; border: 0.5px solid rgba(255,255,255,0.14); padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,0.7); animation: cheerFadeIn 0.2s ease; }
@keyframes cheerFadeIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sc-title { font-family: "DM Sans", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.sc-close { background: rgba(255,255,255,0.08); border: none; color: rgba(255,255,255,0.6); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.sc-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 0.5px solid rgba(255,255,255,0.07); }
.sc-badge-img-wrap { flex-shrink: 0; width: 48px; height: 48px; }
.sc-badge-img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; }
.sc-badge-info { flex: 1; min-width: 0; }
.sc-pack-lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.3); margin-bottom: 3px; }
.sc-badge-name { font-family: "DM Sans", sans-serif; font-size: 16px; font-weight: 600; color: rgba(255,255,255,0.92); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-dots { font-size: 12px; letter-spacing: 4px; margin-bottom: 4px; }
.sc-dot-on { color: var(--accent); }
.sc-dot-off { color: rgba(255,255,255,0.18); }
.sc-badge-status { font-size: 11px; color: rgba(255,255,255,0.35); }
.sc-complete .sc-badge-name { color: var(--accent); }
.sc-complete .sc-badge-status { color: rgba(245,166,35,0.6); font-weight: 600; }

/* Badge chips */
.ev-badges {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 0.5px solid rgba(255,255,255,0.07);
}
.ev-badge-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  background: rgba(245,166,35,0.12);
  border: 0.5px solid rgba(245,166,35,0.3);
  font-family: "DM Sans", sans-serif; font-size: 10px;
  color: #f5a623;
}
.ev-diamond { font-size: 8px; }
.ev-diamond-on { color: #f5a623; }
.ev-diamond-off { color: rgba(255,255,255,0.25); }

/* AI title — only when no user journal */
.ev-ai-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 16px; font-weight: 400; font-style: italic;
  color: #f5a623; opacity: 0.85;
  margin-bottom: 8px; line-height: 1.3;
}

/* Journal text */
.ev-journal {
  font-family: "DM Sans", sans-serif;
  font-size: 14px; font-weight: 400;
  color: rgba(255,255,255,0.75); line-height: 1.8;
}
.ev-journal.ev-journal-fallback {
  color: rgba(255,255,255,0.4);
  font-style: italic;
}

/* ---------- Photo lightbox ---------- */
#photoLightbox {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
}
#photoLightbox[hidden] { display: none; }
#lightboxClose {
  position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none;
  color: #fff; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 1;
}
#lightboxClose:active { background: rgba(255,255,255,0.25); }
#lightboxImg {
  max-width: 100%; max-height: 90dvh;
  border-radius: 14px; object-fit: contain;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 400px;
  z-index: 200;
  display: flex;
  align-items: center;
  background: rgba(46, 63, 79, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 5px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.bottom-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 2px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-tab svg { width: 20px; height: 20px; flex-shrink: 0; }
.bottom-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottom-tab:hover { color: var(--text); }
.bottom-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.bottom-add {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #1e2d3a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 3px;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.bottom-add svg { width: 20px; height: 20px; }
.bottom-add:active { transform: scale(0.93); }

/* legacy .tab class (kept for JS compat — bottom-tab handles visual) */
.tab { border: none; background: none; font: inherit; cursor: pointer; }

.filters { display: flex; align-items: center; gap: 12px; }
.filter { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.filter select {
  font: inherit;
  font-weight: 500;
  color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface);
  cursor: pointer;
}
.filter select option { background: #253545; color: #fff; }

/* Activity filter pills — same language as the modal pill */
.seg { display: inline-flex; gap: 7px; }
.refresh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border: 0.5px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.refresh-btn svg { width: 16px; height: 16px; }
.refresh-btn:hover { color: var(--text); }
.refresh-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.back-to-log-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px 7px 10px; border-radius: 999px; flex-shrink: 0;
  border: 0.5px solid var(--border); background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer;
}
.back-to-log-btn:hover { color: var(--text); }
/* ---------- Settings gear + dropdown ---------- */
.settings-menu { position: relative; display: inline-flex; }

.settings-gear-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border: 0.5px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.25s;
}
.settings-gear-btn svg { width: 16px; height: 16px; }
.settings-gear-btn:hover { color: var(--text); border-color: var(--text); }
.settings-gear-btn.open { color: var(--accent); border-color: var(--accent); transform: rotate(45deg); }

.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: rgba(22, 32, 46, 0.97);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  z-index: 300;
  animation: ddrop-in 0.15s ease;
}
@keyframes ddrop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 15px;
  background: transparent; border: none;
  color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background 0.1s;
}
.settings-item svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--muted); }
.settings-item:hover { background: rgba(255,255,255,0.06); }
.settings-item.settings-item-danger { color: #f87171; }
.settings-item.settings-item-danger svg { color: #f87171; }
.settings-item.settings-item-danger:hover { background: rgba(248,113,113,0.08); }
.settings-item.settings-item-delete { color: #f87171; opacity: 0.55; font-size: 13px; }
.settings-item.settings-item-delete svg { color: #f87171; }
.settings-item.settings-item-delete:hover { background: rgba(248,113,113,0.06); opacity: 1; }

/* Account / profile modal */
.account-modal-card {
  max-width: 320px;
  width: calc(100% - 48px);
  padding: 28px 24px 20px;
}
.account-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--text);
  text-align: center;
}
.account-field { margin-bottom: 14px; }
.account-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.account-field-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
}
.account-field-input:focus { border-color: var(--accent); }
.account-email-display {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  padding: 4px 2px;
}
.account-save-btn {
  width: 100%;
  padding: 11px 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 6px;
  transition: opacity 0.15s;
}
.account-save-btn:active { opacity: 0.75; }
.account-save-btn:disabled { opacity: 0.45; cursor: default; }
.account-save-msg {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 8px;
}
.account-sep { height: 0.5px; background: var(--border); margin: 14px 0 10px; }
.account-delete-btn {
  width: 100%;
  padding: 9px 0;
  background: none;
  border: none;
  color: #f87171;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  margin-bottom: 4px;
}
.account-delete-btn:hover { background: rgba(248,113,113,0.08); }
.account-cancel-btn {
  width: 100%;
  padding: 9px 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.account-cancel-btn:hover { background: rgba(255,255,255,0.05); }
.account-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.account-service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.account-service-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.account-service-name { font-size: 14px; font-weight: 500; }
.account-service-btn {
  padding: 6px 14px;
  background: var(--amber);
  color: #000;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.account-service-btn:disabled { opacity: 0.55; cursor: default; }
.account-service-btn-connected { background: rgba(255,255,255,0.1); color: var(--text-muted); }

/* Delete account modal */
.delete-confirm-card {
  max-width: 320px;
  width: calc(100% - 48px);
  padding: 28px 24px 20px;
  text-align: center;
}
.delete-confirm-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}
.delete-confirm-body {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}
.delete-confirm-warning { color: #f87171; }
.delete-confirm-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(248,113,113,0.4);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  text-align: center;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  outline: none;
}
.delete-confirm-input:focus { border-color: #f87171; }
.delete-confirm-actions {
  display: flex;
  gap: 10px;
}
.delete-confirm-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.delete-confirm-btn:active { opacity: 0.7; }
.delete-confirm-btn-cancel {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.delete-confirm-btn-danger {
  background: #f87171;
  color: #fff;
}
.delete-confirm-btn-danger:disabled {
  opacity: 0.4;
  cursor: default;
}
.delete-confirm-msg {
  font-size: 13px;
  color: #f87171;
  margin: 12px 0 0;
}

.settings-sep { height: 0.5px; background: var(--border); margin: 0 10px; }
.settings-home-btn {
  background: rgba(255,255,255,0.07);
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.settings-home-btn:hover { background: rgba(255,255,255,0.13); color: var(--text); }
.settings-home-btn:disabled { opacity: 0.5; cursor: default; }
.settings-home-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.settings-home-sub { font-size: 10px; color: var(--muted); line-height: 1.3; }
.settings-units-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}
.settings-units-row > svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--muted); }
.settings-units-label { font-size: 13px; color: var(--text); flex: 1; }
.settings-units-toggle {
  display: flex;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.units-opt {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.units-opt.active { background: var(--amber); color: #1a1a2e; }
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.seg-btn svg { width: 14px; height: 14px; }
.seg-btn[data-hb="Hike"] { color: var(--hike-bright); border-color: rgba(245, 166, 35, 0.4); }
.seg-btn[data-hb="Bike"] { color: var(--bike-bright); border-color: rgba(184, 74, 24, 0.4); }
.seg-btn[data-hb=""].active { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: transparent; }
.seg-btn[data-hb="Hike"].active { background: var(--hike-soft); color: var(--hike-bright); border-color: rgba(245, 166, 35, 0.55); }
.seg-btn[data-hb="Bike"].active { background: var(--bike-soft); color: var(--bike-bright); border-color: rgba(184, 74, 24, 0.5); }

/* ---------- Mobile spacing ---------- */
/* (mobile overrides moved to end of file so they win the cascade) */

/* ---------- Panels & cards ---------- */
main { padding: 20px 16px calc(90px + env(safe-area-inset-bottom, 0px)); }
.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}
.card h3 {
  margin: 0 0 12px;
  font-family: "DM Sans", "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.7);
}

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }   /* Totals accent cards */
.pkpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }   /* Personal Stats top KPIs — stays 4 across */
@media (max-width: 1200px) { .cols-6 { grid-template-columns: repeat(3, minmax(0,1fr)); } .cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 1000px) { .cols-2, .cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } .stat-row { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 680px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .cols-6 { grid-template-columns: repeat(3, minmax(0,1fr)); } }

.section-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  color: var(--text-strong);
  margin: 4px 0 16px;
}
.chart { width: 100%; min-width: 0; height: 260px; }
.chart.tall { height: 320px; }

/* ---------- KPI cards ---------- */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .kpi-label { font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); }
.kpi .kpi-value { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 30px; line-height: 1.1; color: var(--text-strong); }
.kpi .kpi-value .u { font-size: 14px; color: var(--muted); font-family: "DM Sans", sans-serif; font-weight: 300; margin-left: 4px; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.kpi.accent-hike { border-left: 2px solid var(--accent); }
.kpi.accent-bike { border-left: 2px solid var(--bike); }

/* ---------- Totals: hero banner ---------- */
.hero-banner {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 18px;
  background-color: var(--bg-deep);
  background-size: cover;
  background-position: center;
}
.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(46,63,79,0.45) 0%, transparent 40%),
    linear-gradient(to bottom, rgba(46,63,79,0.15) 0%, rgba(46,63,79,0.0) 30%, rgba(46,63,79,0.0) 55%, rgba(46,63,79,0.9) 90%, rgba(46,63,79,1.0) 100%);
}
.hero-content { position: relative; z-index: 1; padding: 30px 34px; }
.hero-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.55); font-weight: 500; }
.hero-title { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 42px; color: #fff; margin: 8px 0 14px; line-height: 1; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 26px; font-size: 15px; color: rgba(255,255,255,0.6); }
.hero-stats b { color: #fff; font-weight: 600; }
@media (max-width: 680px) { .hero-title { font-size: 32px; } .hero-stats { gap: 16px; font-size: 13px; } }

/* ---------- Totals: accent stat cards ---------- */
.stat-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px; padding: 18px; min-width: 0; }
.sc-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); font-weight: 500; }
.sc-value { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 38px; color: #fff; line-height: 1; margin-top: 8px; }
.sc-value span { font-family: "DM Sans", sans-serif; font-weight: 300; font-size: 16px; color: var(--muted); margin-left: 5px; }
.sc-sub { font-size: 13px; color: var(--muted); margin-top: 10px; }
.sc-extra { font-size: 12.5px; color: var(--muted-dim); margin-top: 4px; }
.sc-split { display: flex; height: 6px; border-radius: 999px; overflow: hidden; margin-top: 14px; gap: 2px; }
.sc-split span { display: block; height: 100%; border-radius: 999px; }
.sc-splitlabels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- Totals: composite cards ---------- */
.totals-r2 { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 14px; }
.totals-r3 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1000px) { .totals-r2, .totals-r3 { grid-template-columns: 1fr; } }

.toplist { display: flex; flex-direction: column; }
.toplist-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 0.5px solid rgba(255,255,255,0.05); }
.toplist-row:last-child { border-bottom: none; }
.toplist-row.clickable { cursor: pointer; }
.toplist-row.clickable:hover .toplist-name { color: #fff; }
.toplist-name { flex: 1; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toplist-rank { font-size: 11px; font-weight: 600; color: var(--muted-dim); min-width: 18px; flex-shrink: 0; letter-spacing: 0.02em; }
.toplist-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.toplist-val { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13.5px; }

.hvb-top { display: flex; align-items: center; gap: 8px; }
.hvb-top .chart { height: 175px; flex: 1; min-width: 0; }
.hvb-legend { display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; }
.hvb-legrow { display: flex; align-items: flex-start; gap: 8px; }
.hvb-legrow .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.hvb-legrow .dot.hike { background: var(--hike-bright); }
.hvb-legrow .dot.bike { background: var(--bike-bright); }
.hvb-n { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 22px; color: #fff; }
.hvb-n span { font-family: "DM Sans", sans-serif; font-size: 12px; font-weight: 300; color: var(--muted); margin-left: 3px; }
.hvb-l { font-size: 12px; color: var(--muted); }
.hvb-divider { height: 0.5px; background: var(--border-soft); margin: 16px 0; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { background: rgba(255,255,255,0.03); border: 0.5px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; }
.mini b { display: block; font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 22px; color: #fff; line-height: 1; }
.mini span { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-dim); display: block; margin-top: 6px; }
.by-year { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 48px; color: #fff; line-height: 1; }
.by-sub { font-size: 14px; color: var(--muted); margin-top: 8px; }

.group-head { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; cursor: pointer; user-select: none; }
.group-head .gh-chevron { margin-left: auto; color: var(--muted-dim); transition: transform 0.2s; flex-shrink: 0; }
.group-head.collapsed .gh-chevron { transform: rotate(-90deg); }
.group-head .gh-icon { width: 28px; height: 28px; }
.group-head .gh-icon.hike { color: var(--hike); }
.group-head .gh-icon.bike { color: var(--bike); }
.group-head h2 { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 20px; color: var(--text-strong); margin: 0; }

/* ---------- Record photo cards ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1000px) { .rec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .rec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.rec-card {
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.10);
}
.rec-card.clickable { cursor: pointer; transition: background 0.15s; }
.rec-card.clickable:hover { background: rgba(255, 255, 255, 0.07); }
.rec-photo {
  height: 100px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-deep);
  position: relative;
}
.rec-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(46, 63, 79, 0) 0%, rgba(46, 63, 79, 0.80) 100%);
}
.rec-body { padding: 12px 14px 14px; }
.rec-sub { font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); }
.rec-val { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 26px; color: #fff; line-height: 1.1; margin-top: 3px; }
.rec-val .u { font-family: "DM Sans", sans-serif; font-weight: 300; font-size: 12px; color: var(--muted); margin-left: 4px; }
.rec-trail { font-size: 12px; color: var(--muted); margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-date { font-size: 11px; color: var(--muted-dim); margin-top: 2px; }

/* ---------- Geography ---------- */
.geo-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-auto-rows: minmax(220px, auto);
  gap: 14px;
}
.map-card { grid-column: span 2; grid-row: span 2; position: relative; padding: 0; overflow: hidden; min-height: 460px; }
#map { position: absolute; inset: 0; background: var(--bg); }
@media (max-width: 1000px) {
  .geo-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .map-card { grid-column: span 2; grid-row: auto; }
}
@media (max-width: 680px) {
  .geo-grid { grid-template-columns: 1fr; }
  .map-card { grid-column: span 1; }
}
/* full-bleed map (Geography tab) — panel fills the full viewport; topbar + nav float above */
.panel[data-panel="geography"].active {
  position: fixed;
  inset: 0;
  z-index: 90;
}
.map-full { margin: 0; border-radius: 0; border: none; padding: 0; height: 100%; min-height: 0; }
/* Hide topbar border when map is active so there's no divider line above the map */
.map-tab-active .topbar { border-bottom-color: transparent; }
/* OL controls: zoom top-left, rotate (north) below zoom on the left */
.ol-zoom   { top: 14px  !important; left: 12px !important; }
.ol-rotate { top: 100px !important; left: 12px !important; right: auto !important; }
/* When map is full-screen, push controls below the floating topbar */
.map-tab-active .ol-zoom   { top: calc(var(--topbar-h) + 10px) !important; }
.map-tab-active .ol-rotate { top: calc(var(--topbar-h) + 96px) !important; }
.map-tab-active .legend    { top: calc(var(--topbar-h) + 10px); }
/* Attribution: hide behind the center of the bottom nav pill */
.ol-attribution { bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important; right: 50% !important; transform: translateX(50%) !important; left: auto !important; }

/* ---------- Trail Details — list-row cards ---------- */
.tools { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font: inherit;
  font-size: 16px; /* 16px+ prevents iOS auto-zoom on focus */
  background: var(--surface);
  color: var(--text);
}
.search::placeholder { color: var(--muted-dim); }
.sortsel {
  font: inherit; font-weight: 500; font-size: 16px; color: var(--text);
  border: 0.5px solid var(--border); border-radius: 10px; padding: 9px 12px;
  background: var(--surface); cursor: pointer;
}
.sortsel option { background: #253545; color: #fff; }

.tl-list { display: flex; flex-direction: column; gap: 10px; }
.tl-row {
  display: flex;
  align-items: stretch;
  min-height: 92px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.tl-row:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.18); }
.tl-photo {
  position: relative;
  width: 150px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-deep);
}
.tl-photo::after { display: none; }
.tl-gpx-badge {
  position: absolute;
  bottom: 5px;
  right: 5px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(46,63,79,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-gpx-badge svg { width: 13px; height: 13px; }
.tl-gpx-badge.hike { border: 1px solid rgba(245,166,35,0.5); color: #f5a623; }
.tl-gpx-badge.bike { border: 1px solid rgba(196,112,60,0.5); color: #c4703a; }
.tl-main { flex: 1; min-width: 0; padding: 14px 18px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.tl-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tl-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 22px; border-radius: 999px;
}
.tl-pill svg { width: 14px; height: 14px; }
.tl-pill.hike { color: var(--hike-bright); background: var(--hike-soft); border: 0.5px solid rgba(245,166,35,0.5); }
.tl-pill.bike { color: var(--bike-bright); background: var(--bike-soft); border: 0.5px solid rgba(184,74,24,0.5); }
.tl-name { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 21px; color: var(--text-strong); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-right { flex-shrink: 0; padding: 14px 22px; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.tl-miles { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 28px; color: var(--text-strong); line-height: 1; }
.tl-unit { font-size: 12px; color: var(--muted-dim); margin-top: 3px; }
.tl-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.tl-badgecount { font-size: 11px; color: var(--muted); margin-top: 7px; letter-spacing: 0.02em; }
.adv-badge.r-uncommon { border-color: rgba(90,138,191,0.45); }
.adv-badge.r-rare { border-color: rgba(155,107,191,0.5); }
.adv-badge.r-legendary { border-color: rgba(212,168,75,0.55); color: #e9cd7d; }

/* ---------- Badges tab ---------- */
.badge-overview { margin-bottom: 22px; }
.badge-earn-heading { font-size: 13px; font-weight: 700; color: var(--text-strong); margin-bottom: 5px; letter-spacing: 0.01em; }
.badge-earn-desc { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 14px; }
.badge-summary { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.badge-prog-bar-wrap { display: flex; align-items: center; gap: 10px; }
.badge-prog-bar-track { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.badge-prog-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s ease; }
.badge-prog-pct { font-size: 11px; font-weight: 500; color: var(--muted-dim); letter-spacing: 0.04em; white-space: nowrap; }

/* Pack sections */
.pack-section { margin-bottom: 28px; }
.pack-section:last-child { margin-bottom: 0; }
.pack-locked { opacity: 0.35; pointer-events: none; }

.pack-header-left { flex: 1; min-width: 0; }
.pack-name { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 28px; color: var(--text-headline); display: flex; align-items: center; gap: 8px; line-height: 1.1; }
.pack-lock-icon { width: 18px; height: 18px; color: var(--muted-dim); flex-shrink: 0; }
.pack-eyebrow { font-family: "DM Sans", sans-serif; font-size: 10px; font-weight: 500; letter-spacing: 0.1em; color: var(--muted); margin-top: 5px; }
.pack-unlock-note { font-size: 11px; color: var(--muted-dim); margin-top: 5px; font-style: italic; }
.pack-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }

/* Badge pack header — clickable drawer toggle */
.pack-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; cursor: pointer; user-select: none; }
.pack-chevron { color: var(--muted); flex-shrink: 0; margin-top: 6px; transition: transform 0.25s ease; }
.pack-chevron.pack-chevron-open { transform: rotate(180deg); }
.pack-locked .pack-header { cursor: default; }

/* Collapsible pack body */
.pack-body { overflow: hidden; max-height: 2000px; transition: max-height 0.3s ease; }
.pack-body.pack-body-collapsed { max-height: 0; }

/* Badge card grid — 4 columns */
.badge-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.badge-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: background 0.2s, border-color 0.2s, transform 0.15s; }
.badge-card.bc-empty .bc-name { color: var(--muted-dim); }
.badge-card.bc-progress { border-color: var(--border-warm); }
.badge-card.bc-progress .bc-name { color: var(--text-strong); }
.badge-card.bc-achieved { border-color: rgba(245,166,35,0.5); background: rgba(245,166,35,0.05); }
.badge-card.bc-achieved .bc-name { color: var(--text-headline); font-weight: 600; }
.badge-card:hover { transform: translateY(-2px); border-color: var(--accent); }

/* Badge patch image */
.bc-img-wrap { width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; }
.bc-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; transition: filter 0.4s ease; display: block; }

/* Stone pips — 5 dots showing progress */
.bc-pips { display: flex; gap: 5px; align-items: center; justify-content: center; }
.bc-pip { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2); transition: background 0.3s; }
.bc-pip.filled { background: var(--accent); border-color: var(--accent); }

.bc-name { font-family: "Playfair Display", Georgia, serif; font-size: 10px; line-height: 1.25; color: var(--muted); width: 100%; }
.bc-status { font-size: 9px; color: var(--muted-dim); letter-spacing: 0.02em; }
.bc-desc { font-size: 9px; color: var(--muted-dim); line-height: 1.4; }
.bc-done { font-size: 9px; color: var(--accent); }

/* Stone SVG */
.stone-svg { display: block; overflow: visible; }

/* Modal stone chips */
.m-badges { display: flex; flex-direction: column; gap: 7px; }
.stone-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.stone-chip-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; transition: filter 0.3s; }
.stone-chip-name { font-size: 13px; font-weight: 500; color: var(--text-strong); min-width: 0; flex: 1; }
.stone-chip-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; opacity: 0; animation: fadeStoneLabel 0.4s ease 0.1s forwards; }
.stone-chip-complete .stone-chip-label { color: var(--accent); }
@keyframes fadeStoneLabel { to { opacity: 1; } }

/* Strava import sheet */
.strava-sheet-card { border-radius: 20px 20px 0 0; padding: 0; max-height: 80vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.strava-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; border-bottom: 0.5px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.strava-sheet-title { font-size: 16px; font-weight: 700; color: #fff; }
.strava-connect-body { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 36px 24px; text-align: center; }
.strava-connect-body[hidden] { display: none !important; }
.strava-logo { width: 56px; height: 56px; }
.strava-connect-msg { font-size: 14px; color: rgba(255,255,255,0.55); line-height: 1.5; max-width: 260px; }
.strava-connect-btn { background: #FC4C02; color: #fff; border: none; border-radius: 12px; padding: 14px 28px; font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer; width: 100%; max-width: 280px; }
.strava-connect-btn:hover { background: #e04400; }
.strava-loading-body { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 24px; }
.strava-loading-body[hidden] { display: none !important; }
.strava-spinner { width: 32px; height: 32px; border: 3px solid rgba(255,255,255,0.12); border-top-color: #FC4C02; border-radius: 50%; animation: spin 0.8s linear infinite; }
.strava-loading-msg { font-size: 13px; color: rgba(255,255,255,0.45); }
.strava-list-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.strava-list-body[hidden] { display: none !important; }
.strava-list-hint { font-size: 12px; color: rgba(255,255,255,0.35); padding: 10px 20px 6px; flex-shrink: 0; }
.strava-activities { flex: 1; overflow-y: auto; }
.strava-activities::-webkit-scrollbar { width: 0; }
.strava-activity-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; border-bottom: 0.5px solid rgba(255,255,255,0.06); }
.strava-activity-row:last-child { border-bottom: none; }
.strava-activity-row:hover, .strava-activity-row:active { background: rgba(255,255,255,0.06); }
.strava-act-icon { width: 14px; height: 14px; flex-shrink: 0; }
.strava-act-icon.hike { color: var(--hike); }
.strava-act-icon.bike { color: var(--bike-bright); }
.strava-act-info { flex: 1; min-width: 0; }
.strava-act-name { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strava-act-meta { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }
.strava-act-arrow { color: rgba(255,255,255,0.25); font-size: 18px; flex-shrink: 0; }
.strava-error-body { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 36px 24px; text-align: center; }
.strava-error-body[hidden] { display: none !important; }
.strava-error-msg { font-size: 14px; color: rgba(255,255,255,0.55); }

/* Import source picker sheet */
.import-source-card { border-radius: 20px 20px 0 0; padding: 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.import-source-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; border-bottom: 0.5px solid rgba(255,255,255,0.08); }
.import-source-card .close { position: static; width: 32px; height: 32px; font-size: 20px; flex-shrink: 0; }
.import-source-title { font-size: 16px; font-weight: 700; color: #fff; }
.import-source-list { display: flex; flex-direction: column; padding: 8px 0 12px; }
.import-source-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: none; border: none; color: #fff; text-align: left; cursor: pointer; transition: background 0.15s; }
.import-source-row:hover, .import-source-row:active { background: rgba(255,255,255,0.06); }
.import-source-row.import-source-dead { opacity: 0.38; cursor: default; }
.import-source-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.import-source-icon-health { background: rgba(255,55,75,0.15); }
.import-source-icon-garmin { background: rgba(0,170,130,0.15); color: #00aa82; }
.import-source-icon-strava { background: rgba(252,76,2,0.15); color: #fc4c02; }
.import-source-name { flex: 1; font-size: 15px; font-weight: 600; }
.import-source-soon { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.08); border-radius: 6px; padding: 3px 7px; letter-spacing: 0.03em; text-transform: uppercase; }

/* Post format entry banner */
/* banner sits inside the landing which already has 18px h-padding — no extra margin needed */
.print-landing .post-format-entry-banner { margin-left: 0; margin-right: 0; }
.post-format-entry-banner {
  margin: 0 18px 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.6);
  display: flex; align-items: center; gap: 8px;
}
.post-format-entry-banner::before {
  content: "";
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); flex-shrink: 0;
}

/* GPX info sheet */
.gpx-info-body { padding: 20px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.gpx-info-text { font-size: 14px; line-height: 1.6; color: rgba(255,255,255,0.75); }
.gpx-info-link-btn {
  display: block; width: 100%; padding: 13px 18px; border-radius: 10px;
  background: var(--accent, #c9a84c); border: none;
  font-family: "DM Sans", sans-serif; font-size: 14px; font-weight: 600;
  color: #1a1a1a; cursor: pointer; text-align: center;
}
.gpx-info-link-btn:active { opacity: 0.8; }

/* Health import sheet */
.health-sheet-card { border-radius: 20px 20px 0 0; padding: 0; max-height: 80vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.health-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; border-bottom: 0.5px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.health-sheet-card .close { position: static; width: 32px; height: 32px; font-size: 20px; flex-shrink: 0; }
.health-sheet-title { font-size: 16px; font-weight: 700; color: #fff; }
.health-loading-body { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 24px; }
.health-loading-body[hidden] { display: none !important; }
.health-loading-msg { font-size: 13px; color: rgba(255,255,255,0.45); }
.health-list-body { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.health-list-body[hidden] { display: none !important; }
.health-list-hint { font-size: 12px; color: rgba(255,255,255,0.35); padding: 10px 20px 6px; flex-shrink: 0; }
.health-workouts { flex: 1; overflow-y: auto; }
.health-workouts::-webkit-scrollbar { width: 0; }
.health-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; border-bottom: 0.5px solid rgba(255,255,255,0.06); }
.health-row:last-child { border-bottom: none; }
.health-row:hover, .health-row:active { background: rgba(255,255,255,0.06); }
.health-row-type { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; flex-shrink: 0; }
.health-row-type.hike { background: rgba(245,166,35,0.15); color: var(--hike); }
.health-row-type.bike { background: rgba(184,74,24,0.15); color: var(--bike-bright); }
.health-row-date { font-size: 13px; color: rgba(255,255,255,0.75); flex: 1; }
.health-row-stats { font-size: 12px; color: rgba(255,255,255,0.4); white-space: nowrap; }
.health-error-body { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 36px 24px; text-align: center; }
.health-error-body[hidden] { display: none !important; }
.health-error-msg { font-size: 14px; color: rgba(255,255,255,0.55); }

/* Badge entry sheet */
.bs-back-cheer { display: block; background: none; border: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 14px 20px 0; text-align: left; }
.bs-back-cheer[hidden] { display: none !important; }
.badge-sheet-card { border-radius: 20px 20px 0 0; padding: 0; max-height: 72vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.badge-sheet-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 32px 24px 20px; border-bottom: 0.5px solid rgba(255,255,255,0.08); }
.badge-sheet-icon { line-height: 0; }
.bs-badge-img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.badge-sheet-name { font-size: 20px; font-weight: 700; color: #fff; margin-top: 4px; }
.badge-sheet-desc { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 3px; line-height: 1.4; }
.badge-sheet-count { font-size: 12px; color: rgba(255,255,255,0.35); margin-top: 4px; }
.badge-sheet-list { flex: 1; overflow-y: auto; }
.badge-sheet-list::-webkit-scrollbar { width: 0; }
.bs-entry { display: flex; align-items: center; gap: 10px; padding: 14px 20px; cursor: pointer; border-bottom: 0.5px solid rgba(255,255,255,0.06); }
.bs-entry:last-child { border-bottom: none; }
.bs-entry:hover, .bs-entry:active { background: rgba(255,255,255,0.06); }
.bs-icon { width: 14px; height: 14px; flex-shrink: 0; }
.bs-icon.hike { color: var(--hike); }
.bs-icon.bike { color: var(--bike-bright); }
.bs-trail { flex: 1; font-size: 14px; font-weight: 500; color: #fff; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-date { font-size: 12px; color: rgba(255,255,255,0.5); white-space: nowrap; flex-shrink: 0; margin-left: 4px; }
.bs-arrow { color: rgba(255,255,255,0.3); margin-left: 6px; font-size: 18px; line-height: 1; flex-shrink: 0; }

@media (max-width: 600px) {
  .tl-row { min-height: 0; }
  .tl-photo { width: 82px; }
  .tl-main { padding: 12px 12px; }
  .tl-name {
    font-size: 17px;
    white-space: normal;               /* wrap instead of truncating to a few letters */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .tl-meta { white-space: normal; font-size: 12px; line-height: 1.45; }
  .tl-right { padding: 12px 14px; }
  .tl-miles { font-size: 22px; }
}

/* ---------- Map legend (dark glass) ---------- */
.legend {
  position: absolute; right: 12px; top: 14px; left: auto; z-index: 5;
  /* .map-tab-active shifts this below the floating topbar (see below) */
  padding: 8px 13px 8px 11px; border-radius: 11px;
  background: rgba(46, 63, 79, 0.88); border: 0.5px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 500; color: var(--text);
}
.legend-row { display: flex; align-items: center; gap: 9px; line-height: 1.9; }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,0.85); }
.legend-dot.hike { background: var(--hike); }
.legend-dot.bike { background: var(--bike); }

.map-locate-btn {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: 12px;
  z-index: 190;
  top: auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(46,63,79,0.8);
  border: 0.5px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s;
}
.map-locate-btn svg { width: 18px; height: 18px; }
.map-locate-btn:hover { color: var(--accent); }
.map-locate-btn.locating { color: var(--accent); animation: pulse 0.8s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }

/* ======================================================================
   Trail detail modal (the reference surface — already dark)
   ====================================================================== */
.overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(18,28,38,0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.overlay[hidden] { display: none; }
.modal-card { position: relative; width: 100%; max-width: 430px; max-height: 94vh; overflow-y: auto; border-radius: 26px; background: linear-gradient(180deg, #2a3c4e 0%, #1e2e3c 60%); box-shadow: 0 30px 80px rgba(0,0,0,0.6); color: #fff; }
.modal-card::-webkit-scrollbar { width: 0; }
.close { position: absolute; top: 18px; left: 18px; z-index: 3; width: 38px; height: 38px; border: none; border-radius: 50%; background: rgba(30,44,58,0.65); backdrop-filter: blur(6px); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.close:hover { background: rgba(30,44,58,0.90); }
/* Badge sheet X moves to the right */
.badge-sheet-card .close { left: auto; right: 18px; }
.hero { position: relative; height: 236px; background-size: cover; background-position: center; background-color: var(--bg-deep); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30,44,58,0.10) 0%, rgba(30,44,58,0.30) 45%, #1e2e3c 100%); }
.badge-diff { position: absolute; top: 20px; right: 20px; z-index: 2; padding: 7px 15px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; backdrop-filter: blur(6px); }
.badge-diff.easy { color: #5dcaa5; background: rgba(29,158,117,0.18); border: 0.5px solid rgba(29,158,117,0.45); }
.badge-diff.moderate { color: var(--accent); background: var(--accent-dim); border: 0.5px solid var(--border-warm); }
.badge-diff.hard { color: #e07070; background: rgba(200,60,60,0.18); border: 0.5px solid rgba(200,60,60,0.4); }
.pill-type { position: absolute; left: 22px; bottom: 20px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 9px 17px 9px 15px; border-radius: 999px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; color: #f5a623; background: rgba(245,166,35,0.18); border: 0.5px solid rgba(245,166,35,0.5); backdrop-filter: blur(6px); }
.pill-type.bike { color: #c4703a; background: rgba(184,74,24,0.15); border-color: rgba(184,74,24,0.5); }
.pill-type svg { width: 16px; height: 16px; }
.modal-body { padding: 24px 30px 30px; }
.m-aititle { font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 500; font-size: 16px; color: var(--accent); margin-bottom: 4px; min-height: 1.1em; }
.m-title { margin: 2px 0 6px; font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 30px; line-height: 1.08; }
.m-loc { display: flex; align-items: flex-start; gap: 7px; color: #8b958c; font-size: 13px; margin-bottom: 14px; }
.m-loc svg { width: 15px; height: 15px; opacity: 0.85; flex-shrink: 0; margin-top: 1px; }
.m-loc-lines { display: flex; flex-direction: column; gap: 2px; }
.m-loc-state { color: rgba(255,255,255,0.75); font-size: 13px; font-weight: 500; }
.m-loc-meta { color: #8b958c; font-size: 12px; }
.m-rest { margin-top: 6px; }
.m-divider { height: 0.5px; background: rgba(255,255,255,0.1); margin: 16px 0; }
.m-narrative { font-size: 13.5px; color: rgba(255,255,255,0.7); line-height: 1.75; }
/* Notes section */
.m-notes-section { margin-top: 14px; }
.m-notes-section[hidden] { display: none !important; }
/* No-notes state: just a subtle "Add note" link row */
.m-notes-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.m-notes-header-left { display: flex; align-items: center; gap: 5px; }
.m-notes-chevron { width: 14px; height: 14px; flex-shrink: 0; color: #6e786f; display: none; transition: transform 0.2s; }
.m-notes-label { font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: #6e786f; }
.m-notes-edit-btn { background: none; border: none; cursor: pointer; padding: 2px 4px; display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12px; transition: color 0.15s; }
.m-notes-edit-btn[hidden] { display: none !important; }
.m-notes-edit-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
/* No notes: dim "Add note" prompt */
.m-notes-section:not(.has-notes) .m-notes-edit-btn { color: #6e786f; }
.m-notes-section:not(.has-notes) .m-notes-edit-btn:hover { color: #cfe0c4; }
.m-notes-section:not(.has-notes) .m-notes-label { display: none; }
/* Has notes: card-style callout, collapsible */
.m-notes-section.has-notes { background: rgba(255,255,255,0.04); border: 0.5px solid rgba(255,255,255,0.09); border-radius: 12px; padding: 12px 14px; }
.m-notes-section.has-notes .m-notes-header { cursor: pointer; user-select: none; }
.m-notes-section.has-notes .m-notes-chevron { display: block; }
.m-notes-section.has-notes .m-notes-label { color: #6e786f; }
.m-notes-section.has-notes .m-notes-edit-btn { color: var(--accent); font-size: 12px; font-weight: 500; }
.m-notes-section.has-notes .m-notes-edit-btn:hover { color: #cfe0c4; }
/* Collapsed: hide body, rotate chevron to point right */
.m-notes-section.has-notes.collapsed .m-notes-chevron { transform: none; }
.m-notes-section.has-notes:not(.collapsed) .m-notes-chevron { transform: rotate(90deg); }
.m-notes-section.has-notes.collapsed .m-notes-text,
.m-notes-section.has-notes.collapsed .m-notes-edit,
.m-notes-section.has-notes.collapsed .m-notes-edit-btn { display: none !important; }
.m-notes-text { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.7; white-space: pre-wrap; margin-top: 8px; }
.m-notes-edit { margin-top: 10px; }
.m-notes-edit[hidden] { display: none !important; }
.m-notes-textarea { width: 100%; box-sizing: border-box; background: rgba(255,255,255,0.05); border: 0.5px solid rgba(255,255,255,0.15); border-radius: 10px; color: var(--text); font: inherit; font-size: 13px; line-height: 1.65; padding: 10px 12px; resize: vertical; }
.m-notes-textarea:focus { outline: none; border-color: var(--border-warm); }
.m-notes-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.m-notes-cancel { background: none; border: 0.5px solid rgba(255,255,255,0.12); border-radius: 10px; color: var(--muted); font: inherit; font-size: 13px; padding: 7px 14px; cursor: pointer; }
.m-notes-save { background: var(--accent-dim); border: 0.5px solid var(--border-warm); border-radius: 10px; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 16px; cursor: pointer; }
.m-notes-save:disabled { opacity: 0.5; }
.m-notes-status { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: right; }
/* Add-form notes textarea */
.add-notes { width: 100%; box-sizing: border-box; background: rgba(255,255,255,0.05); border: 0.5px solid rgba(255,255,255,0.12); border-radius: 10px; color: var(--text); font: inherit; font-size: 14px; line-height: 1.6; padding: 9px 12px; resize: vertical; }
.add-notes:focus { outline: none; border-color: var(--border-warm); }
.m-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.m-stat { text-align: center; padding: 4px 6px; position: relative; }
.m-stat + .m-stat::before { content: ""; position: absolute; left: 0; top: 14%; height: 72%; width: 0.5px; background: rgba(255,255,255,0.1); }
.m-stat .num { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 30px; line-height: 1; }
.m-stat .unit { color: #8b958c; font-size: 14px; margin-top: 3px; }
.m-stat .lbl { color: #6e786f; font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 10px; }
.m-profile { margin-bottom: 26px; }
.m-profile-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: #8b958c; margin-bottom: 12px; }
.m-profile-head #gainLbl { color: var(--accent); letter-spacing: 0.06em; }
.bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3f8f5e 0%, #66c98c 100%); transition: width 0.5s ease; }
.m-footer { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; background: rgba(255,255,255,0.04); border: 0.5px solid rgba(255,255,255,0.06); }
.m-footer .check { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-dim); border: 0.5px solid var(--border-warm); color: var(--accent); font-size: 18px; font-weight: 700; }
.m-footer .ftext { flex: 1; }
.m-footer .fmain { font-weight: 600; font-size: 16px; }
.m-footer .fsub { color: #8b958c; font-size: 13px; margin-top: 2px; }
.m-footer .trophy { font-size: 22px; opacity: 0.85; }
.view-map-btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; margin-top: 16px; padding: 12px; border: 0.5px solid rgba(255,255,255,0.12); border-radius: 14px; background: rgba(255,255,255,0.04); color: #cfe0c4; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; transition: background 0.15s; }
.view-map-btn:hover { background: rgba(255,255,255,0.09); }
.view-map-btn svg { width: 16px; height: 16px; }
.view-at-btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; margin-top: 8px; padding: 11px; border: 0.5px solid rgba(255,255,255,0.1); border-radius: 14px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; transition: background 0.15s, color 0.15s; }
.view-at-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.view-at-btn svg { width: 15px; height: 15px; }
.view-at-btn[hidden] { display: none !important; }
.m-route { width: 100%; height: 88px; background: rgba(255,255,255,0.03); border: 0.5px solid var(--border); border-radius: 12px; margin: 6px 0 2px; }
.m-route[hidden] { display: none !important; }
.m-actions { display: flex; gap: 8px; margin-top: 16px; }
.m-actions .view-map-btn, .m-actions .view-at-btn { flex: 1; min-width: 0; margin-top: 0; padding: 11px 8px; font-size: 13px; white-space: nowrap; }
.m-bottom-actions { display: flex; justify-content: center; gap: 24px; margin-top: 14px; }
.m-gpx { padding: 4px 8px; border: none; background: none; color: var(--muted-dim); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.m-gpx:hover { color: var(--accent); }
.m-gpx.has-gpx { color: var(--accent); }
.m-gpx.has-gpx:hover { color: var(--muted-dim); }
.m-gpx[hidden] { display: none !important; }
.m-gpx-time-row { display: flex; justify-content: center; margin-top: 6px; }
.m-gpx-time-row[hidden] { display: none !important; }

/* Photo edit button — overlaid bottom-right of hero */
.m-photo-edit-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(46,63,79,0.72);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.15s, color 0.15s;
}
.m-photo-edit-btn:hover { background: rgba(46,63,79,0.92); color: #fff; }
.m-photo-edit-btn svg { width: 16px; height: 16px; }
.m-photo-edit-btn[hidden] { display: none !important; }

/* Photo edit popover */
.m-photo-popover {
  position: fixed;
  z-index: 9999;
  width: 270px;
}
.m-photo-popover[hidden] { display: none !important; }
.m-photo-popover-inner {
  background: #1c2b1f;
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.m-photo-url {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}
.m-photo-url::placeholder { color: var(--muted); }
.m-photo-popover-or { font-size: 11px; color: var(--muted); text-align: center; }
.m-photo-device-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 8px 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.m-photo-device-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.m-photo-preview { border-radius: 8px; overflow: hidden; }
.m-photo-preview img { width: 100%; height: 100px; object-fit: cover; display: block; }
.m-photo-popover-actions { display: flex; gap: 8px; justify-content: flex-end; }
.m-photo-save {
  padding: 7px 18px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.m-photo-cancel {
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.m-photo-status { font-size: 12px; color: var(--muted); text-align: center; min-height: 14px; }
.m-gpx-time-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.m-gpx-time-input { background: rgba(255,255,255,0.06); border: 0.5px solid var(--border); border-radius: 6px; color: var(--text); font: inherit; font-size: 12px; padding: 3px 6px; }
.m-delete { padding: 4px 8px; border: none; background: none; color: var(--muted-dim); font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.m-delete:hover { color: #e0846a; }
.m-delete[hidden] { display: none !important; }
.m-narrative-more { display: none; } /* shown only inside mobile media query */
.map-tag {
  display: flex; flex-direction: column;
  width: min(240px, calc(100vw - 24px));
  background: rgba(46, 63, 79, 0.97);
  border: 0.5px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.65);
  pointer-events: auto;
  overflow: hidden;
  font-family: "DM Sans", sans-serif;
}
.map-tag-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.map-tag-img { width: 44px; height: 44px; border-radius: 8px; background-size: cover; background-position: center; background-color: #253545; flex-shrink: 0; }
.map-tag-img-empty { background-color: #253545; }
.map-tag-info { flex: 1; min-width: 0; }
.map-tag-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-tag-state { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.map-tag-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border: none; border-top: 0.5px solid rgba(255,255,255,0.08);
  color: var(--accent);
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background 0.12s;
}
.map-tag-toggle:hover { background: rgba(255,255,255,0.08); }
.mtt-caret { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.15s; }
.map-tag-toggle.open .mtt-caret { transform: rotate(180deg); }
.map-tag-list { border-top: 0.5px solid rgba(255,255,255,0.08); max-height: 180px; overflow-y: auto; }
.map-tag-list::-webkit-scrollbar { width: 0; }
.map-tag-entry {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px; cursor: pointer;
  border-bottom: 0.5px solid rgba(255,255,255,0.05);
  transition: background 0.1s;
}
.map-tag-entry:last-child { border-bottom: none; }
.map-tag-entry:hover { background: rgba(255,255,255,0.07); }
.mte-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.mte-dot.hike { background: var(--hike-bright); }
.mte-dot.bike { background: var(--bike-bright); }
.mte-date { font-size: 12px; font-weight: 500; color: #fff; flex: 1; }
.mte-stats { font-size: 11px; color: rgba(255,255,255,0.5); white-space: nowrap; }

/* ---------- Add Entry ---------- */
.add-btn svg { width: 17px; height: 17px; }

/* Preserved: date-picker helper rows (used in hidden metadata) */
.add-date-input[hidden] { display: none !important; }
.add-none { font-size: 12px; color: var(--muted-dim); }

/* Full-screen writing view */
.ae-screen { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.ae-screen[hidden] { display: none !important; }

/* Nav */
.ae-nav { display: flex; align-items: center; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px; border-bottom: 0.5px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.ae-nav-right { display: flex; align-items: center; gap: 14px; }
.ae-x-btn { width: 32px; height: 32px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 24px; line-height: 1; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
.ae-x-btn:hover { color: #fff; }
.ae-nav-title { flex: 1; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: 0.07em; color: rgba(255,255,255,0.4); text-transform: uppercase; }
.ae-save-btn { font: inherit; font-size: 15px; font-weight: 600; color: var(--accent); background: none; border: none; cursor: pointer; padding: 0; }
.ae-save-btn:hover { opacity: 0.75; }
.ae-delete-btn { font: inherit; font-size: 13px; font-weight: 500; color: rgba(255,90,90,0.75); background: none; border: none; cursor: pointer; padding: 0; }
.ae-delete-btn:hover { color: rgba(255,90,90,1); }
.ae-delete-btn[hidden] { display: none !important; }

/* Date + location row above stats */
.ae-meta-row { display: flex; align-items: baseline; gap: 10px; padding: 10px 0 6px; flex-wrap: wrap; }
.ae-meta-date-wrap { display: flex; align-items: center; gap: 6px; }
.add-date-display { font-family: "DM Sans", sans-serif; font-size: 13px; color: rgba(255,255,255,0.55); cursor: default; }
.add-date-input { font-family: "DM Sans", sans-serif; font-size: 13px; background: none; border: none; border-bottom: 1px dashed rgba(255,255,255,0.3); color: rgba(255,255,255,0.8); padding: 0; width: 130px; }
.add-date-pencil { background: none; border: none; color: rgba(255,255,255,0.3); cursor: pointer; padding: 0; display: flex; align-items: center; }
.add-date-pencil.active { color: var(--accent); }
.ae-meta-loc { font-size: 12px; color: rgba(255,255,255,0.3); }

/* Trail name */
.ae-trail-block { padding: 22px 20px 14px; flex-shrink: 0; border-bottom: 0.5px solid rgba(255,255,255,0.07); }
.ae-trail-input { width: 100%; background: none; border: none; font-family: "Playfair Display", Georgia, serif; font-size: 28px; font-weight: 600; color: #fff; padding: 0; margin: 0 0 5px; caret-color: var(--accent); box-sizing: border-box; }
.ae-trail-input:focus { outline: none; }
.ae-trail-input::placeholder { color: rgba(255,255,255,0.18); }
.ae-trail-sub { font-size: 12px; color: rgba(255,255,255,0.32); letter-spacing: 0.02em; }

/* Stats drawer */
.ae-drawer { flex-shrink: 0; border-bottom: 0.5px solid rgba(255,255,255,0.07); }
.ae-drawer-toggle { width: 100%; background: none; border: none; display: flex; flex-direction: column; align-items: center; padding: 10px 20px 8px; cursor: pointer; gap: 6px; }
.ae-handle-bar { width: 36px; height: 4px; background: rgba(255,255,255,0.16); border-radius: 2px; }
.ae-drawer-lbl { font-size: 10px; letter-spacing: 0.08em; font-weight: 600; color: var(--accent); }
.ae-drawer-body { padding: 14px 20px 18px; }
.ae-drawer-body[hidden] { display: none !important; }

/* Mode tile picker — fills remaining height below nav */
.ae-mode-tiles { flex: 1; display: flex; flex-direction: column; padding: 12px 14px 14px; gap: 9px; overflow: hidden; min-height: 0; }
.ae-tile { flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; color: var(--text); cursor: pointer; font-family: inherit; text-align: left; transition: background 0.15s, border-color 0.15s; min-height: 0; }
.ae-tile:hover { background: rgba(255,255,255,0.08); border-color: rgba(245,166,35,0.35); }
.ae-tile:active { background: rgba(255,255,255,0.11); }
.ae-tile-icon { color: var(--accent); line-height: 0; margin-bottom: 3px; }
.ae-tile-label { font-size: 16px; font-weight: 700; color: rgba(255,255,255,0.92); line-height: 1; }
.ae-tile-desc { font-size: 12px; color: rgba(255,255,255,0.42); line-height: 1.6; }
.ae-tile-desc strong { color: rgba(255,255,255,0.62); font-weight: 500; }
.ae-tile.ae-mode-dead { opacity: 0.35; cursor: default; pointer-events: none; }
.strava-badge { color: #FC4C02 !important; }

/* GPX drop zone */
.ae-gpx-drop { border: 1px dashed rgba(255,255,255,0.18); border-radius: 14px; padding: 22px 16px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 7px; transition: background 0.15s, border-color 0.15s; }
.ae-gpx-drop.over, .ae-gpx-drop:hover { background: rgba(255,255,255,0.04); border-color: var(--accent); }
.ae-gpx-drop svg { width: 28px; height: 28px; color: var(--accent); }
.ae-gpx-drop span { font-size: 13px; color: rgba(255,255,255,0.5); }

/* Parsing */
.ae-parsing { text-align: center; color: var(--muted); padding: 22px; font-size: 13px; }
.ae-manual-note { display: flex; align-items: flex-start; gap: 7px; margin: 14px 16px 0; padding: 10px 12px; background: rgba(245,166,35,0.08); border: 0.5px solid rgba(245,166,35,0.2); border-radius: 10px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.ae-manual-note svg { color: var(--accent); flex-shrink: 0; margin-top: 1px; }

/* Stats row */
.ae-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 0.5px solid rgba(255,255,255,0.09); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.ae-stat-cell { padding: 10px 8px; text-align: center; border-right: 0.5px solid rgba(255,255,255,0.09); }
.ae-stat-cell:last-child { border-right: none; }
.ae-stat-num { font-family: "Playfair Display", Georgia, serif; font-size: 15px; font-weight: 500; color: var(--accent); display: block; }
.ae-stat-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255,255,255,0.35); display: block; margin-top: 2px; }
.ae-stat-input { width: 100%; background: none; border: none; border-bottom: 1px dashed rgba(245,166,35,0.35); font-family: "Playfair Display", Georgia, serif; font-size: 15px; font-weight: 500; color: var(--accent); text-align: center; padding: 0 0 1px; caret-color: var(--accent); }
.ae-stat-input:focus { outline: none; border-bottom-color: var(--accent); }
.ae-stat-input::placeholder { color: rgba(245,166,35,0.25); }
/* GPX/HealthKit locked stat — verified, cannot be edited */
.ae-stat-input.ae-stat-locked { color: rgba(245,166,35,0.6); border-bottom-style: solid; border-bottom-color: rgba(245,166,35,0.18); cursor: default; }
.ae-stat-input.ae-stat-locked:focus { outline: none; border-bottom-color: rgba(245,166,35,0.18); }
.ae-lock-icon { display: inline-block; vertical-align: middle; margin-left: 3px; opacity: 0.45; }
/* Weather bar inside drawer */
.ae-weather-bar { font-size: 12px; color: rgba(255,255,255,0.5); padding: 4px 0 0; letter-spacing: 0.01em; }

/* Activity type toggle */
.ae-biome-row { display: flex; align-items: center; gap: 10px; padding: 10px 0 2px; }
.ae-biome-lbl { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.ae-biome-select { flex: 1; background: var(--surface); border: 0.5px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: 13px; padding: 7px 10px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.ae-biome-select:focus { outline: none; border-color: var(--accent); }
.ae-biome-select:disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.ae-act-seg { display: inline-flex; border: 0.5px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 14px; margin-bottom: 12px; }
.ae-act-seg button { font: inherit; font-weight: 600; font-size: 13px; padding: 7px 18px; background: transparent; color: var(--muted); border: none; cursor: pointer; }
.ae-act-seg button.active { background: var(--accent); color: #1e2d3a; }

/* Badge preview */
.ae-badges-prev { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }

/* Duplicate warning */
.ae-dup { font-size: 12px; line-height: 1.4; color: #e0c074; background: rgba(212,168,75,0.12); border: 0.5px solid rgba(212,168,75,0.4); border-radius: 10px; padding: 8px 11px; margin-bottom: 12px; }
.ae-dup[hidden] { display: none !important; }

/* ─── Print panel ─────────────────────────────────────────── */

/* Landing screen */
.print-landing {
  padding: 20px 18px calc(100px + env(safe-area-inset-bottom, 0px));
}
.print-landing-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-headline);
  margin-bottom: 22px;
}
.print-choice-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.print-choice-card:active { background: rgba(255,255,255,0.08); }
.print-choice-card--disabled { opacity: 0.38; cursor: default; pointer-events: none; }
.print-choice-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 0.5px solid var(--border-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.print-choice-body { flex: 1; min-width: 0; }
.print-choice-name { font-size: 16px; font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.print-choice-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }
.print-choice-arrow { color: var(--muted); flex-shrink: 0; }
.print-choice-dead { opacity: 0.45; cursor: default; pointer-events: none; }
.print-choice-card--soon { opacity: 0.55; cursor: default; }
.print-choice-card--soon:active { background: var(--surface); }
.print-choice-soon { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: rgba(255,255,255,0.07); border: 0.5px solid var(--border); border-radius: 6px; padding: 3px 7px; flex-shrink: 0; white-space: nowrap; }

/* Book flow */
.print-book-flow {
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

/* Month / Year segmented toggle */
.book-mode-seg {
  display: flex;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  margin: 20px 18px 22px;
}
.book-mode-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.book-mode-btn.active {
  background: var(--accent);
  color: #1a2530;
  font-weight: 600;
}

/* Month activity grid (year mode) */
.book-month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 18px;
  margin-bottom: 14px;
}
.book-month-cell {
  border-radius: 10px;
  padding: 10px 6px 8px;
  text-align: center;
  border: 0.5px solid var(--border);
}
.book-month-cell.active {
  background: var(--accent-dim);
  border-color: var(--border-warm);
}
.book-month-cell.empty {
  background: var(--surface);
  opacity: 0.45;
}
.bmc-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.book-month-cell.active .bmc-name { color: var(--accent); }
.bmc-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}
.book-month-cell.empty .bmc-count { color: var(--muted-dim); }

/* Low-activity warning */
.book-year-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 18px 16px;
  background: rgba(245, 166, 35, 0.08);
  border: 0.5px solid var(--border-warm);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.45;
}
.book-year-warning svg { flex-shrink: 0; margin-top: 1px; }

/* Book flow header */
.print-book-flow-head { padding: 24px 18px 0; }
.print-book-flow-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-headline);
  margin-bottom: 6px;
}
.print-book-flow-sub { font-size: 14px; color: var(--muted); line-height: 1.45; }

/* (legacy hero — kept for possible reuse) */
.print-book-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--accent-dim);
  border: 0.5px solid var(--border-warm);
  color: var(--accent);
  margin: 20px auto 18px;
}
.print-book-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-headline);
  text-align: center;
  margin-bottom: 8px;
}
.print-book-sub {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  padding: 0 24px;
  margin-bottom: 28px;
}
.print-book-pickers {
  display: flex;
  gap: 12px;
  padding: 0 18px;
  margin-bottom: 14px;
}
.print-picker-group { flex: 1; }
.print-picker-lbl { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); margin-bottom: 7px; }
.print-picker-sel {
  width: 100%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  padding: 10px 12px;
  appearance: none;
  -webkit-appearance: none;
}
.print-book-count {
  text-align: center;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  min-height: 20px;
  margin-bottom: 28px;
}
.print-book-bar {
  padding: 20px 18px 0;
}
.print-book-bar .print-bar-btn {
  width: 100%;
}

.print-book-coming {
  margin: 0 18px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
}
.print-book-coming-badge {
  display: inline-block;
  background: var(--accent-dim);
  border: 0.5px solid var(--border-warm);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 20px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.print-book-coming-text {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.print-book-waitlist-btn {
  display: inline-block;
  background: var(--accent);
  color: #1a2530;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  padding: 10px 24px;
  text-decoration: none;
}

.print-panel { padding: 0 18px calc(170px + env(safe-area-inset-bottom, 0px)); }
.print-sticky-head {
  position: sticky;
  top: max(58px, calc(22px + var(--sat)));
  background: var(--bg);
  z-index: 10;
  z-index: 50;
  background: var(--bg);
  padding: 20px 0 14px;
}
.cap-native .print-sticky-head { top: 81px; }
.print-section-lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-dim); margin-bottom: 10px; }
.print-entry-hint { font-size: 12px; color: var(--muted-dim); margin: 4px 0 12px; }
.print-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 9px 13px;
  outline: none;
  margin-bottom: 2px;
  transition: background 0.2s, border-color 0.2s;
}
.print-search::placeholder { color: var(--muted); }
.print-search:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.10); }

/* Size picker */
.print-size-row { display: flex; gap: 10px; }
.print-size-btn { flex: 1; background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 12px 8px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: border-color 0.15s, background 0.15s; }
.print-size-btn.active { border-color: rgba(245,166,35,0.6); background: rgba(245,166,35,0.06); }
.psz-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.psz-1080   { width: 28px; height: 28px; }
.psz-46     { width: 24px; height: 36px; }
.psz-letter { width: 28px; height: 36px; }
.psz-name { font-size: 12px; font-weight: 600; color: var(--text); }
.psz-hint { font-size: 10px; color: var(--muted-dim); }

/* Entry list */
.print-entry-list { display: flex; flex-direction: column; gap: 2px; }
.print-entry-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: background 0.12s; border: 1.5px solid transparent; }
.print-entry-row:hover { background: rgba(255,255,255,0.04); }
.print-entry-row.selected { background: rgba(245,166,35,0.06); border-color: rgba(245,166,35,0.4); }
.pe-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: rgba(255,255,255,0.07); }
.pe-thumb-icon { width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; color: var(--muted-dim); }
.pe-body { flex: 1; min-width: 0; }
.pe-trail { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-meta { font-size: 11px; color: var(--muted-dim); margin-top: 2px; }
.pe-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Sticky generate bar */
.print-bar { position: fixed; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); width: min(430px, 100%); padding: 12px 18px; background: rgba(46,63,79,0.95); backdrop-filter: blur(16px); border-top: 0.5px solid var(--border); display: flex; align-items: center; gap: 12px; z-index: 50; }
.print-bar-meta { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-bar-btn { flex-shrink: 0; background: var(--accent); color: #1e2d3a; font-weight: 700; font-size: 14px; border: none; border-radius: 20px; padding: 9px 22px; cursor: pointer; }

/* ── Post format picker ──────────────────────────────────────────────────── */
.print-post-format { padding: 0 18px; }
.post-format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* 3-column row for Square / Photo / Full Page */
.post-format-grid--3 {
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 14px;
}
.post-format-grid--3 .post-format-card { padding: 14px 8px 12px; }
.post-format-grid--3 .post-format-preview { height: 82px; margin-bottom: 10px; }
.post-format-grid--3 .post-format-name { font-size: 13px; }
.post-format-grid--3 .post-format-plat { font-size: 10px; }
.post-format-card {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 18px; padding: 24px 16px 20px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s; text-align: center;
  position: relative;
}
.post-format-card:not(:disabled):hover,
.post-format-card:not(:disabled):active { border-color: var(--accent); background: rgba(245,166,35,0.06); }
.post-format-card--soon { opacity: 0.5; cursor: default; }
.post-format-preview {
  width: 100%; display: flex; align-items: center; justify-content: center;
  height: 110px; margin-bottom: 16px;
}
.post-format-shape {
  background: #0c1724; border: 1.5px solid var(--border);
  border-radius: 6px; overflow: hidden;
}
.post-format-shape svg { display: block; }
.post-format-shape--post     { width: 78px; height: 98px; }  /* 4:5  */
.post-format-shape--story    { width: 52px; height: 92px; }  /* 9:16 */
.post-format-shape--square   { width: 60px; height: 60px; }  /* 1:1  */
.post-format-shape--photo    { width: 48px; height: 72px; }  /* 2:3  */
.post-format-shape--fullpage { width: 50px; height: 65px; }  /* 8.5:11 */
.post-format-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.post-format-plat { font-size: 11px; color: var(--muted); }
.post-format-badge {
  margin-top: 8px; font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
  background: rgba(245,166,35,0.12); border-radius: 20px; padding: 2px 8px;
}

/* ── Create a Post flow ──────────────────────────────────────────────────── */
.print-post-flow { padding: 0 18px calc(230px + env(safe-area-inset-bottom, 0px)); }
.print-post-flow .print-sticky-head { padding-top: 6px; }
.post-entry-list { padding: 0; }
.pe-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; cursor: pointer; transition: background 0.12s; }
.pe-item:active, .pe-item.selected { background: rgba(245,166,35,0.10); }
.pe-item-thumb { width: 48px; height: 48px; border-radius: 8px; flex-shrink: 0; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; }
.pe-item-body { flex: 1; min-width: 0; }
.pe-item-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pe-route-tag { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); background: rgba(245,166,35,0.12); border-radius: 5px; padding: 1px 5px; }

.post-gen-bar { position: fixed; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); width: min(430px, 100%); background: rgba(30,42,56,0.97); backdrop-filter: blur(18px); border-top: 0.5px solid var(--border); padding: 14px 18px 16px; z-index: 50; display: flex; flex-direction: column; gap: 12px; }
.post-gen-meta { display: flex; flex-direction: column; gap: 2px; }
.post-meta-trail { font-size: 14px; font-weight: 600; color: var(--text); }
.post-meta-date  { font-size: 12px; color: var(--muted); }
.post-gen-photos { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding-bottom: 2px; }
.post-photo-opt { width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0; cursor: pointer; background-size: cover; background-position: center; background-color: var(--surface-2); color: var(--muted); border: 2px solid transparent; transition: border-color 0.12s; display: flex; align-items: center; justify-content: center; }
.post-photo-opt.selected { border-color: var(--accent); }
.post-photo-upload { border: 1.5px dashed var(--border); }
.post-gen-bar .print-bar-btn { width: 100%; border-radius: 14px; padding: 13px; font-size: 15px; }

/* Generating overlay */
.print-generating { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 60; }
.print-gen-spinner { width: 36px; height: 36px; border: 3px solid rgba(245,166,35,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.print-gen-label { font-size: 14px; color: var(--muted); }

/* ─── Off-screen print canvas ──────────────────────────────── */
.print-canvas {
  position: fixed;
  left: -9999px;
  top: 0;
  background: #ffffff;
  font-family: "DM Sans", "Inter", system-ui, sans-serif;
  color: #1a2530;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Size variants — base dimensions (captured at scale for 300 DPI) */
.print-canvas.sz-4x6  { width: 400px; height: 600px; }
.print-canvas.sz-5x5  { width: 400px; height: 400px; }
.print-canvas.sz-5585 { width: 400px; height: 618px; }

/* Photo zone */
.pc-photo {
  width: 100%;
  background-size: cover;
  background-position: center;
  background-color: #2e3f4f;
  position: relative;
  flex-shrink: 0;
}
.sz-4x6  .pc-photo { height: 226px; }
.sz-5x5  .pc-photo { height: 180px; }
.sz-5585 .pc-photo { height: 234px; }

/* Gradient overlay on photo for slight darkening at bottom */
.pc-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(0,0,0,0.18) 100%);
}

/* No-photo fallback */
.pc-photo.pc-empty { background: linear-gradient(135deg, #3d5266 0%, #1e2d3a 100%); }
.pc-nophoto-name {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  padding: 20px;
  line-height: 1.25;
}

/* Body */
.pc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
  min-height: 0;
}

/* Header row: trail name + route inset */
.pc-header-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.pc-header-text { flex: 1; min-width: 0; }
.pc-trail {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a2530;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-dateline { font-size: 11px; color: #6b7a8a; margin-top: 3px; }

/* Route SVG inset */
.pc-route-box {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border: 1px solid #dde3e8;
  border-radius: 8px;
  overflow: hidden;
  background: #f6f8fa;
  padding: 4px;
}
.pc-route-svg { width: 100%; height: 100%; }

/* Stats + weather */
.pc-stats { font-size: 12px; color: #2e4050; font-weight: 500; letter-spacing: 0.01em; margin-bottom: 4px; }
.pc-weather { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #6b7a8a; margin-bottom: 6px; }
.pc-weather svg { flex-shrink: 0; }

/* Divider */
.pc-divider { height: 1px; background: #e4e9ed; margin: 6px 0 8px; }

/* Notes */
.pc-notes {
  font-size: 12px;
  color: #2e4050;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: hidden;
  flex: 1;
}

/* Ruled lines */
.pc-ruled { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.pc-rule { height: 1px; background: #dde3e8; margin-bottom: 18px; }

/* Footer */
.pc-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 8px;
  justify-content: flex-end;
}
.pc-footer-name { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #9aabb8; }

/* Route map preview */
.ae-map-preview { position: relative; flex-shrink: 0; margin: 0; }
.ae-route-map-ol { width: 100%; height: 200px; display: block; }
.ae-route-svg { display: block; width: 100%; height: 160px; }
.ae-replace-gpx-btn { position: absolute; bottom: 10px; right: 12px; display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.85); background: rgba(0,0,0,0.55); border: 0.5px solid rgba(255,255,255,0.2); border-radius: 999px; padding: 5px 11px; cursor: pointer; backdrop-filter: blur(6px); }
.ae-replace-gpx-btn:hover { background: rgba(0,0,0,0.75); color: #fff; }

/* Form body — must be a flex column so journal can fill remaining height */
#addFormBody { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#addFormBody[hidden] { display: none !important; }

/* Journal */
.ae-journal-wrap { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.ae-journal { flex: 1; width: 100%; background: none; border: none; resize: none; font: inherit; font-size: 16px; line-height: 1.75; color: rgba(255,255,255,0.82); padding: 18px 20px; box-sizing: border-box; caret-color: var(--accent); }
.ae-journal:focus { outline: none; }
.ae-journal::placeholder { color: rgba(255,255,255,0.18); }

/* Edit-mode GPX row */
.ae-edit-gpx-row { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-top: 0.5px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.ae-edit-gpx-label { flex: 1; font-size: 13px; color: rgba(255,255,255,0.4); }
.ae-edit-gpx-btn { font-size: 13px; font-weight: 500; color: var(--accent); background: rgba(245,166,35,0.12); border: none; border-radius: 8px; padding: 6px 14px; cursor: pointer; flex-shrink: 0; }
.ae-edit-gpx-btn:active { opacity: 0.7; }

/* Photo strip */
.ae-photo-strip { display: flex; align-items: center; gap: 8px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 0.5px solid rgba(255,255,255,0.07); flex-shrink: 0; overflow-x: auto; }
.ae-photo-thumbs { display: flex; gap: 8px; flex: 1; }
.ae-photo-thumb { width: 56px; height: 56px; border-radius: 10px; background-size: cover; background-position: center; flex-shrink: 0; position: relative; cursor: pointer; }
.ae-photo-thumb .ae-thumb-rm { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,0.72); border: none; color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.ae-photo-add-btn { width: 48px; height: 48px; flex-shrink: 0; background: rgba(255,255,255,0.07); border: 0.5px solid rgba(255,255,255,0.14); border-radius: 12px; color: rgba(255,255,255,0.5); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ae-photo-add-btn:hover { background: rgba(255,255,255,0.13); color: #fff; }
.ae-photo-add-btn svg { width: 20px; height: 20px; }

/* Status */
.ae-status { text-align: center; font-size: 13px; color: var(--muted); padding: 6px 20px; min-height: 20px; flex-shrink: 0; }
.ae-status.err { color: #e0846a; }
.ae-status.ok { color: #7cbf9e; }

/* Photo lightbox (add-form thumbnails) */
.photo-lightbox { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; }
.photo-lightbox[hidden] { display: none !important; }
.photo-lightbox-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.88); }
.photo-lightbox-img { position: relative; max-width: 92%; max-height: 88vh; border-radius: 12px; object-fit: contain; box-shadow: 0 16px 64px rgba(0,0,0,0.6); }

/* ---------- Adventure Log ---------- */
.adv-note { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.adv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.adv-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.adv-hero { height: 160px; background-size: cover; background-position: center; background-color: var(--bg-deep); position: relative; }
.adv-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(46,63,79,0) 45%, rgba(46,63,79,0.6) 100%); }
.adv-body { padding: 16px 18px 18px; display: flex; flex-direction: column; }
.adv-title { font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 500; font-size: 16px; color: var(--accent); margin-bottom: 6px; }
.adv-trail { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 22px; color: #fff; line-height: 1.12; }
.adv-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.adv-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.adv-badge { font-size: 10px; background: rgba(255,255,255,0.06); border: 0.5px solid rgba(255,255,255,0.12); border-radius: 20px; padding: 3px 9px; color: var(--text); cursor: pointer; white-space: nowrap; }
.adv-badge:active { background: rgba(255,255,255,0.14); }
.adv-more { font-size: 10px; color: var(--muted); background: none; border: 0.5px dashed rgba(255,255,255,0.22); border-radius: 20px; padding: 3px 9px; cursor: pointer; white-space: nowrap; }
.adv-rest { margin-top: 6px; }
.adv-divider { height: 0.5px; background: var(--border-soft); margin: 14px 0; }
.adv-narrative { font-size: 13px; color: rgba(255,255,255,0.65); line-height: 1.75; }
.adv-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.adv-stat-v { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 14px; color: #fff; }
.adv-stat-v span { font-family: "DM Sans", sans-serif; font-size: 9px; color: var(--muted); margin-left: 2px; }
.adv-stat-l { font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-dim); margin-top: 2px; }
.adv-view { align-self: flex-start; margin-top: 14px; background: none; border: none; color: var(--accent); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; }
.adv-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2000; max-width: 84%; background: var(--bg-deep); color: #fff; font-size: 12.5px; line-height: 1.4; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); }
.adv-toast[hidden] { display: none; }

/* ============================ MOBILE (overrides — kept last so they win) ============================ */
@media (max-width: 600px) {
  .topbar { padding: 9px 12px; gap: 8px 12px; }
  .brand-name { font-size: 17px; }
  .filters { gap: 8px; }
  main { padding: 14px 12px calc(90px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav { width: calc(100% - 32px); }
  .hero-banner { min-height: 200px; }
  .hero-content { padding: 22px 20px; }
  .section-title { font-size: 21px; }

  /* Personal Stats — 4 KPIs across in one row */
  .pkpi-row { gap: 7px; }
  .pkpi-row .card { padding: 11px 7px; }
  .pkpi-row .kpi-value { font-size: 17px; white-space: nowrap; }
  .pkpi-row .kpi-value .u { font-size: 10px; margin-left: 2px; }
  .pkpi-row .kpi-label { font-size: 8px; letter-spacing: 0.03em; }
  .pkpi-row .kpi-sub { display: none; }

  /* Trail Details — 2 rows of 3 KPIs */
  .cols-6 { gap: 10px; }
  .cols-6 .card { padding: 13px 10px; }
  .cols-6 .kpi-value { font-size: 21px; }
  .cols-6 .kpi-label { font-size: 9px; }

  /* Totals — 2 accent cards across */
  .stat-row { gap: 10px; }
  .stat-row .stat-card { padding: 15px 13px; }
  .stat-row .sc-value { font-size: 30px; }
  .stat-row .sc-sub, .stat-row .sc-extra { font-size: 11px; }
  .stat-row .sc-splitlabels { font-size: 10px; }

  /* Adventure Log — single column on mobile */
  .adv-list { grid-template-columns: 1fr; gap: 14px; }
  .adv-title { font-size: 15px; }
  .adv-trail { font-size: 20px; }

  /* Modal — compact for mobile so it never needs to scroll */
  .hero { height: 160px; }
  .modal-body { padding: 16px 20px 20px; }
  .m-divider { margin: 10px 0; }
  .m-title { font-size: 24px; }
  .m-stat .num { font-size: 24px; }
  .m-route { display: none !important; }
  /* Narrative: clamp to 5 lines; tap .m-narrative-expand to reveal full text */
  .m-narrative.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .m-narrative-more {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
  }
  .m-narrative-more[hidden] { display: none !important; }

  /* Badges — keep 4-up on small screens too */
  .badge-card-grid { grid-template-columns: repeat(4, 1fr); }
  /* Prevent iOS auto-zoom on textarea focus (threshold is 16px) */
  .m-notes-textarea, .add-notes { font-size: 16px; }
}

/* Desktop: constrain all fixed-position layers to the body column */
@media (min-width: 431px) {
  .overlay,
  .save-cheer,
  #badgeSheet,
  .adv-toast,
  .splash-screen,
  .login-screen,
  #photoLightbox,
  .m-photo-popover { position: absolute; }
  /* .ae-screen stays position:fixed so it covers the full viewport on iPad */
}

/* ========== Login screen ========== */
/* ── Splash / loading screen ─────────────────────────────────────────────── */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: 28px;
  transition: opacity 0.4s ease;
}
.splash-screen.splash-fade { opacity: 0; pointer-events: none; }
.splash-screen[hidden] { display: none !important; }
.splash-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  animation: splashPulse 1.8s ease-in-out infinite;
}
.splash-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent, #f59e0b);
  border-radius: 50%;
  animation: splashSpin 0.8s linear infinite;
}
@keyframes splashPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.75; transform: scale(0.96); }
}
@keyframes splashSpin {
  to { transform: rotate(360deg); }
}

/* ── Print loading overlay ───────────────────────────────────────────────── */
.print-loading-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
  margin-top: -8px;
}

/* ── JPG preview modal ───────────────────────────────────────────────────── */
.jpg-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.jpg-preview-backdrop[hidden] { display: none !important; }
.jpg-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 340px;
  width: 100%;
}
.jpg-preview-img {
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.jpg-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.jpg-preview-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.jpg-preview-btn--primary {
  background: var(--accent, #f59e0b);
  color: #1a1208;
}

/* ── Login screen ─────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login-screen[hidden] { display: none !important; }
.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin-bottom: 18px;
}
.login-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.login-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 28px;
}
.login-msg {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  text-align: center;
  margin-bottom: 16px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border-warm);
}
.login-msg[hidden] { display: none !important; }
#loginForm { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.login-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #fff;
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.login-input:focus { border-color: var(--border-warm); }
.login-btn-primary {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #1e2d3a;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.login-btn-primary:hover { opacity: 0.9; }
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.05em;
  margin: 2px 0;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-btn-google {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.login-btn-google:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.login-btn-apple {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  background: #fff;
  color: #000;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s;
  margin-bottom: 10px;
}
.login-btn-apple:hover { background: #e8e8e8; }
.login-row-links { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -2px 0; flex-wrap: wrap; }
.login-link { font-size: 13px; color: var(--accent); cursor: pointer; }
.login-link:hover { opacity: 0.8; }
.login-link-sep { font-size: 13px; color: var(--text-muted, #9aa5b4); user-select: none; }
.login-reset-label { font-size: 14px; color: var(--text-secondary, #6b7280); margin: 0 0 10px; text-align: center; }

/* ── Book order sheet ───────────────────────────────────────────────────── */
.book-order-card { max-width: 400px; padding: 0; }
.book-order-head { padding: 32px 28px 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.08); }
.book-order-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px; background: rgba(196,150,79,0.15); border: 1px solid rgba(196,150,79,0.3); color: var(--accent); }
.book-order-icon svg { width: 24px; height: 24px; }
.book-order-title { font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.book-order-sub { font-size: 13px; color: var(--text-muted); }
.book-order-mid { background: rgba(255,255,255,0.06); border-bottom: 1px solid rgba(255,255,255,0.08); }
.book-order-details { padding: 16px 28px; display: flex; flex-direction: column; gap: 10px; }
.book-order-row { display: flex; justify-content: space-between; align-items: center; }
.book-order-label { font-size: 13px; color: var(--text-muted); }
.book-order-val { font-size: 13px; color: var(--text); font-weight: 500; text-align: right; }
.book-order-price-row { padding: 18px 28px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.book-order-price { font-family: 'Playfair Display', Georgia, serif; font-size: 32px; font-weight: 700; color: var(--accent); }
.book-order-price-note { font-size: 13px; color: var(--text-muted); }
.book-order-actions { padding: 20px 28px 24px; display: flex; flex-direction: column; gap: 10px; }
.book-order-btn { width: 100%; padding: 14px 20px; border-radius: 14px; border: none; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px; transition: opacity 0.15s, background 0.15s; }
.book-order-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.book-order-btn--primary { background: var(--accent); color: #1a1408; }
.book-order-btn--primary:hover:not(:disabled) { opacity: 0.88; }
.book-order-btn--secondary { background: rgba(255,255,255,0.07); color: var(--text); border: 1px solid rgba(255,255,255,0.12); }
.book-order-btn--secondary:hover:not(:disabled) { background: rgba(255,255,255,0.11); }
.book-order-uploading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 28px 20px; font-size: 14px; color: var(--text-muted); }
.book-order-preview { padding: 48px 28px 20px; }
.book-order-preview-img { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; box-shadow: 0 8px 32px rgba(0,0,0,0.45); display: block; }

/* ── Stats AI blurb ─────────────────────────────────────────────────────── */
.stats-blurb-wrap { position: relative; margin: 16px 0 4px; padding: 18px 22px 22px; border-radius: 16px; background: radial-gradient(ellipse at 105% 120%, rgba(245,166,35,0.14) 0%, rgba(245,166,35,0.04) 45%, rgba(255,255,255,0.03) 70%); border: 1px solid rgba(245,166,35,0.18); }
.stats-blurb { margin: 0; padding-right: 28px; font-size: 15px; line-height: 1.65; color: var(--text-muted); font-style: italic; }
.stats-blurb-cairn { position: absolute; bottom: 10px; right: 14px; width: 26px; height: 26px; opacity: 0.5; }
.stats-blurb--loading { min-height: 22px; background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: blurb-shimmer 1.6s infinite; border-radius: 6px; }
@keyframes blurb-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
