/* ── Where The Shit Goes Down · mobile-first ─────────────────────────────── */
:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #14202b; --muted: #5b6b7b; --line: #d3dbe4;
  --brand: #1565d8; --brand-ink: #ffffff; --brand-soft: #e8f0fd;
  --accent: #ffb300; --accent-soft: rgba(255, 179, 0, .38);
  --ok: #1e9e4a; --warn: #d97706; --danger: #d32f2f;
  --radius: 16px; --btn-h: 58px; --nav-h: 68px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .12);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px; line-height: 1.4; color: var(--ink); background: var(--bg);
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  -webkit-tap-highlight-color: transparent;
}
body.map-page { padding-bottom: 0; overflow: hidden; }
.container { max-width: 640px; margin: 0 auto; padding: 14px 16px; }
h1 { font-size: 26px; margin: 8px 0 12px; line-height: 1.2; }
h2 { font-size: 21px; margin: 18px 0 8px; }
p { margin: 8px 0; }
a { color: var(--brand); }
.muted { color: var(--muted); font-size: 16px; }
.small { font-size: 15px; }
.center { text-align: center; }
.hidden { display: none !important; }
.fr { float: right; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.big-icon { font-size: 64px; text-align: center; margin: 6px 0; line-height: 1; }
.steps { counter-reset: step; }
.step { position: relative; padding-left: 44px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 2px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 17px;
}

/* ── Buttons: big, bold, thick highlight border while pressed ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: var(--btn-h); padding: 12px 18px;
  font: inherit; font-size: 19px; font-weight: 700; line-height: 1.2;
  border-radius: var(--radius); border: 3px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); text-decoration: none;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  outline: 4px solid transparent; outline-offset: 2px;
  transition: transform .08s ease, box-shadow .12s ease, outline-color .12s ease;
}
.btn.secondary { background: var(--card); color: var(--brand); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.secondary { background: var(--card); color: var(--danger); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.small { min-height: 46px; font-size: 16px; padding: 8px 14px; }
.btn.inline { display: inline-flex; width: auto; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn.pressed, .btn:active:not([disabled]) {
  outline-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); transform: scale(.98);
}
.btn:focus-visible { outline-color: var(--accent); }
.btn-row { display: grid; gap: 12px; margin: 12px 0; }
.btn-row.two { grid-template-columns: 1fr 1fr; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.actions .btn { width: auto; min-height: 46px; font-size: 15px; padding: 6px 12px; }

/* ── Inputs ── */
label { display: block; font-weight: 700; margin: 14px 0 6px; font-size: 17px; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; min-height: 56px; padding: 12px 14px; font: inherit; font-size: 18px;
  border: 3px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(21, 101, 216, .2); }
textarea { min-height: 96px; resize: vertical; }
.help { font-size: 15px; color: var(--muted); margin-top: 4px; }
.form-error { color: var(--danger); font-weight: 700; margin: 10px 0; min-height: 1.2em; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.search-row .btn { width: auto; min-height: 56px; padding: 8px 16px; }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 14px 8px; background: var(--card); box-shadow: var(--shadow);
}
.topbar .logo { font-size: 28px; line-height: 1; }
.topbar .title { font-weight: 800; font-size: 17px; flex: 1; letter-spacing: -.2px; line-height: 1.15; }
.topbar .title small { display: block; font-weight: 600; color: var(--muted); font-size: 13px; }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--card); border-top: 2px solid var(--line);
}
.bottom-nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  margin: 5px 4px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 700;
  outline: 4px solid transparent; outline-offset: -4px;
}
.bottom-nav a .ic { font-size: 24px; line-height: 1; }
.bottom-nav a.active { color: var(--brand); background: var(--brand-soft); }
.bottom-nav a.pressed, .bottom-nav a:active { outline-color: var(--accent); background: var(--accent-soft); }
.bottom-nav .badge {
  position: absolute; top: 2px; right: 14px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center;
}

/* ── Toasts (pop-up alerts) ── */
.toasts {
  position: fixed; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
  border-radius: var(--radius); background: #1f2a37; color: #fff; font-size: 17px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28); border-left: 8px solid var(--brand);
  animation: toast-in .25s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .t-title { font-weight: 800; }
.toast .t-msg { opacity: .92; font-size: 16px; word-break: break-word; }
.toast .t-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toast .btn { width: auto; min-height: 44px; font-size: 16px; padding: 6px 14px; border-color: #fff; background: #fff; color: #1f2a37; }
.toast .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(-16px); opacity: 0; } }

/* ── Progress + spinners ── */
.progress { height: 14px; border-radius: 8px; background: var(--line); overflow: hidden; margin: 6px 0; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #4f8ff0); transition: width .2s ease; }
.progress.indeterminate > i { width: 40%; animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
.spinner.dark { border-color: rgba(0, 0, 0, .15); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 14px; font-weight: 800; background: var(--line); color: var(--ink); }
.status-pill.ok { background: #d9f2e1; color: #136b32; }
.status-pill.error { background: #fbdada; color: #8f1d1d; }
.status-pill.busy { background: #dbe8fb; color: #0d4fb0; }
.status-pill.warn { background: #fde8c8; color: #7a4100; }

/* ── Photo grid ── */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid a { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e6ebf0; outline: 4px solid transparent; }
.grid a img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid a.pressed, .grid a:active { outline-color: var(--accent); }
.grid .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.photo-hero { width: 100%; border-radius: var(--radius); display: block; background: #e6ebf0; }

/* ── Map page ── */
#map { position: fixed; top: 0; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 1; background: #dfe7ee; }
.map-top { position: fixed; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; z-index: 40; display: flex; gap: 8px; align-items: center; }
.brand-pill {
  flex: 1; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 8px 14px;
  box-shadow: var(--shadow); font-weight: 800; font-size: 16px; text-decoration: none; color: var(--ink);
}
.brand-pill .logo { font-size: 24px; }
.brand-pill small { font-weight: 600; color: var(--muted); font-size: 12px; margin-left: auto; }
.search-pill {
  flex: 1; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow); border: 3px solid transparent;
}
.search-pill:focus-within { border-color: var(--brand); }
.search-pill .logo { font-size: 24px; line-height: 1; }
.search-pill input { flex: 1; min-width: 0; min-height: 44px; border: 0; padding: 4px 6px; font: inherit; font-size: 17px; background: transparent; border-radius: 0; }
.search-pill input:focus { outline: none; box-shadow: none; border: 0; }
.search-pill .btn { width: 52px; min-height: 48px; padding: 0; border-radius: 999px; font-size: 20px; }
.search-results {
  position: fixed; top: calc(76px + var(--safe-t)); left: 10px; right: 10px; z-index: 41; max-height: 55vh; overflow: auto;
  background: var(--card); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0, 0, 0, .25); padding: 8px 12px;
}
.search-results .choice { margin: 6px 0; }
.place-hit { background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.fab {
  position: fixed; right: 12px; z-index: 40; width: 62px; height: 62px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand); box-shadow: var(--shadow); font-size: 28px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--brand);
  outline: 4px solid transparent; outline-offset: 2px; cursor: pointer;
}
.fab.locate { bottom: calc(var(--nav-h) + var(--safe-b) + 92px); }
.fab.add { bottom: calc(var(--nav-h) + var(--safe-b) + 16px); background: var(--brand); color: #fff; font-size: 34px; }
.fab.pressed, .fab:active { outline-color: var(--accent); transform: scale(.96); }
.leaflet-top.leaflet-left { top: calc(60px + var(--safe-t)); }
.leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; font-size: 24px !important; }
.leaflet-container { font-family: inherit; }

/* photo pins — .pin-wrap's bottom edge is the anchor point (Leaflet iconAnchor / Google marker) */
.pin-icon { background: none !important; border: 0 !important; }
.pin-wrap { padding-bottom: 10px; width: 56px; }
.pin { position: relative; width: 56px; height: 56px; }
.pin img { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .4); object-fit: cover; display: block; background: #cfd8e3; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); border: 8px solid transparent; border-top: 10px solid #fff; border-bottom: 0; }
.pin .cnt {
  position: absolute; top: -6px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.pin-icon.pressed .pin img, .pin-wrap.pressed .pin img, .pin-wrap.selected .pin img { outline: 4px solid var(--accent); }
.gm-center { transform: translateY(50%); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26, 115, 232, .3); }
.drop-pin { font-size: 40px; line-height: 1; transform: translate(-2px, -6px); filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }

/* bottom sheet */
.sheet {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 45;
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .22);
  max-height: 72vh; overflow: auto; overscroll-behavior: contain; transform: translateY(110%); transition: transform .25s ease;
  padding: 8px 16px 20px;
}
.sheet.open { transform: none; }
.sheet .grab { width: 48px; height: 6px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
.sheet-head h2 { margin: 0; flex: 1; font-size: 22px; line-height: 1.2; }
.close-x {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--line); background: #fff; font: inherit; font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; outline: 4px solid transparent; cursor: pointer;
}
.close-x.pressed, .close-x:active { outline-color: var(--accent); }

/* ── Comments ── */
.comment { padding: 10px 0; border-top: 1px solid var(--line); }
.comment .who { font-weight: 800; font-size: 15px; }
.comment .when { color: var(--muted); font-size: 14px; margin-left: 6px; }
.comment .body { margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

/* ── Upload page ── */
.preview { width: 100%; max-height: 55vh; object-fit: contain; border-radius: var(--radius); background: #e6ebf0; display: block; }
#mini-map { height: 260px; border-radius: var(--radius); overflow: hidden; border: 3px solid var(--line); background: #dfe7ee; }
.choice {
  width: 100%; text-align: left; border: 3px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0;
  display: flex; align-items: center; gap: 12px; background: #fff; cursor: pointer; font: inherit; font-weight: 700; color: var(--ink);
  outline: 4px solid transparent; outline-offset: 2px;
}
.choice .ic { font-size: 26px; flex: none; }
.choice .sub { display: block; font-weight: 500; color: var(--muted); font-size: 15px; }
.choice.selected { border-color: var(--brand); background: var(--brand-soft); }
.choice.pressed, .choice:active { outline-color: var(--accent); }
.upload-item { display: flex; gap: 12px; align-items: center; }
.upload-item img { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; flex: none; background: #e6ebf0; }
.upload-item .info { flex: 1; min-width: 0; }
.upload-item .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Lists (admin / mine) ── */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 10px 0; }
.tabs .btn { min-height: 50px; font-size: 14px; padding: 6px 4px; border-width: 3px; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; word-break: break-word; }
.row .main .sub { color: var(--muted); font-size: 15px; display: block; word-break: break-word; }
.row img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: #e6ebf0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border-radius: 12px; padding: 10px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }
