:root {
  --green: #0B6B3A;
  --green-dark: #084f2b;
  --ink: #1a1a1a;
  --paper: #ffffff;
  --line: #e6e6e6;
  --cols: 3;
  --gap: 6px;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overscroll-behavior-y: none;
}

/* ---------- Road-sign banner ---------- */
.banner {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-top));
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.sign {
  flex: 1;
  background: var(--green);
  color: #fff;
  border: 3px solid #fff;
  outline: 2px solid var(--green);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.sign__title {
  font-weight: 800;
  font-size: clamp(18px, 5.5vw, 28px);
  letter-spacing: 0.5px;
  line-height: 1.05;
}

.sign__sub {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.9;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 6px 10px;
  border: 2px solid var(--green);
  border-radius: 12px;
  font-family: var(--mono);
}
.counter__num { font-size: 22px; font-weight: 700; color: var(--green); line-height: 1; }
.counter__label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--green-dark); margin-top: 2px; }

/* ---------- Zoom controls ---------- */
.zoom {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(1.2) blur(6px);
}
.zoom__btn {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  color: var(--green-dark);
}
.zoom__btn:active { background: #f2f2f2; }
.zoom__val { font-family: var(--mono); font-size: 13px; min-width: 14px; text-align: center; color: #777; }

/* ---------- Masonry grid (CSS columns) ---------- */
.grid {
  column-count: var(--cols);
  column-gap: var(--gap);
  padding: var(--gap);
  touch-action: pan-y; /* let pinch gesture through to our handler */
}
.card {
  break-inside: avoid;
  margin: 0 0 var(--gap);
  position: relative;
  background: #f3f3f3;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.card img.loaded { opacity: 1; }
.card__tag {
  position: absolute;
  left: 0; bottom: 0; right: 0;
  padding: 14px 6px 4px;
  font-family: var(--mono);
  font-size: 9px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card:hover .card__tag { opacity: 1; }

.empty {
  text-align: center;
  color: #999;
  font-family: var(--mono);
  padding: 60px 20px;
}

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 25;
  border: none;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(11, 107, 58, 0.35);
}
.fab:active { background: var(--green-dark); }

/* ---------- Photo overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.overlay__img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
}
.overlay__meta {
  color: #fff;
  width: min(680px, 92vw);
  padding: 14px 4px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}
.overlay__meta .cap { font-family: var(--sans); font-size: 16px; margin-bottom: 8px; }
.overlay__meta .row { color: #b9d9c6; }
.overlay__close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

/* ---------- Modal (upload / auth flow) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 18px 18px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  animation: rise 0.22s ease;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 0 0 4px; font-size: 20px; }
.sheet p.hint { margin: 0 0 16px; color: #777; font-size: 14px; }
.sheet label { display: block; font-size: 12px; font-family: var(--mono); color: #666; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.sheet input[type=text],
.sheet input[type=tel],
.sheet input[type=email],
.sheet input[type=password] {
  width: 100%;
  padding: 14px;
  font-size: 16px; /* >=16px stops iOS zoom-on-focus */
  border: 1px solid var(--line);
  border-radius: 10px;
}
.sheet .consent { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; font-size: 13px; color: #444; }
.sheet .consent input { margin-top: 2px; width: 18px; height: 18px; }
.btn {
  width: 100%;
  border: none;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 15px;
  border-radius: 12px;
  margin-top: 8px;
}
.btn[disabled] { opacity: 0.5; }
.btn--ghost { background: #fff; color: #666; border: 1px solid var(--line); }
.err { color: #c0392b; font-size: 13px; margin-top: 10px; min-height: 16px; }
.charcount { text-align: right; font-family: var(--mono); font-size: 11px; color: #999; margin-top: 4px; }
.preview { width: 100%; border-radius: 12px; margin-top: 10px; max-height: 46vh; object-fit: cover; }
.otp-boxes { display: flex; justify-content: space-between; gap: 8px; }
.otp-boxes input { text-align: center; font-family: var(--mono); font-size: 22px; }

#recaptcha-container { position: fixed; bottom: 0; }
