/* ============================================
   Pilgrim · צליין — Premium Trail PWA
   Palette: Clay-Rust × Sage-Moss
   ============================================ */

:root {
  /* Backgrounds — warm clay depths */
  --bg-0: #15100c;
  --bg-1: #1c1611;
  --bg-2: #241c16;
  --surface: rgba(245, 220, 200, 0.04);
  --surface-elev: rgba(245, 220, 200, 0.07);
  --surface-strong: rgba(245, 220, 200, 0.10);

  /* Primary — terracotta */
  --clay-50: #fbe7d8;
  --clay-100: #f3c4a3;
  --clay-200: #ea9d72;
  --clay-300: #e07a4b;
  --clay-400: #d4633c;
  --clay-500: #b94f2c;
  --clay-600: #973f23;

  /* Accent — sage moss */
  --moss-100: #d8e2cb;
  --moss-200: #b6c5a3;
  --moss-300: #93a780;
  --moss-400: #7a8a6f;
  --moss-500: #5a6651;

  /* Semantic */
  --gold: #e0b863;
  --bone: #f5ddc8;
  --tan: #b89e88;
  --dust: #8a7765;
  --olive: #5e5044;
  --rust: #b94f2c;

  /* Text */
  --t-1: #f5ddc8;
  --t-2: #c9b39a;
  --t-3: #8a7765;
  --t-4: #5e5044;

  /* Borders */
  --b-1: rgba(212, 99, 60, 0.14);
  --b-2: rgba(245, 220, 200, 0.08);
  --b-strong: rgba(212, 99, 60, 0.28);

  /* Effects */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
  --glow-clay: 0 0 40px rgba(212, 99, 60, 0.25);
  --glow-moss: 0 0 32px rgba(122, 138, 111, 0.2);

  /* Motion */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-smooth: cubic-bezier(.4, 0, .2, 1);

  /* Type */
  --f-serif: 'Frank Ruhl Libre', 'Heebo', serif;
  --f-display: 'Instrument Serif', 'Frank Ruhl Libre', serif;
  --f-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  --f-body: 'Heebo', system-ui, sans-serif;

  /* Layout */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

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

html, body {
  background: var(--bg-0);
  color: var(--t-1);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(212, 99, 60, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(122, 138, 111, 0.08), transparent 60%),
    radial-gradient(circle at 50% 50%, var(--bg-1) 0%, var(--bg-0) 100%);
  background-attachment: fixed;
}

/* Film grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Ambient orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}
.orb.orb-1 { width: 420px; height: 420px; top: -120px; right: -80px; background: radial-gradient(circle, rgba(212, 99, 60, 0.22), transparent 70%); animation: drift 18s ease-in-out infinite alternate; }
.orb.orb-2 { width: 360px; height: 360px; bottom: 10%; left: -100px; background: radial-gradient(circle, rgba(122, 138, 111, 0.18), transparent 70%); animation: drift 22s ease-in-out 3s infinite alternate-reverse; }
.orb.orb-3 { width: 280px; height: 280px; top: 40%; right: 30%; background: radial-gradient(circle, rgba(224, 184, 99, 0.10), transparent 70%); animation: drift 26s ease-in-out 6s infinite alternate; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(30px, -40px) scale(1.08); }
}

::selection { background: var(--clay-400); color: var(--bg-0); }

/* ========== APP SHELL ========== */
.app {
  position: relative;
  z-index: 2;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 20px 120px;
  min-height: 100vh;
}

/* ========== TOP BAR ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 44px; height: 44px;
  background-image: url('logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 4px 12px rgba(212, 99, 60, 0.35));
}
.brand-text {
  display: flex; flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: var(--f-display);
  font-size: 26px;
  letter-spacing: 0.02em;
  color: var(--t-1);
  font-style: italic;
}
.brand-sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--t-3);
  text-transform: uppercase;
  margin-top: 2px;
}

.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--b-2);
  color: var(--t-2);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.icon-btn:hover {
  background: var(--surface-elev);
  border-color: var(--b-strong);
  color: var(--clay-300);
  transform: translateY(-1px);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* ========== HERO ========== */
.hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 24px;
  min-height: 320px;
  background: var(--bg-1);
  border: 1px solid var(--b-1);
  box-shadow: var(--shadow-lg);
}
.hero-bg {
  position: absolute; inset: 0;
  background-image: url('hero_bg.png');
  background-size: cover;
  background-position: center 65%;
  z-index: 0;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(21, 16, 12, 0.2) 0%,
    rgba(21, 16, 12, 0.4) 40%,
    rgba(21, 16, 12, 0.92) 100%);
  z-index: 1;
}
.hero-overlay-side {
  position: absolute; inset: 0;
  background: linear-gradient(270deg, rgba(21, 16, 12, 0.7), transparent 60%);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
}
.hero-eyebrow {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--moss-300);
  display: flex; align-items: center; gap: 8px;
}
.hero-eyebrow::before {
  content: ''; width: 24px; height: 1px;
  background: var(--moss-300);
}
.hero-title {
  font-family: var(--f-display);
  font-size: 44px;
  line-height: 1.05;
  font-style: italic;
  color: var(--bone);
  margin-top: 14px;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
.hero-title em {
  font-style: normal;
  color: var(--clay-200);
  font-family: var(--f-serif);
  font-weight: 500;
}
.hero-meta {
  display: flex; gap: 18px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--t-2);
}
.hero-meta span { display: flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 14px; height: 14px; color: var(--clay-300); }

/* Hero progress bar */
.hero-progress {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 32px;
}
.hero-progress-row {
  display: flex; align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.hero-km {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 36px;
  color: var(--bone);
  line-height: 1;
}
.hero-km .total {
  font-size: 18px;
  color: var(--t-3);
  font-style: normal;
  font-family: var(--f-mono);
  margin-right: 4px;
}
.hero-pct {
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--clay-200);
  letter-spacing: 0.05em;
}
.hero-bar {
  height: 6px;
  background: rgba(245, 220, 200, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.hero-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clay-500), var(--clay-300), var(--gold));
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(212, 99, 60, 0.5);
  transition: width 1.2s var(--ease-spring);
  position: relative;
}
.hero-bar-fill::after {
  content: ''; position: absolute;
  right: -4px; top: -3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 14px var(--gold);
}

/* ========== STAT GRID ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--b-1);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-spring);
}
.stat:hover {
  transform: translateY(-2px);
  border-color: var(--b-strong);
  box-shadow: var(--shadow-md);
}
.stat-ico {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--clay-300);
}
.stat-ico svg { width: 18px; height: 18px; }
.stat-val {
  font-family: var(--f-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--t-1);
  letter-spacing: -0.02em;
}
.stat-val small {
  font-size: 11px;
  color: var(--t-3);
  margin-right: 2px;
  font-family: var(--f-mono);
}
.stat-lbl {
  font-size: 11px;
  color: var(--t-3);
  letter-spacing: 0.04em;
}

/* ========== SECTION ========== */
.section {
  background: var(--surface);
  border: 1px solid var(--b-1);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.section-title {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 22px;
  color: var(--t-1);
  display: flex; align-items: center; gap: 10px;
}
.section-title svg { width: 18px; height: 18px; color: var(--moss-300); }
.section-sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--t-3);
  text-transform: uppercase;
  margin-top: 4px;
}

.chip {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--clay-200);
  background: rgba(212, 99, 60, 0.1);
  border: 1px solid rgba(212, 99, 60, 0.25);
  border-radius: 99px;
  padding: 5px 10px;
  text-transform: uppercase;
}

/* ========== TRAIL MAP ========== */
.trailmap {
  position: relative;
  height: 240px;
  background: linear-gradient(180deg, rgba(36, 28, 22, 0.5), rgba(21, 16, 12, 0.3));
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--b-2);
  margin-bottom: 18px;
}
.trailmap svg {
  width: 100%; height: 100%;
  display: block;
}
.trail-path-bg {
  fill: none;
  stroke: rgba(245, 220, 200, 0.1);
  stroke-width: 3;
  stroke-dasharray: 4 6;
  stroke-linecap: round;
}
.trail-path-fill {
  fill: none;
  stroke: url(#trailGradient);
  stroke-width: 3.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(212, 99, 60, 0.6));
  transition: stroke-dashoffset 1.4s var(--ease-spring);
}
.trail-marker {
  fill: var(--moss-300);
  stroke: var(--bg-0);
  stroke-width: 2;
}
.trail-marker.reached { fill: var(--clay-300); }
.trail-marker.current {
  fill: var(--gold);
  stroke: var(--clay-500);
  stroke-width: 2.5;
}
.trail-marker-current-pulse {
  fill: var(--gold);
  opacity: 0.4;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { r: 6; opacity: 0.4; }
  50% { r: 14; opacity: 0; }
}
.trail-label {
  font-family: var(--f-mono);
  font-size: 9px;
  fill: var(--t-3);
  letter-spacing: 0.06em;
  text-anchor: middle;
}
.trail-label.reached { fill: var(--clay-200); }

/* Trail meta strip */
.trail-meta {
  display: flex; justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.trail-meta-cell {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
}
.trail-meta-lbl {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--t-3);
  text-transform: uppercase;
}
.trail-meta-val {
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--t-1);
}

/* ========== MILESTONES LIST ========== */
.milestones {
  display: flex; flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.milestones::-webkit-scrollbar { width: 4px; }
.milestones::-webkit-scrollbar-thumb { background: var(--b-strong); border-radius: 2px; }

.milestone {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--b-2);
  transition: all 0.3s var(--ease-smooth);
  position: relative;
}
.milestone.reached {
  background: linear-gradient(90deg, rgba(212, 99, 60, 0.12), transparent);
  border-color: var(--b-strong);
}
.milestone.current {
  background: linear-gradient(90deg, rgba(224, 184, 99, 0.15), rgba(212, 99, 60, 0.08));
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(224, 184, 99, 0.15);
}
.milestone-num {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--b-1);
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--t-3);
  flex-shrink: 0;
}
.milestone.reached .milestone-num {
  background: var(--clay-500);
  color: var(--bone);
  border-color: var(--clay-300);
}
.milestone.current .milestone-num {
  background: var(--gold);
  color: var(--bg-0);
  border-color: var(--gold);
}
.milestone-body { flex: 1; min-width: 0; }
.milestone-name {
  font-family: var(--f-serif);
  font-size: 15px;
  color: var(--t-1);
  font-weight: 500;
  line-height: 1.2;
}
.milestone.reached .milestone-name { color: var(--clay-100); }
.milestone-meta {
  display: flex; gap: 10px; margin-top: 3px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--t-3);
  letter-spacing: 0.06em;
}
.milestone-meta span { display: flex; align-items: center; gap: 4px; }
.milestone-lore {
  margin-top: 8px;
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 12px;
  color: var(--t-2);
  line-height: 1.4;
  display: none;
}
.milestone.reached .milestone-lore { display: block; }
.milestone.current .milestone-lore { display: block; color: var(--gold); }

/* ========== HEATMAP ========== */
.heatmap {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  padding: 4px 0;
}
.heat-cell {
  aspect-ratio: 1;
  background: rgba(245, 220, 200, 0.05);
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease-smooth);
  cursor: pointer;
  position: relative;
}
.heat-cell:hover {
  border-color: var(--clay-300);
  transform: scale(1.2);
  z-index: 5;
}
.heat-cell.h1 { background: rgba(212, 99, 60, 0.18); }
.heat-cell.h2 { background: rgba(212, 99, 60, 0.32); }
.heat-cell.h3 { background: rgba(212, 99, 60, 0.55); }
.heat-cell.h4 { background: rgba(224, 184, 99, 0.85); box-shadow: 0 0 6px rgba(224, 184, 99, 0.5); }
.heat-cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 50%; transform: translateX(50%);
  background: var(--bg-0);
  color: var(--t-1);
  font-family: var(--f-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid var(--b-strong);
  z-index: 10;
}
.heat-legend {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--t-3);
  letter-spacing: 0.08em;
}
.heat-scale { display: flex; gap: 3px; }
.heat-scale .heat-cell { width: 12px; height: 12px; cursor: default; }
.heat-scale .heat-cell:hover { transform: none; }

/* ========== LOG LIST ========== */
.log-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 280px; overflow-y: auto;
  padding-right: 4px;
}
.log-list::-webkit-scrollbar { width: 4px; }
.log-list::-webkit-scrollbar-thumb { background: var(--b-strong); border-radius: 2px; }

.log-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--b-2);
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-smooth);
}
.log-item:hover {
  border-color: var(--b-strong);
  background: rgba(0, 0, 0, 0.3);
}
.log-date {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--t-3);
  letter-spacing: 0.04em;
}
.log-note {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--t-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-note:empty::before {
  content: '—'; color: var(--t-4);
}
.log-km {
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--clay-200);
}
.log-km small { font-size: 10px; color: var(--t-3); }
.log-del {
  background: transparent;
  border: 1px solid var(--b-2);
  border-radius: 8px;
  width: 28px; height: 28px;
  color: var(--t-3);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s var(--ease-smooth);
}
.log-del:hover {
  border-color: var(--rust);
  color: var(--rust);
}
.log-del svg { width: 12px; height: 12px; }

/* ========== EMPTY STATE ========== */
.empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 32px 16px;
  gap: 14px;
}
.empty-img {
  width: 140px; height: 140px;
  background-image: url('empty_state.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.85;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}
.empty-title {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 22px;
  color: var(--t-2);
}
.empty-text {
  font-family: var(--f-serif);
  font-style: italic;
  color: var(--t-3);
  max-width: 360px;
  line-height: 1.5;
}

/* ========== FAB ========== */
.fab {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clay-300), var(--clay-500));
  color: var(--bone);
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(212, 99, 60, 0.5), inset 0 -3px 8px rgba(0,0,0,0.2), inset 0 2px 4px rgba(255,255,255,0.18);
  transition: all 0.4s var(--ease-spring);
}
.fab::before {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 99, 60, 0.35), transparent 70%);
  z-index: -1;
  animation: fab-pulse 3s ease-in-out infinite;
}
@keyframes fab-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 0.2; }
}
.fab:hover {
  transform: translateX(-50%) translateY(-3px) scale(1.06);
}
.fab:active { transform: translateX(-50%) scale(0.94); }
.fab svg { width: 26px; height: 26px; }

/* ========== MODAL ========== */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 11, 8, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fade-in 0.3s var(--ease-smooth);
}
.modal-bg.open { display: flex; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--b-1);
  border-bottom: none;
  padding: 24px 22px 36px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slide-up 0.45s var(--ease-spring);
  position: relative;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@media (min-width: 600px) {
  .modal-bg { align-items: center; padding: 20px; }
  .modal { border-radius: var(--radius-xl); border-bottom: 1px solid var(--b-1); }
}

.modal-drag {
  width: 40px; height: 4px;
  background: var(--b-strong);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 26px;
  color: var(--t-1);
}
.modal-close {
  width: 36px; height: 36px;
  border: 1px solid var(--b-2);
  background: var(--surface);
  color: var(--t-2);
  border-radius: 10px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--clay-300); border-color: var(--b-strong); }
.modal-close svg { width: 16px; height: 16px; }

/* Form */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-3);
}
.input, .textarea, .select {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--b-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--t-1);
  font-family: var(--f-body);
  font-size: 15px;
  transition: all 0.25s var(--ease-smooth);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--clay-400);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 3px rgba(212, 99, 60, 0.15);
}
.input[type=number] { font-family: var(--f-mono); }
.textarea { resize: vertical; min-height: 70px; font-family: var(--f-serif); font-style: italic; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg fill='%23b89e88' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 36px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.3s var(--ease-spring);
}
.btn-primary {
  background: linear-gradient(135deg, var(--clay-400), var(--clay-500));
  color: var(--bone);
  box-shadow: 0 6px 18px rgba(212, 99, 60, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(212, 99, 60, 0.45); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--b-2);
  color: var(--t-2);
}
.btn-ghost:hover { border-color: var(--b-strong); color: var(--clay-300); }
.btn-full { width: 100%; }
.btn svg { width: 16px; height: 16px; }

.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* Trail picker grid */
.trails-grid {
  display: grid; gap: 10px;
  margin-top: 4px;
}
.trail-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--b-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  text-align: right;
}
.trail-card:hover {
  border-color: var(--b-strong);
  transform: translateY(-2px);
  background: rgba(0,0,0,0.35);
}
.trail-card.active {
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(224, 184, 99, 0.1), rgba(0,0,0,0.3));
  box-shadow: 0 0 24px rgba(224, 184, 99, 0.18);
}
.trail-card-flag {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--clay-400), var(--moss-400));
  display: grid; place-items: center;
  color: var(--bone);
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 14px;
}
.trail-card.active .trail-card-flag {
  background: linear-gradient(135deg, var(--gold), var(--clay-300));
  color: var(--bg-0);
}
.trail-card-body { min-width: 0; }
.trail-card-name {
  font-family: var(--f-serif);
  font-size: 16px;
  color: var(--t-1);
  font-weight: 500;
  line-height: 1.2;
}
.trail-card-where {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--t-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 3px;
}
.trail-card-km {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 18px;
  color: var(--moss-300);
  text-align: left;
}
.trail-card-km small { font-size: 10px; color: var(--t-3); font-family: var(--f-mono); font-style: normal; }

/* About */
.about-block { margin-bottom: 18px; }
.about-block p {
  font-family: var(--f-serif);
  font-style: italic;
  color: var(--t-2);
  line-height: 1.6;
}
.about-features {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 14px;
}
.about-feat {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--b-2);
}
.about-feat-ico {
  width: 32px; height: 32px;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(212, 99, 60, 0.15);
  border-radius: 8px;
  color: var(--clay-300);
}
.about-feat-ico svg { width: 16px; height: 16px; }
.about-feat-name {
  font-family: var(--f-serif);
  font-size: 14px;
  color: var(--t-1);
  font-weight: 500;
}
.about-feat-desc {
  font-size: 12px;
  color: var(--t-3);
  margin-top: 2px;
}

.copyright {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--t-4);
  text-align: center;
  margin-top: 24px;
  letter-spacing: 0.05em;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-2);
  border: 1px solid var(--b-strong);
  color: var(--t-1);
  padding: 12px 20px;
  border-radius: 99px;
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s var(--ease-spring);
  z-index: 200;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 14px; height: 14px; color: var(--gold); }

/* ========== RESPONSIVE ========== */
@media (max-width: 540px) {
  .hero-title { font-size: 34px; }
  .hero-km { font-size: 30px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 18px; }
}
@media (max-width: 380px) {
  .app { padding: 14px 14px 110px; }
  .hero-content { padding: 24px 20px 20px; }
  .heatmap { grid-template-columns: repeat(10, 1fr); }
}

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