:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent: #c8f560;
  --danger: #e06c6c;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-w: 480px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.2rem; font-weight: 600; }
p  { color: var(--text-muted); }

/* ── Screens ── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  padding: 24px 20px;
  gap: 20px;
}
.screen.active { display: flex; }

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.header .back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.header .title { font-size: 1rem; font-weight: 600; flex: 1; }

/* ── Lens badge ── */
.lens-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  width: fit-content;
}

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--accent); color: #0f0f0f; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Welcome screen ── */
.welcome-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.welcome-actions { display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }

/* ── Form elements ── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 12px;
  resize: none;
  width: 100%;
  min-height: 100px;
  transition: border-color 0.15s;
}
textarea:focus { outline: none; border-color: var(--accent); }
textarea::placeholder { color: var(--text-muted); }

/* ── Tag grid ── */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 8px 14px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tag-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f0f0f;
  font-weight: 600;
}

/* ── Slider ── */
.slider-wrap { display: flex; flex-direction: column; gap: 8px; }
.slider-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }
input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
}

/* ── Photo capture ── */
.photo-area {
  position: relative;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.photo-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.photo-placeholder .icon { font-size: 2rem; }
#photo-input { display: none; }
.photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 50%;
  color: white;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  display: none;
}

/* ── Location ── */
.location-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.location-row .loc-icon { font-size: 1.2rem; }
.location-row .loc-text { flex: 1; font-size: 0.9rem; color: var(--text-muted); }
.location-row .loc-text.found { color: var(--accent); }
.location-row .loc-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 6px 10px;
}

/* ── Map screen ── */
#map {
  height: 55dvh;
  min-height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
}
.map-popup img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.map-popup p { font-size: 0.85rem; margin: 0; color: #333; }
.map-stats {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  flex: 1;
  text-align: center;
}
.stat .num { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat .lbl { font-size: 0.75rem; color: var(--text-muted); }

/* ── Thank you ── */
.thankyou { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.thankyou .big-icon { font-size: 3rem; }

/* ── Loading / error ── */
.loading { color: var(--text-muted); text-align: center; padding: 40px; }
.error-msg { background: rgba(224,108,108,0.1); border: 1px solid var(--danger); border-radius: var(--radius-sm); color: var(--danger); font-size: 0.875rem; padding: 10px 14px; display: none; }
.error-msg.visible { display: block; }
