/*
 * Havhav (הבהב) — styles.css
 * Warm, playful look: sand and cream backgrounds, with the logo's red
 * (public/assets/havhav-logo.jpg) for the header and main buttons.
 * Mobile-first: the base styles are for phones; the @media block at the
 * bottom widens things for desktop.
 */

:root {
  --sand: #f6ecd9;
  --sand-dark: #ead8b8;
  --sand-deep: #dcc39a;   /* sticker-edge / pressed shadow under cards */
  --cream: #fffaf0;
  --paper: #fffdf8;       /* card surface, a touch brighter than cream */
  /* Brand red, matched to the logo but a touch deeper so cream/white text
     on it stays readable (cream on --brand is about 5.4:1, white about 5.6:1). */
  --brand: #c62828;
  --brand-dark: #8e1b1b;
  --brand-hover: #d23434;
  --brand-soft: #fde4e1;
  --leaf: #a7c98a;
  --ink: #3b2a20;
  --ink-soft: #6d5a4c;

  /* crowd colors */
  --quiet: #8db38a;
  --few: #b9c93d;
  --busy: #f0902f;
  --packed: #d9442f;

  /* Shape: soft "sticker / storybook" corners */
  --radius: 24px;       /* popups, cards */
  --radius-md: 16px;    /* buttons, inputs, list items */
  --radius-sm: 12px;    /* small tags, photos inside cards */

  /* Shadows: one warm family, used everywhere */
  --shadow-sm: 0 2px 6px rgba(59, 42, 32, 0.14);
  --shadow: 0 8px 24px rgba(59, 42, 32, 0.16), 0 2px 4px rgba(59, 42, 32, 0.08);
  --shadow-lg: 0 16px 40px rgba(59, 42, 32, 0.22), 0 3px 8px rgba(59, 42, 32, 0.1);
  --edge: 0 3px 0 var(--sand-deep);           /* "sticker" bottom edge */

  /* Motion */
  --ease-pop: cubic-bezier(0.2, 0.9, 0.3, 1.25);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Fonts (both have full Hebrew + Latin, loaded in index.html) */
  --display: 'Fredoka', 'Rubik', 'Varela Round', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Hebrew', Arial, sans-serif;
  --header-h: 64px;
  /* Space under the map that belongs to the phone (home bar). When the bottom
     nav is showing it takes care of that space, so this becomes 0. */
  --below-map: env(safe-area-inset-bottom, 0px);
}
body:not(.first-run) { --below-map: 0px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--body);
  line-height: 1.4;
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  /* Never taller than what's actually visible (Safari toolbar, keyboard);
     --vv-h is the visual viewport height, set in app.js. */
  height: min(100dvh, var(--vv-h, 100dvh));
  overflow: hidden;
}

h1, h2, h3, .fab, .primary-btn, .park-name { font-family: var(--display); }
h1, h2, h3 { letter-spacing: 0.01em; }

button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: var(--body); }

/* Very light paper grain for cream surfaces (an inline SVG noise tile) */
.sidebar, .sheet, .screen, .leaflet-popup-content-wrapper {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Shared press feedback: buttons dip down a little when tapped */
.primary-btn, .secondary-btn, .danger-btn, .icon-btn, .round-btn, .nav-btn,
.seg button, .tiles button, .photo-btn, .lang-choice, .swatch, .leaflet-container a.dir-btn {
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.primary-btn:active, .secondary-btn:active, .danger-btn:active, .icon-btn:active, .nav-btn:active,
.seg button:active, .tiles button:active, .photo-btn:active, .lang-choice:active, .leaflet-container a.dir-btn:active {
  transform: translateY(2px) scale(0.98);
}
.round-btn:active, .swatch:active { transform: scale(0.92); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

[hidden] { display: none !important; }

/* ---------------- Header ---------------- */
.topbar {
  flex: 0 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--brand);
  background-image:
    radial-gradient(circle at 12% -40%, #d43535 0, transparent 60%),
    radial-gradient(circle at 92% 160%, #b52222 0, transparent 55%);
  color: var(--cream);
  box-shadow: 0 3px 0 var(--brand-dark), 0 6px 16px rgba(142, 27, 27, 0.25);
  z-index: 1000;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
/* The logo JPG has white corners outside its rounded square, so clip it.
   A thin cream ring keeps the red logo from melting into the red header. */
.brand-logo {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: block;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--cream), 0 3px 6px rgba(80, 10, 10, 0.3);
  animation: logo-bob 4s ease-in-out 2s infinite;
}
/* A small, slow "wag" every few seconds */
@keyframes logo-bob {
  0%, 80%, 100% { transform: none; }
  85% { transform: translateY(-2px) rotate(-6deg); }
  90% { transform: translateY(-1px) rotate(5deg); }
  95% { transform: rotate(-2deg); }
}
.brand-text { min-width: 0; }
.brand h1 { margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1; letter-spacing: 0.5px; white-space: nowrap; text-shadow: 0 2px 0 rgba(80, 10, 10, 0.25); }
.subtitle {
  margin: 2px 0 0;
  font-size: 0.75rem;
  opacity: 0.92;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  min-width: 44px; height: 44px;
  border: 0; border-radius: var(--radius-md);
  background: transparent;
  font-size: 1.3rem;
}
.topbar .icon-btn { color: var(--cream); background: rgba(255, 255, 255, 0.16); }
.sheet .icon-btn { background: var(--sand); color: var(--ink-soft); width: 44px; border-radius: 50%; }
.sheet .icon-btn:hover { background: var(--sand-dark); }


/* ---------------- Layout ---------------- */
/* The three tabs share .views: the map underneath, My Dog / Settings on top. */
.views {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  min-height: 0;
}
.layout {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  min-height: 0;
}

.map-wrap { position: relative; flex: 1; min-width: 0; isolation: isolate; /* keeps map controls under the sidebar */ }
#map {
  position: absolute; inset: 0;
  /* Light ground shown while the basemap loads (matches its background). */
  background-color: #f6f4ef;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: absolute;
  z-index: 900;
  inset: 0 auto 0 0;
  width: min(88vw, 360px);
  background-color: var(--cream);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 0.3s var(--ease-out);
  border-radius: 0 var(--radius) var(--radius) 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[dir='rtl'] .sidebar { inset: 0 0 0 auto; transform: translateX(105%); border-radius: var(--radius) 0 0 var(--radius); }
.sidebar.open { transform: none !important; }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 16px 8px;
}
.sidebar-head h2 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.sort { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-soft); }
.sort select {
  height: 38px; border-radius: var(--radius-sm);
  border: 2px solid var(--sand-dark); background: var(--paper);
  padding: 0 10px; font: inherit; color: var(--ink);
}

.legend {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 4px 14px 12px;
  font-size: 0.78rem; color: var(--ink-soft);
  border-bottom: 2px dashed var(--sand-dark);
}
.legend > span {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
  background: var(--sand);
}
[dir='rtl'] .legend > span { padding: 3px 6px 3px 9px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid rgba(59, 42, 32, 0.35); }
.dot.quiet { background: var(--quiet); }
.dot.few { background: var(--few); }
.dot.busy { background: var(--busy); }
.dot.packed { background: var(--packed); }

.park-list { list-style: none; margin: 0; padding: 10px; overflow-y: auto; flex: 1; }
/* Empty / loading line: a friendly paw that gently bounces */
.park-list .empty, .breed-list .breed-empty {
  padding: 28px 20px; text-align: center; color: var(--ink-soft);
}
.park-list .empty::before, .breed-list .breed-empty::before {
  content: '🐾';
  display: block;
  margin-bottom: 6px;
  font-size: 1.8rem;
  animation: paw-bounce 1.4s ease-in-out infinite;
}
@keyframes paw-bounce {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-6px) rotate(8deg); }
}

.park-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  min-height: 62px;
  border: 2px solid var(--sand);
  border-radius: 20px;
  background: var(--paper);
  text-align: start;
  box-shadow: var(--edge);
  transition: transform 0.15s var(--ease-out), border-color 0.15s ease, box-shadow 0.15s ease;
}
.park-item:hover { border-color: var(--leaf); transform: translateY(-1px); box-shadow: 0 4px 0 var(--sand-deep); }
.park-item:active { transform: translateY(2px) scale(0.99); box-shadow: 0 1px 0 var(--sand-deep); }
.park-item.selected { border-color: var(--brand); background: #fff7f5; box-shadow: 0 3px 0 var(--brand-dark); }

.park-item .badge { flex: 0 0 auto; }
.park-item-text { flex: 1; min-width: 0; }
.park-name { display: block; font-size: 1.05rem; font-weight: 600; line-height: 1.2; }
.park-item-sub { display: block; font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.park-item-pets { display: flex; flex: 0 0 auto; }
.park-item-pets .mini { margin-inline-start: -10px; }

/* Count badge (used in list + map markers) */
.badge {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 34px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 700;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.badge.quiet { background: var(--quiet); }
.badge.few { background: var(--few); color: var(--ink); text-shadow: none; }
.badge.busy { background: var(--busy); }
.badge.packed { background: var(--packed); }
/* Busy-park heat, list version: a soft halo in the crowd colour */
.badge.busy { box-shadow: var(--shadow-sm), 0 0 0 3px color-mix(in srgb, var(--busy) 30%, transparent); }
.badge.packed { box-shadow: var(--shadow-sm), 0 0 0 4px color-mix(in srgb, var(--packed) 35%, transparent); }

.mini {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--sand);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(59, 42, 32, 0.2);
  display: inline-grid; place-items: center;
  overflow: hidden;
}
.mini svg { width: 30px; height: 30px; }
/* "On my way": a dashed ring around the little avatar. */
.mini.way { border: 2px dashed var(--busy); }

/* ---------------- Map (clean, light, Apple-Maps-like) ---------------- */
/* The basemap is MapLibre vector tiles (basemap.js). Without WebGL it falls
   back to OSM raster tiles, gently lightened here (no sepia, no paper). */
.light-tiles { filter: saturate(0.8) brightness(1.04) contrast(0.94); }
.leaflet-gl-layer { pointer-events: none; }

/* Official park footprints (map-art.js): a subtle, accurate green fill. */
.park-footprint { pointer-events: none; }

/* ---------------- Map markers ---------------- */
/* Park pin: a rounded pill callout (map-art.js) with a paw and the live dog
   count, coloured by crowd level. Empty parks: a white pill with a red paw.
   Busy-park heat: busier pills are a little bigger (--pin-heat) and get a soft
   glow in the crowd colour; --pin-lift for hover / selected; capped at 1.4.
   The tap target is the Leaflet marker box (60×42), which never grows. */
.park-marker { background: none; border: 0; }
:is(.park-pin, .cluster-pin) {
  --pin-heat: 1;
  --pin-lift: 1;
  --pin-scale: min(1.4, calc(var(--pin-heat) * var(--pin-lift)));
  --pin-bg: #fff;
  --pin-fg: var(--brand);
  --pin-glow: transparent;
  --glow-size: 0px;
  position: relative;
  width: 60px; height: 42px;
  transform: scale(var(--pin-scale));
  transform-origin: 50% 100%;
  transition: transform 0.2s var(--ease-pop);
  animation: marker-pop 0.4s var(--ease-pop) backwards;
}
:is(.park-pin, .cluster-pin) .pin-pill {
  position: absolute; left: 50%; bottom: 7px;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 38px; height: 30px; padding: 0 10px;
  border-radius: 15px;
  background: var(--pin-bg);
  color: var(--pin-fg);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(30, 30, 40, 0.22), 0 0 0 0.5px rgba(30, 30, 40, 0.12);
  font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1;
  white-space: nowrap;
  direction: ltr;
}
:is(.park-pin, .cluster-pin) .pin-garden { display: block; flex: 0 0 auto; margin: 0 1px 0 -3px; }
/* A thin cream edge so the green garden still reads on a coloured pill. */
:is(.park-pin, .cluster-pin):not(.empty) .pin-garden { filter: drop-shadow(0 0 1px #fffaf0) drop-shadow(0 0 0.5px #fffaf0); }
:is(.park-pin, .cluster-pin) .pin-tail {
  position: absolute; left: 50%; bottom: 1px;
  width: 11px; height: 11px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--pin-bg);
  border-right: 2px solid rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 2px 2px 3px rgba(30, 30, 40, 0.14);
  z-index: -1;
}
:is(.park-pin, .cluster-pin).quiet  { --pin-bg: #4caf50; --pin-fg: #fff; }
:is(.park-pin, .cluster-pin).few    { --pin-bg: #9bbd2a; --pin-fg: #fff; --pin-heat: 1.06; --pin-glow: color-mix(in srgb, var(--few) 50%, transparent); --glow-size: 58px; }
:is(.park-pin, .cluster-pin).busy   { --pin-bg: var(--busy); --pin-fg: #fff; --pin-heat: 1.12; --pin-glow: color-mix(in srgb, var(--busy) 45%, transparent); --glow-size: 66px; }
:is(.park-pin, .cluster-pin).packed { --pin-bg: var(--packed); --pin-fg: #fff; --pin-heat: 1.2; --pin-glow: color-mix(in srgb, var(--packed) 50%, transparent); --glow-size: 74px; }
.park-marker:hover :is(.park-pin, .cluster-pin) { --pin-lift: 1.06; }
.park-pin.selected { --pin-lift: 1.12; }
.park-pin.selected .pin-pill { border-color: var(--ink); }

/* The glow: a soft round "warm spot" behind busy pills. */
:is(.park-pin, .cluster-pin)::before {
  content: '';
  position: absolute;
  left: 50%; top: 20px;
  width: var(--glow-size); height: var(--glow-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--pin-glow) 0%, var(--pin-glow) 35%, transparent 100%);
  z-index: -2;
  pointer-events: none;
}
:is(.park-pin, .cluster-pin).packed::before { animation: glow-breathe 2.6s ease-in-out infinite; }

/* Count went up / down since the last refresh: a short bump. */
.park-pin.heat-up   { animation: pin-heat-up 0.55s var(--ease-pop); }
.park-pin.heat-down { animation: pin-heat-down 0.45s ease-out; }

/* Dogs "on my way": a small dashed number inside the pill. */
:is(.park-pin, .cluster-pin) .pin-coming {
  margin-inline-start: 2px;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1.5px dashed currentColor;
  font-size: 11px;
  opacity: 0.95;
}
:is(.park-pin, .cluster-pin).empty .pin-coming { color: #8a4a12; border-color: var(--busy); }

/* Cluster pill: several gardens close together when zoomed out (app.js).
   Garden icon + the number of gardens in a cream chip + a paw and the dog
   total. A second pill peeks out behind it, so it reads as a little stack.
   The box is wider (96×42); a tap zooms in to the gardens. */
.cluster-pin { width: 96px; }
.cluster-pin .pin-pill {
  padding: 0 9px 0 10px;
  gap: 4px;
  box-shadow:
    3px -3px 0 -1px var(--pin-bg), 3px -3px 0 0.5px rgba(255, 255, 255, 0.95),
    0 2px 6px rgba(30, 30, 40, 0.22), 0 0 0 0.5px rgba(30, 30, 40, 0.12);
}
.cluster-pin .cluster-parks {
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--brand);
  border: 1.5px solid var(--brand);
  font-size: 13px; line-height: 17px; text-align: center;
}
.cluster-pin .pin-count { display: inline-flex; align-items: center; gap: 2px; }
.cluster-pin .pin-paw { display: block; opacity: 0.95; }
/* A pin coloured by "How many dogs here?" reports (nobody checked in): "4–8" */
.park-pin .pin-est { font-size: 12px; letter-spacing: -0.02em; white-space: nowrap; }

.pet-marker { background: none; border: 0; }
.pet-marker-inner {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--brand);
  box-shadow: 0 3px 8px rgba(59, 42, 32, 0.35);
  display: grid; place-items: center;
  overflow: hidden;
}
.pet-marker-inner svg { width: 36px; height: 36px; }
.pet-marker.mine .pet-marker-inner { border-color: #3d7dd8; animation: bob 2.4s ease-in-out infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes marker-pop {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; }
}
/* Busy-park heat (see .park-pin above) */
@keyframes pin-heat-up {
  0%   { transform: scale(calc(var(--pin-scale) * 0.85)); }
  55%  { transform: scale(calc(var(--pin-scale) * 1.15)); }
  100% { transform: scale(var(--pin-scale)); }
}
@keyframes pin-heat-down {
  0%   { transform: scale(calc(var(--pin-scale) * 1.12)); }
  100% { transform: scale(var(--pin-scale)); }
}
@keyframes glow-breathe {
  0%, 100% { opacity: 0.75; transform: translate(-50%, -50%) scale(0.92); }
  50%      { opacity: 1;    transform: translate(-50%, -50%) scale(1.06); }
}

/* "You are here" (GPS, this browser only): your dog in a Havhav-red ring with
   a soft red pulse. Not the same as a park "mine" check-in pin. */
.me-icon { background: none; border: 0; }
.me-marker { position: relative; width: 48px; height: 48px; }
.me-avatar {
  position: absolute; inset: 2px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
  background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(80, 20, 20, 0.35);
}
.me-avatar svg, .me-avatar .avatar-photo { width: 40px; height: 40px; display: block; }
.me-avatar .avatar-photo { object-fit: cover; border-radius: 50%; }
.me-paw { font-size: 22px; }
.me-pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(198, 40, 40, 0.35);
  animation: me-pulse 2.2s ease-out infinite;
}

/* ---------------- Popups ---------------- */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  background-color: var(--cream);
  box-shadow: var(--shadow-lg);
  animation: card-in 0.25s var(--ease-pop) both;
  transform-origin: 50% 100%;
}
.leaflet-popup-tip { background: var(--cream); box-shadow: var(--shadow-sm); }
.leaflet-popup-content { margin: 14px 16px; min-width: 230px; font-family: var(--body); color: var(--ink); }
/* Tall park popups scroll inside (Leaflet sets the height via maxHeight). */
.park-popup .leaflet-popup-content.leaflet-popup-scrolled {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 0;
}
.leaflet-container a.leaflet-popup-close-button {
  width: 32px; height: 32px; top: 8px; right: 8px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--sand);
  color: var(--ink-soft);
  font: 400 22px/1 var(--body);
}
.leaflet-container a.leaflet-popup-close-button:hover { background: var(--sand-dark); color: var(--ink); }

.popup { text-align: start; }
/* Leaflet's close button is always top-right, so leave room for it there */
.popup h3 { margin: 0 34px 0 0; font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.popup .meta { margin: 0 0 6px; font-size: 0.85rem; line-height: 1.4; }
.popup .meta b { font-weight: 600; }
.popup .here-count { margin: 10px 0 4px; font-weight: 600; font-size: 0.9rem; }
.popup .pets { list-style: none; margin: 0 0 10px; padding: 0; max-height: 156px; overflow-y: auto; }
.popup .pets li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius-sm); font-size: 0.92rem; }
.popup .pets li:nth-child(odd) { background: rgba(234, 216, 184, 0.35); }
/* Each dog in "who's here" is a button that opens its profile card. */
.popup .pets li:has(> .pet-row) { padding: 0; }
.pet-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 44px;
  padding: 4px 6px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: inherit; font: inherit; text-align: start;
  cursor: pointer;
}
.pet-row:hover { background: var(--brand-soft); }
.pet-row:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.pet-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.popup .pets .since { color: var(--ink-soft); font-size: 0.75rem; margin-inline-start: auto; white-space: nowrap; }
.popup .empty-pets { margin: 0 0 10px; color: var(--ink-soft); font-size: 0.88rem; }
.popup .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* Park photo (real Wikimedia photo, or the branded placeholder) */
.park-photo { margin: 10px 0 0; }
.park-photo img {
  display: block;
  width: 100%; height: 140px;
  object-fit: cover;
  border-radius: 18px;
  background: var(--sand);
  box-shadow: var(--shadow-sm);
}
.park-photo figcaption {
  margin-top: 4px;
  font-size: 0.68rem; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.park-photo figcaption a { color: inherit; text-decoration: none; }
.park-photo figcaption a:hover { text-decoration: underline; }
.park-photo.placeholder {
  height: 110px;
  display: grid; place-items: center;
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 120%, var(--leaf) 0 30%, transparent 31%),
    radial-gradient(circle at 85% 130%, var(--leaf) 0 35%, transparent 36%),
    var(--sand);
}
.park-photo.placeholder img {
  width: 56px; height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(59, 42, 32, 0.25);
}

/* Park amenities: five compact icons (yes / no / unknown) */
.amenities-box { margin-top: 10px; }
.amenities-title { margin: 0 0 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.amenities {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px 3px;
}
.amenity { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-width: 0; }
.amenity-icon {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.amenity-icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.amenity-label { font-size: 0.66rem; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
/* Known yes: filled green circle, white icon */
.amenity.yes .amenity-icon { background: #4f9a5a; color: #fff; box-shadow: var(--shadow-sm); }
.amenity.yes .amenity-label { font-weight: 600; }
/* Known no: muted with a diagonal slash */
.amenity.no .amenity-icon { background: #ece6dc; color: #9a8f82; }
.amenity.no .amenity-icon::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 50%;
  height: 2.5px; border-radius: 2px; background: #b5483b;
  transform: rotate(-45deg);
}
.amenity.no .amenity-label { color: var(--ink-soft); }
/* Unknown: grey dashed ring with a small "?" — must never look like a yes */
.amenity.unknown .amenity-icon { border: 1.5px dashed #b9b0a4; color: #b9b0a4; background: transparent; }
.amenity.unknown .amenity-label { color: var(--ink-soft); }
.amenity-q {
  position: absolute; top: -4px; inset-inline-end: -4px;
  width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 0.62rem/1 var(--body);
  background: #8f857a; color: #fff;
}
.amenities-note { margin: 5px 0 0; font-size: 0.68rem; color: var(--ink-soft); }

/* Directions: Google Maps / Waze */
.directions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.directions-label { flex-basis: 100%; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.leaflet-container a.dir-btn {
  flex: 1 1 0;
  min-height: 40px;
  display: grid; place-items: center;
  padding: 0 10px;
  border: 2px solid var(--sand-dark); border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600; font-size: 0.9rem;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 2px 0 var(--sand-dark);
}
.leaflet-container a.dir-btn:hover { border-color: var(--brand); }

.demo-tag, .you-tag {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: var(--sand-dark); color: var(--ink-soft);
}
.you-tag { background: #dbe8fb; color: #2b5ea8; }
.way-tag {
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: #fde7cf; color: #8a4a12;
  border: 1px dashed var(--busy);
  white-space: nowrap;
}

/* ---------------- Buttons ---------------- */
.primary-btn {
  min-height: 50px;
  padding: 0 24px;
  border: 0; border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 1.08rem; font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: inset 0 -4px 0 var(--brand-dark), 0 4px 10px rgba(142, 27, 27, 0.25);
}
.primary-btn:hover { background: var(--brand-hover); }
.primary-btn:active { box-shadow: inset 0 -2px 0 var(--brand-dark), 0 2px 4px rgba(142, 27, 27, 0.2); }
.primary-btn:disabled { opacity: 0.6; cursor: wait; }

.secondary-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--sand-dark); border-radius: 999px;
  background: var(--paper);
  font-weight: 600;
  box-shadow: 0 2px 0 var(--sand-dark);
}
.secondary-btn:hover { border-color: var(--brand); }

/* Floating "I'm here" button */
.fab {
  position: absolute;
  z-index: 800;
  left: 50%; bottom: calc(20px + var(--below-map));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  min-height: 58px;
  padding: 6px 22px 6px 8px;
  border: 0; border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 1.1rem; font-weight: 600;
  box-shadow: inset 0 -4px 0 var(--brand-dark), 0 0 0 4px rgba(255, 250, 240, 0.85), var(--shadow-lg);
  white-space: nowrap;
  transition: transform 0.15s var(--ease-out), background-color 0.15s ease;
}
.fab:active { transform: translateX(-50%) translateY(2px) scale(0.97); }
[dir='rtl'] .fab { padding: 6px 8px 6px 22px; }
.fab:hover { background: var(--brand-hover); }
.fab:disabled { opacity: 0.7; cursor: wait; }
.fab-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--cream);
  display: grid; place-items: center;
  font-size: 24px;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}
.fab-avatar svg { width: 44px; height: 44px; }

.round-btn {
  position: absolute;
  z-index: 800;
  width: 50px; height: 50px;
  border: 0; border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 26px; line-height: 1;
  box-shadow: inset 0 -3px 0 var(--sand-dark), var(--shadow);
}
.locate-btn {
  right: 12px; bottom: calc(98px + var(--below-map));
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--brand);
  border: 3px solid var(--brand);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15), var(--shadow);
}
.locate-btn svg { width: 26px; height: 26px; display: block; }
.locate-btn .loc-core { fill: none; transition: fill 0.2s ease; }
/* Following your position: the centre fills in. */
.locate-btn.on .loc-core { fill: currentColor; }
[dir='rtl'] .locate-btn { right: auto; left: 12px; }
/* While a park popup is open: the popup has its own check-in buttons, so the
   FAB hides (it used to cover Directions) and the locate button drops into
   the corner, below the popup's bottom padding, so it stays tappable. */
body.park-popup-open .fab { display: none; }
body.park-popup-open .locate-btn { bottom: calc(20px + var(--below-map)); }

/* ---------------- Map search bar + chips (frosted glass, like Apple Maps) ---------------- */
.map-top {
  position: absolute; z-index: 1100; /* above Leaflet controls (1000) */
  top: 10px; left: 10px; right: 10px;
  max-width: 520px;
  pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.glass {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);
  backdrop-filter: saturate(1.8) blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 18px rgba(30, 30, 40, 0.14), 0 0 0 0.5px rgba(30, 30, 40, 0.08);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 255, 255, 0.95); }
}
.search-wrap { position: relative; }
.search-bar {
  display: flex; align-items: center; gap: 8px;
  height: 50px; padding: 0 8px 0 14px;
  border-radius: 25px;
}
[dir='rtl'] .search-bar { padding: 0 14px 0 8px; }
.search-icon { width: 21px; height: 21px; flex: 0 0 auto; color: #6b6f76; }
.search-bar input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; /* 16 px: no iOS auto-zoom */
  color: var(--ink);
}
.search-bar input::placeholder { color: #80848b; }
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-bar:focus-within { box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.18), 0 4px 18px rgba(30, 30, 40, 0.14); }
.search-clear {
  width: 32px; height: 32px; flex: 0 0 auto;
  border: 0; border-radius: 50%;
  background: rgba(120, 120, 128, 0.18); color: #55595f;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.search-results {
  position: absolute; top: 56px; left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  border-radius: 20px;
  max-height: min(60vh, 380px); overflow-y: auto;
  background: rgba(255, 255, 255, 0.92);
  z-index: 2;
}
.search-item {
  width: 100%; min-height: 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border: 0; border-radius: 14px; background: transparent;
  font: inherit; color: var(--ink); text-align: start; cursor: pointer;
}
.search-item:hover, .search-item.active { background: rgba(120, 120, 128, 0.12); }
.search-item-icon {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 50%; font-size: 17px;
}
.search-item-icon.park { background: var(--brand-soft); }
.search-item-icon.place { background: #e3effc; }
.search-item-text { min-width: 0; display: flex; flex-direction: column; }
.search-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-sub { font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 12px 14px; color: var(--ink-soft); font-size: 0.92rem; }

.map-chips { display: flex; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px;
  border-radius: 20px;
  font: inherit; font-family: var(--display); font-weight: 600; font-size: 1rem;
  color: var(--ink); cursor: pointer;
}
.chip:active { transform: scale(0.97); }
.chip-check {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: #34a853; color: #fff; font-size: 12px; font-weight: 700;
}
.filter-chip { position: relative; width: 44px; padding: 0; justify-content: center; }
.filter-chip svg { width: 22px; height: 22px; }
.filter-chip.on { color: var(--brand); }
.filter-count {
  position: absolute; top: -4px; inset-inline-end: -4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--brand); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center;
}
.filter-panel {
  display: flex; flex-direction: column; gap: 2px;
  width: max-content; min-width: 210px;
  margin-top: 8px; padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}
.filter-panel[hidden] { display: none; }
.filter-opt {
  display: flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 0 12px;
  border-radius: 12px; cursor: pointer;
  font-weight: 600;
}
.filter-opt:hover { background: rgba(120, 120, 128, 0.1); }
.filter-opt input { width: 20px; height: 20px; accent-color: var(--brand); }

/* The picked address: a small blue dot (never sent anywhere). */
.search-pin { background: none; border: 0; }
.search-pin span {
  display: block; width: 22px; height: 22px; border-radius: 50%;
  background: #2f7cf6; border: 4px solid #fff;
  box-shadow: 0 2px 6px rgba(30, 30, 40, 0.35);
}

/* Leaflet's zoom buttons sit under the search bar and chips. */
.map-wrap .leaflet-top { top: 108px; }

/* Status chip: "You're at X — Check out" (under the search bar and chips) */
.status-chip {
  position: absolute;
  z-index: 800;
  top: 108px; left: 50%;
  transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 124px);
  display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 8px;
  background: var(--cream);
  border-radius: 999px;
  border: 2px solid var(--sand-dark);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: chip-in 0.35s var(--ease-pop) both;
}
.status-chip .mini { width: 36px; height: 36px; flex: 0 0 36px; }
.status-chip .mini svg { width: 36px; height: 36px; }
.status-chip .status-text { min-width: 0; line-height: 1.2; }
.status-chip .status-text small { display: block; color: var(--ink-soft); }
.status-chip .secondary-btn, .status-chip .primary-btn { min-height: 38px; flex: 0 0 auto; padding-inline: 12px; font-size: 0.9rem; }

/* Leaflet zoom controls: bigger tap targets */
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
.leaflet-touch .leaflet-bar { border: 0; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow); }
.leaflet-bar a { background: rgba(255, 255, 255, 0.92); color: var(--ink); }
.leaflet-bar a:hover { background: var(--sand); }
.leaflet-control-attribution { font-size: 11px; }

/* ---------------- Credits (bottom of the Settings screen) ---------------- */
.credits {
  margin: 8px 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--ink-soft);
  background: var(--sand);
  text-align: center;
}
.footer-sep { margin: 0 4px; }

/* ---------------- Bottom navigation (Map / My Dog / Settings) ----------------
   Part of the page's column layout (header, views, nav), so the map simply
   ends above it: the FAB, locate button, zoom and attribution are never
   covered. Its bottom padding keeps the buttons above the iPhone home bar. */
.bottom-nav {
  flex: none;
  position: relative;
  z-index: 1000;
  display: flex; justify-content: center; gap: 6px;
  padding: 6px calc(10px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px))
    calc(10px + env(safe-area-inset-left, 0px));
  background-color: var(--paper);
  border-top: 2px solid var(--sand-dark);
  box-shadow: 0 -4px 14px rgba(59, 42, 32, 0.08);
}
/* No nav during first-run screens, under the splash, or while the phone
   keyboard is open (it would squeeze the form). */
.first-run .bottom-nav, .kb-open .bottom-nav { display: none; }
.splash-active .bottom-nav { visibility: hidden; }
.nav-btn {
  position: relative;
  flex: 1 1 0; max-width: 170px;
  min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 6px;
  border: 0; border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--display); font-weight: 600; font-size: 0.85rem; line-height: 1.1;
}
.nav-btn:hover { background: var(--sand); }
.nav-icon { height: 30px; display: grid; place-items: center; font-size: 1.35rem; line-height: 1; }
.nav-avatar {
  width: 30px; border-radius: 50%; overflow: hidden;
  background: var(--sand); font-size: 1.05rem;
}
.nav-avatar svg { width: 30px; height: 30px; }
.nav-btn[aria-current='page'] { color: var(--brand); background: var(--brand-soft); }
.nav-btn[aria-current='page'] .nav-avatar { box-shadow: 0 0 0 2px var(--brand); }
/* Small orange dot: this tab has edits that aren't saved yet */
/* Buddies tab: how many buddy requests are waiting (a small red number) */
.nav-count {
  position: absolute; top: 3px; inset-inline-start: calc(50% + 8px);
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  background: var(--brand); color: #fff;
  border: 2px solid var(--paper);
  font-family: var(--body); font-size: 0.72rem; font-weight: 700; line-height: 16px;
  text-align: center;
}
.nav-dot {
  position: absolute; top: 5px; inset-inline-start: calc(50% + 10px);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--busy); border: 2px solid var(--paper);
}

/* ---------------- How many dogs here? (park popup; app.js section 6o) ----------------
   Four bucket buttons + one live line. No animations. */
.dog-report { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--sand-dark); }
.dog-report .dog-report-title { margin: 0 0 4px; font-family: var(--display); font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.dog-report .dog-report-line, .dog-report .dog-report-note { margin: 0 0 6px; font-size: 0.88rem; color: var(--ink); }
.dog-report-line { font-weight: 600; }
.dog-buckets { display: grid; margin-bottom: 4px; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dog-bucket {
  min-height: 44px; padding: 0 4px;
  border: 1.5px solid var(--sand-dark); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-family: var(--display); font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
}
.dog-bucket:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.dog-bucket:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.dog-bucket.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.dog-bucket:disabled { opacity: 0.5; cursor: default; }
.dog-report-login { padding: 0 2px; font-size: 0.9rem; }

/* ---------------- Lost-dog alerts (map banner, My Dog box, dialogs; app.js section 6f) ----------------
   The banner sits under the search bar and chips (right of Leaflet's zoom
   buttons), below the status chip when you're checked in, and hides while a
   park popup is open. */
.lost-banner {
  position: absolute;
  z-index: 810;
  top: 108px; left: 60px; right: 12px;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px;
  padding: 6px 12px 6px 6px;
  border: 2px solid var(--brand); border-radius: var(--radius-md);
  background: #fff6f4; color: var(--ink);
  box-shadow: var(--shadow);
  text-align: start; font: inherit;
  animation: rise-in 0.35s var(--ease-pop) both;
}
[dir='rtl'] .lost-banner { padding: 6px 6px 6px 12px; }
.lost-banner.has-status { top: 162px; }
.lost-banner.found { border-color: var(--quiet); background: #eef7e8; }
body.park-popup-open .lost-banner { display: none; }
.lost-banner-avatar, .lost-avatar {
  flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #eef5e2 0 50%, #e0edcb 70%, #d3e5b8 100%);
}
.lost-banner-avatar { width: 40px; height: 40px; }
.lost-banner-avatar svg, .lost-banner-avatar .avatar-photo { width: 38px; height: 38px; border-radius: 50%; }
.lost-banner-text { flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.lost-banner-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); color: var(--brand-dark); }
.lost-banner.found .lost-banner-text b { color: #2f5a22; }
.lost-banner-text small { display: block; color: var(--ink-soft); font-size: 0.82rem; }
.lost-banner-more {
  flex: none; padding: 3px 9px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 0.78rem; font-weight: 700;
}
.lost-banner-go { flex: none; font-size: 1.4rem; color: var(--ink-soft); }
/* Cards */
.lost-list { list-style: none; margin: 0; padding: 0; }
/* The base .sheet-body rule (later in this file) sets the side padding, so be more specific. */
.lost-sheet .sheet-body.lost-list-body {
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
}
#lost-confirm-preview, .lost-dog-row { margin-left: 16px; margin-right: 16px; }
.lost-list-body .lost-list { padding: 4px 0 0; }
.lost-list-body .buddy-empty { margin-inline: 0; }
.lost-card {
  margin: 0 0 12px; padding: 12px 14px;
  border: 2px solid var(--brand-soft); border-radius: var(--radius-md);
  background: var(--paper); box-shadow: var(--edge);
}
.lost-card.state-found { border-color: #cfe5c4; background: #f6fbf2; }
.lost-card.state-expired { background: var(--cream); box-shadow: none; }
.lost-top { display: flex; align-items: center; gap: 12px; }
.lost-avatar { width: 76px; height: 76px; }
.lost-avatar svg, .lost-avatar .avatar-photo { width: 72px; height: 72px; border-radius: 50%; }
.lost-id { min-width: 0; }
.lost-name { margin: 0; font-family: var(--display); font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.lost-tag {
  display: inline-block; vertical-align: middle;
  padding: 2px 10px; border-radius: 999px;
  font-family: var(--body); font-size: 0.75rem; font-weight: 700;
  background: var(--brand); color: #fff;
}
.lost-tag.found { background: #4f9a46; }
.lost-tag.expired { background: var(--sand); color: var(--ink-soft); }
.lost-meta { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.lost-where, .lost-when { margin: 8px 0 0; overflow-wrap: anywhere; }
.lost-when small { color: var(--ink-soft); }
.lost-card .lost-found-btn, .lost-card .lost-saw-btn { width: 100%; margin-top: 12px; min-height: 48px; }
.lost-card .lost-confirm { margin-top: 12px; }
.lost-guest { margin: 10px 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.lost-tips { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--sand-dark); }
.lost-tips-title { margin: 0 0 6px; font-weight: 700; }
.lost-tips ul { list-style: none; margin: 0; padding: 0; }
.lost-tip { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--sand); }
.lost-tip + .lost-tip { margin-top: 6px; }
.lost-tip p { margin: 0; overflow-wrap: anywhere; }
.lost-tip-note { margin-top: 4px !important; }
.lost-tip-meta { margin-top: 4px !important; color: var(--ink-soft); font-size: 0.85rem; }
.lost-tip-form { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--sand-dark); }
.lost-tip-q { margin: 0 0 4px; font-weight: 700; }
.lost-tip-form .field input[type='text'] { width: 100%; }
.lost-tip-form .buddy-actions { margin: 6px 0 0; }
.lost-tip-form .buddy-actions > * { flex: 1 1 120px; }
/* My Dog box */
.lost-box { margin: 0 16px 14px; }
.lost-box .lost-missing-btn { width: 100%; min-height: 50px; font-size: 1.05rem; }
.lost-box .lost-box-actions { margin: 6px 0 0; }
.lost-live { margin: 0 0 8px; font-weight: 700; color: var(--brand-dark); }
.lost-done { margin: 0 0 8px; font-weight: 700; color: #2f5a22; }
.lost-pitch, .lost-ended { margin: 0 0 8px; }
.lost-tips .lost-no-tips { margin: 0; text-align: start; }
/* "My dog is missing" dialog */
.lost-dog-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.lost-dog-row .lost-avatar { width: 60px; height: 60px; }
.lost-dog-row .lost-avatar svg, .lost-dog-row .lost-avatar .avatar-photo { width: 56px; height: 56px; }
.lost-dog-row b { display: block; font-family: var(--display); font-size: 1.2rem; }
.lost-dog-row small { color: var(--ink-soft); }
.lost-confirm-q { margin: 0 16px 10px; font-family: var(--display); font-size: 1.2rem; font-weight: 700; }
.lost-sheet > .sheet-form { flex: 1 1 auto; height: auto; }
.lost-sheet .designer-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.lost-sheet .designer-actions .primary-btn, .lost-sheet .designer-actions .danger-btn { flex: none; min-height: 50px; }
.lost-sheet .sheet-body { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
#lost-dialog .sheet-body { padding-bottom: 16px; }
@media (min-width: 820px) {
  .sheet.picker.lost-sheet { width: min(100vw, 560px); }
  .lost-banner { left: auto; width: 420px; }
  [dir='rtl'] .lost-banner { right: auto; left: 60px; }
}
/* ---------------- Park reviews (popup row, reviews sheet, write form; app.js section 6g) ----------------
   No new animations here (the sheets use the shared sheet-up). Visitor photos
   are always labelled "Visitor photos" and never take the official photo's place. */
.review-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
  margin-top: 10px; padding: 4px 0 2px;
  border-top: 1px dashed var(--sand-dark);
}
.review-summary {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 10px 0 2px;
  border: 0; border-radius: 999px; background: none;
  font: inherit; color: var(--ink); cursor: pointer;
}
[dir='rtl'] .review-summary { padding: 0 2px 0 10px; }
.review-summary:hover { background: var(--brand-soft); }
.review-summary:focus-visible, .review-thumb:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.review-star { color: #e0a100; font-size: 1.15rem; line-height: 1; }
.review-star.none { color: var(--ink-soft); }
.review-summary b { font-family: var(--display); font-size: 1.05rem; }
.review-count { color: var(--ink-soft); font-size: 0.88rem; }
.review-open { font-weight: 600; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; }
.review-count + .review-open { margin-inline-start: 4px; }
.review-write-link { margin-inline-start: auto; padding: 0 4px; font-size: 0.9rem; }
/* Read-only stars */
.stars { display: inline-flex; gap: 1px; color: var(--sand-deep); font-size: 1rem; line-height: 1; letter-spacing: 0; }
.stars .on { color: #e0a100; }
/* The sheet */
.reviews-sheet .sheet-body.reviews-body {
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
}
.reviews-sheet > .sheet-form { flex: 1 1 auto; height: auto; }
.reviews-sheet .designer-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.reviews-sheet .designer-actions .primary-btn { min-height: 50px; }
#reviews-list-bar .primary-btn { flex: 1 1 auto; }
#reviews-dialog h2 { min-width: 0; overflow-wrap: anywhere; font-size: 1.25rem; }
.reviews-summary .field-hint { margin: -4px 0 10px; }
.reviews-avg { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 4px 0 12px; }
.reviews-avg b { font-family: var(--display); font-size: 2rem; line-height: 1; }
.reviews-avg .stars { font-size: 1.3rem; }
.reviews-n { color: var(--ink-soft); font-weight: 600; }
.reviews-body .buddy-empty { margin-inline: 0; }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-card {
  margin: 0 0 12px; padding: 12px 14px;
  border: 2px solid var(--sand); border-radius: var(--radius-md);
  background: var(--paper); box-shadow: var(--edge);
}
.review-card.mine { border-color: #cfe0f6; }
.review-top { display: flex; align-items: center; gap: 8px; }
.review-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.review-who .buddy-avatar { width: 44px; height: 44px; flex-basis: 44px; }
.review-who .buddy-text { align-items: flex-start; } /* a Hebrew dog name in the English UI still starts at the start */
.review-who .buddy-avatar svg, .review-who .buddy-avatar .avatar-photo { width: 40px; height: 40px; border-radius: 50%; }
.review-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0 0; }
.review-date { color: var(--ink-soft); font-size: 0.85rem; }
.review-text { margin: 6px 0 0; line-height: 1.45; overflow-wrap: anywhere; }
.review-photos-label { margin: 10px 0 4px; color: var(--ink-soft); font-size: 0.8rem; font-weight: 700; }
.review-photos { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.review-thumb {
  display: block; width: 92px; height: 72px; padding: 0;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-sm);
  background: var(--sand); overflow: hidden; cursor: zoom-in;
}
.review-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.review-actions .secondary-btn { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
.review-actions .review-delete { color: var(--brand-dark); }
.review-report { padding: 0; font-size: 0.88rem; color: var(--ink-soft); }
.review-confirm { margin-top: 10px; }
.review-report-form { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--sand-dark); }
.review-report-q { margin: 0 0 6px; font-weight: 700; }
.review-report-form .field input[type='text'] { width: 100%; }
.review-report-form .buddy-actions { margin: 6px 0 0; }
.review-report-form .buddy-actions > * { flex: 1 1 120px; }
/* The star picker: five big tap targets (native radios underneath, so arrow
   keys and screen readers work as a normal radio group). */
.star-field { margin-top: 6px; }
.star-picker { display: flex; gap: 4px; }
.star {
  display: grid; place-items: center;
  width: 54px; height: 54px;
  border-radius: 50%;
  color: var(--sand-deep); font-size: 2.4rem; line-height: 1;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s var(--ease-out), color 0.12s;
}
.star.on { color: #e0a100; }
.star:active { transform: scale(0.92); }
.star-picker input:focus-visible + .star { outline: 3px solid var(--brand); outline-offset: 0; }
.star-caption { margin: 2px 0 0; min-height: 1.3em; font-weight: 600; color: var(--ink-soft); }
.review-photo-edit { list-style: none; margin: 0 0 8px; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.review-photo-edit:empty { display: none; }
.review-photo-edit li { position: relative; }
.review-photo-edit img {
  display: block; width: 104px; height: 80px; object-fit: cover;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-sm); background: var(--sand);
}
.review-photo-remove {
  position: absolute; top: -10px; inset-inline-end: -10px;
  width: 36px; height: 36px; padding: 0;
  border: 2px solid #fff; border-radius: 50%;
  background: var(--brand-dark); color: #fff; font-size: 0.95rem; line-height: 1;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
#review-photo-actions { justify-content: flex-start; margin-bottom: 4px; }
#review-photo-actions[hidden] { display: none; }
/* The bigger visitor photo: a small card (also on phones). */
.sheet.photo-viewer {
  width: min(96vw, 720px); max-height: min(92dvh, var(--vv-h, 92dvh));
  margin: auto; border-radius: var(--radius);
  overflow: hidden;
}
.sheet.photo-viewer[open] { display: flex; flex-direction: column; }
.photo-viewer-figure { margin: 0; padding: 0 12px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.photo-viewer-figure img {
  display: block; max-width: 100%; max-height: calc(min(92dvh, var(--vv-h, 92dvh)) - 120px);
  margin: 0 auto; border-radius: var(--radius-sm); object-fit: contain; background: var(--sand);
}
.photo-viewer-figure figcaption { color: var(--ink-soft); font-size: 0.88rem; text-align: center; }
@media (min-width: 820px) {
  .sheet.picker.reviews-sheet { width: min(100vw, 560px); }
}

/* ---------------- Dialogs (designer + picker) ---------------- */
.sheet {
  width: min(100vw, 760px);
  max-height: 100dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 28px 28px 0 0;
  background-color: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.sheet::backdrop { background: rgba(59, 42, 32, 0.45); backdrop-filter: blur(3px); }
/* Sheets slide up softly when they open (transform only, so the splash
   opacity rule below is never overridden). */
.sheet[open] { animation: sheet-up 0.35s var(--ease-out); }

/*
 * Full screens: My Dog and Settings (tab screens, also first-run steps 1 and 2),
 * plus the language screen and park picker (dialogs) on phones. Layout is
 *   [head]        fixed at the top (small)
 *   [.sheet-body] the ONLY scroller: preview, photo box and every field
 *   [actions]     Save bar, always visible, above the nav / home bar / toolbar
 * Nothing important lives outside .sheet-body, so a tall preview or photo can
 * never crush the fields.
 */
.screen {
  position: absolute;
  inset: 0;
  z-index: 950;                /* above the map and the park list */
  display: flex; flex-direction: column;
  background-color: var(--cream);
  color: var(--ink);
  overflow: hidden;
  animation: screen-in 0.25s var(--ease-out);
}
.screen > .sheet-form { flex: 1 1 auto; height: auto; }
/* Phones: the tab screens are edge-to-edge, so the header steps aside. */
@media (max-width: 819px) {
  .first-run .topbar { display: none; }
  /* Other tabs keep the header for the Settings gear; the park list and the
     city switcher only make sense on the map. */
  body:not([data-tab='map']) .topbar #toggle-list,
  body:not([data-tab='map']) .topbar .city-btn { display: none; }
  body:not(.first-run) .screen .designer-head { padding-top: 10px; }
}
.sheet.lang-sheet, .sheet.picker {
  inset: 0;
  margin: 0;
  width: 100vw; max-width: 100vw;  /* the browser default leaves a gap on phones */
  height: 100vh;                   /* old browsers */
  height: 100dvh;
  max-height: min(100dvh, var(--vv-h, 100dvh));
  border-radius: 0;
  overflow: hidden;
}
.sheet.picker[open] { display: flex; flex-direction: column; }
.sheet-form {
  display: flex; flex-direction: column;
  height: 100%; max-height: 100%;
  min-height: 0;
}
.screen .designer-head, .sheet.picker .designer-head {
  flex: none;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
}
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Room so the last field scrolls fully clear of the Save bar, and focused
     inputs aren't scrolled to right under it. */
  padding-bottom: 32px;
  scroll-padding-bottom: 96px;
  scroll-padding-top: 12px;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.designer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 4px;
}
.designer-head h2 { margin: 0; font-size: 1.4rem; font-weight: 700; line-height: 1.15; }
.dialog-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dialog-logo {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 3px 0 var(--brand-dark), 0 4px 10px rgba(142, 27, 27, 0.2);
}
.designer-intro, .picker-reason { margin: 0; padding: 0 16px 8px; color: var(--ink-soft); font-size: 0.9rem; }

.preview-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin: 4px 16px 8px;
  padding: 10px 16px 14px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 2px solid var(--sand);
  box-shadow: var(--edge);
}
.preview {
  width: 150px; height: 150px;
  /* A little round "garden" behind the cartoon dog */
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #eef5e2 0 50%, #e0edcb 70%, #d3e5b8 100%);
}
.preview svg { width: 150px; height: 150px; }
.preview-name { font-family: var(--display); font-size: 1.25rem; font-weight: 600; min-height: 1.5em; }
.preview-meta { font-size: 0.9rem; color: var(--ink-soft); min-height: 1.3em; }

/* Searchable, scrollable breed list (about 40 breeds — not a huge grid) */
.field input.breed-search {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-md);
  background: var(--paper);
  font: inherit; font-size: 1rem; color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.breed-list {
  margin-top: 6px;
  max-height: 248px;
  overflow-y: auto;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-md);
  background: var(--paper);
  overscroll-behavior: contain;
}
.breed-list button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 48px;
  padding: 4px 12px;
  border: 0; border-bottom: 1px solid var(--sand);
  background: transparent;
  font: inherit; font-weight: 600; color: var(--ink);
  text-align: start;
}
.breed-list button:last-child { border-bottom: 0; }
.breed-list button svg { width: 40px; height: 40px; flex: none; }
.breed-list button[aria-selected='true'] { background: var(--brand-soft); box-shadow: inset 4px 0 0 var(--brand); }
[dir='rtl'] .breed-list button[aria-selected='true'] { box-shadow: inset -4px 0 0 var(--brand); }
.breed-list .breed-empty { padding: 14px; color: var(--ink-soft); text-align: center; }

.fields { padding: 4px 16px; }
.field { display: block; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.field-label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 0.9rem; padding: 0; }
.field input[type='text'],
.field input[type='number'],
.field input[type='tel'],
.field input[type='email'],
.field input[type='password'] {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-md);
  background: var(--paper);
  font-size: 1.05rem; color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* Soft red glow on the field you're typing in */
.field input:focus, .field input.breed-search:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.15);
}

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button, .tiles button {
  border: 2px solid var(--sand-dark);
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 0 var(--sand-dark);
}
.seg button { min-height: 46px; padding: 0 18px; font-weight: 600; border-radius: 999px; }
.seg button[aria-pressed='true'], .tiles button[aria-pressed='true'] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: 0 2px 0 var(--brand);
}

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.tiles button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px;
  font-size: 0.78rem; font-weight: 600;
}
.tiles button svg { width: 56px; height: 56px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--sand-dark);
  padding: 0;
}
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--brand); transform: scale(1.08); }
.swatch-custom {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--sand-dark);
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.swatch-custom input {
  position: absolute; inset: -6px;
  width: 52px; height: 52px;
  opacity: 0; cursor: pointer; border: 0; padding: 0;
}

.designer-actions {
  /* Outside the scroller and pinned to the bottom of the dialog, so it's always
     visible; the safe-area padding keeps it above the iPhone home bar. */
  position: sticky; bottom: 0; z-index: 2;
  flex: none;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px calc(16px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  border-top: 2px dashed var(--sand-dark);
  background: var(--cream);
  box-shadow: 0 -6px 14px rgba(59, 42, 32, 0.06);
}
/* When the bottom nav is showing, it sits below the Save bar and already keeps
   clear of the home bar, so the Save bar only needs its normal padding. */
body:not(.first-run) .screen .designer-actions { padding-bottom: 12px; }
.form-error { margin: 0; flex: 1; color: var(--packed); font-size: 0.88rem; font-weight: 600; }

.picker-body { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.picker-list { list-style: none; margin: 0; padding: 0 12px; }
.picker-list li { margin-bottom: 6px; }
.picker-list .park-item { box-shadow: var(--edge); }

/* ---------------- City switcher ---------------- */
/* A cream pill at the end of the red header: "📍 Herzliya ▾". */
.city-btn {
  flex: 0 1 auto;
  min-width: 0; max-width: 46vw;
  min-height: 44px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border: 0; border-radius: 999px;
  background: var(--cream); color: var(--brand-dark);
  font-family: var(--display); font-weight: 600; font-size: 0.95rem;
  box-shadow: 0 3px 0 var(--brand-dark);
  transition: transform 0.15s var(--ease-out);
}
.city-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-dark); }
.city-btn-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-btn-pin { font-size: 0.9rem; }
.city-btn-caret { font-size: 0.75rem; opacity: 0.8; }
/* The subtitle gives way first on small phones, so the city name and the
   Settings gear fit beside the logo (390 px phones). */
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .subtitle { display: none; }
  .brand h1 { font-size: 1.3rem; }
  .city-btn { max-width: 38vw; padding: 6px 10px; }
}
@media (max-width: 360px) { .topbar .brand-text { display: none; } }

/* ---------------- Settings gear (header, every tab) ---------------- */
.settings-gear {
  position: relative;
  flex: none;
  width: 44px; min-width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.gear-icon { width: 1.5rem; height: 1.5rem; display: block; }
.settings-gear[aria-current='page'] { background: var(--cream); color: var(--brand); }
.settings-gear:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; } /* cream ring: readable on the red header */
.settings-gear .gear-dot { top: 2px; inset-inline-start: auto; inset-inline-end: 0; border-color: var(--brand); }
.first-run .settings-gear { display: none; }

.city-list .city-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid var(--sand);
  border-radius: 20px;
  background: var(--paper);
  text-align: start;
  box-shadow: var(--edge);
  transition: transform 0.15s var(--ease-out), border-color 0.15s ease;
}
.city-list .city-item:hover { border-color: var(--leaf); }
.city-list .city-item:active { transform: translateY(2px) scale(0.99); }
.city-list .city-item.selected { border-color: var(--brand); background: #fff7f5; box-shadow: 0 3px 0 var(--brand-dark); }
.city-item-name { flex: 1; min-width: 0; font-family: var(--display); font-size: 1.1rem; font-weight: 600; }
.city-item-sub { flex: 0 0 auto; font-size: 0.82rem; color: var(--ink-soft); }
.city-item-check { flex: 0 0 auto; color: var(--brand); font-weight: 700; }

.settings-city-btn { width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 6px; min-height: 52px; }
.settings-city-btn #settings-city-name { font-weight: 700; }
.settings-city-change { margin-inline-start: auto; font-size: 0.85rem; color: var(--ink-soft); font-weight: 500; }

/* Park popup: opening hours / approximate-pin note */
.park-facts { margin: 6px 0 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.78rem; color: var(--ink-soft); }
.park-fact.approx { font-style: italic; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  z-index: 3000;
  left: 50%; top: calc(var(--header-h) + 64px);
  transform: translateX(-50%);
  max-width: min(92vw, 440px);
  padding: 12px 20px;
  border-radius: 20px;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 4px 0 #22170f, var(--shadow-lg);
  text-align: center;
}
/* Slides down + pops in each time it's shown (the [hidden] toggle restarts it) */
.toast:not([hidden]) { animation: toast-in 0.4s var(--ease-pop) both; }

/* ---------------- Check-out reminder banner ----------------
   Shown ~15 and ~5 minutes before a check-in expires, on any tab. */
.reminder {
  position: fixed;
  z-index: 2500; /* above the map and screens, under the toast */
  left: 50%; top: calc(env(safe-area-inset-top, 0px) + 10px);
  transform: translateX(-50%);
  width: min(94vw, 440px);
  padding: 14px 16px 14px;
  padding-inline-end: 52px; /* room for the ✕ */
  border-radius: var(--radius);
  background: var(--cream);
  border: 2px solid var(--sand-dark);
  box-shadow: var(--shadow-lg);
}
.reminder:not([hidden]) { animation: toast-in 0.4s var(--ease-pop) both; }
.reminder-text { margin: 0 0 10px; font-weight: 600; line-height: 1.35; }
.reminder-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reminder-actions .primary-btn, .reminder-actions .secondary-btn { flex: 1 1 auto; min-height: 44px; }
.reminder-close {
  position: absolute; top: 6px; inset-inline-end: 6px;
  width: 44px; border-radius: 50%;
  background: var(--sand); color: var(--ink-soft); font-size: 1.1rem;
}
.splash-active .reminder { visibility: hidden; }

/* ---------------- Settings / owner details screen ---------------- */
.section-title {
  display: block; margin: 0 0 8px; padding: 0;
  font-family: var(--display); font-size: 1.1rem; font-weight: 600;
}
.section-pad { padding: 4px 16px 0; }
.owner-step {
  margin: 0; padding: 0 16px 4px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--brand-dark);
}
.field .optional { font-weight: 400; color: var(--ink-soft); }
.owner-privacy { margin: 0 0 8px; font-size: 0.8rem; color: var(--ink-soft); }
.field input[aria-invalid='true'] { border-color: var(--packed); }

/* ---------------- Language screen + settings ---------------- */
.lang-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  height: 100%;
  max-width: 440px; margin: 0 auto;
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(28px + env(safe-area-inset-bottom, 0px));
}
.lang-logo {
  width: 120px; height: 120px;
  border-radius: 30px;
  object-fit: cover;
  box-shadow: 0 5px 0 var(--brand-dark), 0 14px 30px rgba(142, 27, 27, 0.28);
  animation: rise-in 0.5s var(--ease-pop) both;
}
.lang-choices { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.lang-choice {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 76px; width: 100%;
  padding: 12px 16px;
  border: 0; border-radius: var(--radius);
  background: var(--brand);
  color: var(--cream);
  box-shadow: inset 0 -5px 0 var(--brand-dark), 0 6px 14px rgba(142, 27, 27, 0.22);
  cursor: pointer;
}
.lang-choice:hover { background: var(--brand-hover); }
.lang-choice-name { font-family: var(--display); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.lang-choice-hint { font-size: 0.9rem; opacity: 0.9; }
.settings-field { margin: 0 16px 16px; padding: 14px 16px 6px; border: 2px solid var(--sand); border-radius: var(--radius); background: var(--paper); box-shadow: var(--edge); }
.settings-langs button { flex: 1 1 0; min-height: 52px; font-size: 1.05rem; }

/* ---------------- Account (Settings box + sign up / log in dialog) ---------------- */
.account-box { padding-bottom: 14px; }
.account-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.account-actions .primary-btn, .account-actions .secondary-btn { flex: 1 1 140px; min-height: 48px; }
.account-who { margin: 0 0 4px; font-weight: 600; }
.account-name { font-family: var(--display); color: var(--brand-dark); }
.acct-link { margin: 0; padding: 0 16px 10px; font-size: 0.9rem; color: var(--ink-soft); }
.link-btn {
  min-height: 44px; padding: 0 6px;
  border: 0; background: none;
  font: inherit; font-weight: 700; color: var(--brand);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.account-sheet > .sheet-form { flex: 1 1 auto; height: auto; }
.account-modes { padding: 4px 16px 12px; }
.account-modes button { flex: 1 1 0; }
.field-hint { display: block; margin-top: 4px; font-size: 0.8rem; color: var(--ink-soft); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 0.95rem; }
.check-row input { width: 22px; height: 22px; accent-color: var(--brand); }
/* The dialog is a full screen on phones with its own Save bar: keep it above the home bar. */
.account-sheet .designer-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ---------------- Buddy notifications (Settings box, app.js section 6d) ---------------- */
.push-box { padding-bottom: 12px; }
.push-state {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 0 8px; font-family: var(--display); font-weight: 600; font-size: 1.02rem;
}
.push-dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--sand-deep); box-shadow: 0 0 0 3px var(--sand);
}
.push-box[data-state="on"] .push-dot { background: #4f9a46; box-shadow: 0 0 0 3px #dcefd5; }
.push-box[data-state="blocked"] .push-dot,
.push-box[data-state="needsHomeScreen"] .push-dot { background: var(--busy); box-shadow: 0 0 0 3px #fde6cc; }
.push-help {
  margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--sand); color: var(--ink); font-size: 0.92rem; line-height: 1.45;
}
.push-box .account-actions { margin-bottom: 8px; }
.push-box .account-actions:empty { display: none; }
.push-iphone { font-weight: 600; color: var(--ink); }
.buddy-push-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px;
  margin: 0 16px 12px; padding: 4px 14px; border-radius: var(--radius-md);
  background: var(--brand-soft); color: var(--ink); font-size: 0.92rem;
}

/* ---------------- Buddies tab (app.js section 6c) ----------------
   Same full-screen layout as Settings (head + one scroller), without a Save
   bar: every button acts right away. Rows are big enough for thumbs. */
.buddies-body { padding-top: 6px; }
.buddies-guest { text-align: center; padding-bottom: 16px; }
.buddies-hero { margin: 4px 0 6px; font-size: 2.2rem; line-height: 1; }
.buddies-pitch { margin: 0 0 14px; color: var(--ink-soft); }
.buddy-search-box { padding-bottom: 10px; }
.buddy-search-field { margin-bottom: 4px; }
.buddy-search-status:empty { display: none; }
.buddy-section { margin: 0 0 12px; }
.buddy-list { list-style: none; margin: 0; padding: 0 16px; }
.buddy-search-box .buddy-list { padding: 0; }
.buddy-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  margin: 0 0 8px; padding: 6px 8px;
  border: 2px solid var(--sand); border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--edge);
}
.buddy-search-box .buddy-item { box-shadow: none; }
.buddy-main {
  display: flex; align-items: center; gap: 10px;
  flex: 1 1 180px; min-width: 0; min-height: 52px;
  padding: 2px 4px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: inherit; font: inherit; text-align: start;
  cursor: pointer;
}
.buddy-main.static { cursor: default; }
button.buddy-main:hover { background: var(--brand-soft); }
.buddy-avatar {
  width: 48px; height: 48px; flex: 0 0 48px;
  display: grid; place-items: center;
  border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #eef5e2 0 50%, #e0edcb 70%, #d3e5b8 100%);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(59, 42, 32, 0.2);
  font-size: 1.4rem;
}
.buddy-avatar svg { width: 44px; height: 44px; }
/* A buddy's owner photo: a small circle on the dog avatar's corner. */
.buddy-avatar-wrap { position: relative; flex: none; display: inline-flex; }
.owner-mini {
  position: absolute; inset-inline-end: -6px; bottom: -4px;
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; background: var(--sand);
  box-shadow: 0 1px 3px rgba(59, 42, 32, 0.3);
}
.buddy-text { display: flex; flex-direction: column; min-width: 0; }
.buddy-dog {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.buddy-user { color: var(--ink-soft); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buddy-status { flex: 1 1 100%; margin: 0; padding: 0 4px 2px; font-size: 0.88rem; }
.buddy-where { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.buddy-where.none, .buddy-where.walk { color: var(--ink-soft); }
.here-dot {
  width: 10px; height: 10px; flex: none; border-radius: 50%;
  background: var(--quiet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--quiet) 30%, transparent);
}
/* A park name inside a sentence: a link-style button, still a 44 px tap target. */
.link-btn.park-link { min-height: 44px; padding: 0; margin: -12px 0; font-weight: 600; }
.buddy-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.buddy-actions .primary-btn, .buddy-actions .secondary-btn, .buddy-actions .danger-btn {
  min-height: 44px; padding: 0 16px; font-size: 0.95rem;
}
.buddy-tag {
  padding: 4px 10px; border-radius: 999px;
  background: #e3f0dc; color: #3e6b2f;
  font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
.buddy-tag.waiting { background: var(--sand); color: var(--ink-soft); }
.buddy-empty { margin: 0 16px 10px; color: var(--ink-soft); font-size: 0.92rem; }
/* Buddy card (inside the dog profile dialog) */
.profile-emoji { font-size: 3.5rem; }
.profile-body .buddy-status { padding: 0; text-align: center; }
.profile-body .buddy-where { justify-content: center; }
.profile-body .buddy-remove { color: var(--brand-dark); }
.buddy-confirm {
  width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 2px solid var(--brand-soft); border-radius: var(--radius-md);
  background: #fff6f4;
}
.buddy-confirm p { margin: 0 0 10px; font-weight: 600; }
.buddy-confirm .buddy-actions { justify-content: center; margin: 0; }
.buddy-confirm .buddy-actions > * { flex: 1 1 120px; }
.danger-btn {
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--brand-dark); color: #fff;
  font-weight: 600;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

/* ---------------- Daily dog photo + feed (Buddies tab, app.js section 6h) ----------------
   One photo per day: a big "Today's photo" button (or a small preview of
   today's + "Replace"), then the feed as photo cards, newest first. */
.daily-me { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 10px; }
.daily-mine {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 2px solid var(--sand); border-radius: var(--radius-md);
  background: var(--paper);
}
.daily-mine-img { width: 56px; height: 56px; flex: none; border-radius: var(--radius-sm); object-fit: cover; background: var(--sand); }
.daily-mine-text { font-weight: 600; font-size: 0.92rem; }
.daily-btn { min-height: 48px; width: 100%; }
.daily-actions { margin-top: 2px; }
.daily-me .photo-error:empty { display: none; }
.daily-feed {
  list-style: none; margin: 0; padding: 2px 16px 8px;
  display: flex; gap: 12px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: 16px;
  scrollbar-width: thin;
}
.daily-feed:empty { display: none; }
.daily-item {
  flex: 0 0 min(64%, 240px);
  scroll-snap-align: start;
  overflow: hidden;
  border: 2px solid var(--sand); border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--edge);
}
.daily-item.mine { border-color: var(--brand-soft); }
.daily-who {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 10px; width: 100%;
  border-radius: 0;
}
.daily-who .buddy-tag { margin-inline-start: auto; }
.daily-avatar { width: 40px; height: 40px; flex: 0 0 40px; }
.daily-avatar svg { width: 36px; height: 36px; }
.daily-time { color: var(--ink-soft); font-size: 0.82rem; }
.daily-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--sand); }

/* ---------------- Explore tab (app.js section 6l) ----------------
   One feed of post cards. Accessibility rules for this block (and the header
   gear): every button is at least 44×44 px, text sizes are in rem so they
   follow the browser / phone font size (and zoom is never locked), focus is
   always visible (3 px ring), and icon-only buttons carry an aria-label.
   No new animations. */
.explore-body { padding-top: 8px; }
.explore-compose-bar { display: flex; justify-content: center; margin: 0 16px 12px; }
.explore-new-btn { min-height: 48px; padding: 0 22px; font-size: 1rem; }
.explore-composer {
  margin: 0 16px 14px; padding: 14px 16px;
  border: 2px solid var(--sand); border-radius: var(--radius); background: var(--paper); box-shadow: var(--edge);
}
.explore-composer .section-title { margin: 0 0 10px; }
.explore-text {
  display: block; width: 100%; margin-top: 10px; padding: 10px 12px;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.4; resize: vertical;
}
.explore-text:focus { outline: 3px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.explore-preview { position: relative; border-radius: var(--radius-md); overflow: hidden; background: var(--sand); }
.explore-preview img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.explore-preview-x {
  position: absolute; top: 8px; inset-inline-end: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(59, 42, 32, 0.7) !important; color: #fff !important;
}
.explore-compose-actions { margin-top: 8px; }
.explore-compose-actions > * { flex: 1 1 120px; min-height: 48px; }
.explore-feed { list-style: none; margin: 0; padding: 0 16px; display: grid; gap: 14px; }
.explore-feed:empty { display: none; }
.xp-card {
  border: 2px solid var(--sand); border-radius: var(--radius); background: var(--paper);
  box-shadow: var(--edge); overflow: hidden;
}
.xp-card.mine { border-color: var(--brand-soft); }
.xp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; }
.xp-avatar { width: 44px; height: 44px; flex: 0 0 44px; }
.xp-avatar svg, .xp-avatar .avatar-photo { width: 44px; height: 44px; border-radius: 50%; }
.xp-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xp-name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.xp-meta { color: var(--ink-soft); font-size: 0.85rem; }
.xp-head .buddy-tag { flex: none; }
/* Avatar + name + @user: one button that opens the dog card (section 6m) */
.xp-author {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 44px;
  margin: 0; padding: 2px 4px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.xp-author:hover .xp-name { text-decoration: underline; }
.xp-author:focus-visible, .xt-name:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.xp-photo { display: block; width: 100%; max-height: 70vh; object-fit: cover; background: var(--sand); }
.xp-text { margin: 10px 14px 0; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.xp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px 10px; }
.xp-bar > .buddy-confirm { flex: 1 1 100%; margin: 0; }
.xp-tool {
  margin-inline-start: auto;
  min-height: 44px; min-width: 44px; padding: 0 12px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft);
  font: inherit; font-size: 0.9rem; font-weight: 600;
}
.xp-tool:hover, .xp-tool:focus-visible { background: var(--sand); color: var(--brand-dark); }
/* Larger taps and a clear focus ring on the Explore controls */
.explore-body .primary-btn, .explore-body .secondary-btn, .explore-body .danger-btn,
.explore-body .link-btn, .explore-body .seg button { min-height: 44px; }
.explore-body .primary-btn:focus-visible, .explore-body .secondary-btn:focus-visible, .explore-body .danger-btn:focus-visible,
.explore-body .link-btn:focus-visible, .explore-body .seg button:focus-visible, .explore-preview-x:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}
.explore-composer .section-title:focus { outline: none; }
.explore-composer .section-title:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.xp-pd .pd-tag { font-size: 0.85rem; padding: 4px 10px; }
.xp-head .buddy-tag { font-size: 0.85rem; }
.news-strip:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; border-radius: var(--radius); }

/* Feed filters: the selected chip is solid red with white text */
.explore-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 16px 12px; }
.explore-filter {
  flex: 1 1 auto; min-height: 44px; padding: 0 14px;
  border: 2px solid var(--sand-dark); border-radius: 999px; background: var(--paper); color: var(--ink);
  font-family: var(--display); font-weight: 600; font-size: 0.95rem;
  box-shadow: 0 2px 0 var(--sand-dark);
}
.explore-filter:hover { border-color: var(--brand); }
.explore-filter[aria-pressed='true'] { background: var(--brand); border-color: var(--brand-dark); color: #fff; box-shadow: 0 2px 0 var(--brand-dark); }
.explore-filter:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.explore-guest-buddies {
  margin: 0 16px 14px; padding: 14px 16px; text-align: center;
  border: 2px solid var(--sand); border-radius: var(--radius); background: var(--paper);
}

/* Daily Bark News / הנביחון: a sideways strip of 5 small cards */
.news-box { margin: 0 0 14px; }
.news-title { margin: 0 16px 8px; display: flex; align-items: center; gap: 6px; }
.news-strip {
  list-style: none; margin: 0; padding: 2px 16px 8px;
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px; -webkit-overflow-scrolling: touch;
}
.news-strip:empty { display: none; }
.news-item { flex: 0 0 min(78%, 280px); scroll-snap-align: start; display: flex; }
.news-link {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px; min-height: 44px;
  border: 2px solid var(--sand); border-radius: var(--radius); background: var(--paper);
  box-shadow: var(--edge); color: var(--ink); text-decoration: none;
}
.news-item.article .news-link { border-color: var(--brand-soft); }
a.news-link:hover { border-color: var(--brand); }
a.news-link:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.news-kind { font-size: 0.8rem; font-weight: 700; color: var(--brand-dark); }
.news-item-title { font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.25; }
.news-text { font-size: 0.92rem; line-height: 1.45; }
.news-source { margin-top: auto; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.news-item.article .news-source { color: var(--brand-dark); text-decoration: underline; }
.news-empty { margin: 0 16px; }

/* Playdate posts: a tweet-style box with the garden, the time and Join */
.explore-kind { margin-bottom: 12px; }
.explore-kind button { flex: 1 1 0; }
.explore-pd-part .field { margin-bottom: 10px; }
.xp-pd {
  margin: 10px 14px 0; padding: 10px 12px;
  border: 2px dashed var(--sand-dark); border-radius: var(--radius-md); background: var(--cream);
}
.xp-pd p { margin: 0 0 6px; font-size: 1rem; }
.xp-pd .pd-day { font-weight: 700; }
.xp-pd-where .link-btn { font-size: 1rem; }
.xp-pd-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.xp-pd-going { color: var(--ink-soft); font-size: 0.9rem; font-weight: 600; }
.xp-join { min-height: 44px; min-width: 96px; padding: 0 20px; font-size: 1rem; }
.xp-going { background: #e3f1da; color: #2f5a22; }
/* 🦴 bones and 🍪 treats */
.xp-react {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 64px; padding: 0 14px;
  border: 2px solid var(--sand-dark); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: inherit; font-size: 1rem; font-weight: 700;
}
.xp-react:hover { border-color: var(--brand); }
.xp-react:focus-visible, .xp-tool:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.xp-react[aria-pressed='true'], .xp-react[aria-expanded='true'] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.xp-react > span[aria-hidden] { font-size: 1.15rem; line-height: 1; }
.xp-react .xp-count { font-size: 0.95rem; }
.xp-thread { margin: 0 10px 12px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--cream); border: 2px solid var(--sand); }
.xt-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.xt-item { display: flex; gap: 8px; align-items: flex-start; }
.xt-avatar { width: 32px; height: 32px; flex: 0 0 32px; }
.xt-avatar svg, .xt-avatar .avatar-photo { width: 32px; height: 32px; border-radius: 50%; }
.xt-main { min-width: 0; flex: 1; }
.xt-who { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.xt-name { font-weight: 700; color: var(--ink); }
/* Treat author: the name is a button with a 44 px tap area that doesn't grow the line */
button.xt-name {
  display: inline-block; margin: -12px -4px; padding: 12px 4px; border: 0; border-radius: var(--radius-sm);
  background: transparent; font: inherit; font-weight: 700; cursor: pointer;
}
button.xt-name:hover { text-decoration: underline; }
button.xt-author { padding: 0; border: 0; cursor: pointer; font: inherit; }
.xt-text { margin: 2px 0 0; font-size: 0.98rem; line-height: 1.4; overflow-wrap: anywhere; }
.xt-main .buddy-confirm { margin: 6px 0 0; }
.xp-tool.small { margin: 2px 0 0; min-height: 44px; padding: 0 8px; font-size: 0.85rem; }
.xt-empty { margin: 0 0 8px; }
.xt-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.xt-input {
  flex: 1 1 180px; min-height: 44px; padding: 10px 12px;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-sm); background: #fff;
  font: inherit; font-size: 1rem; line-height: 1.3; resize: vertical; color: var(--ink);
}
.xt-input:focus { outline: 3px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.xt-send { min-height: 44px; padding: 0 18px; }
.xt-error { flex: 1 1 100%; margin: 0; }
.xt-error:empty { display: none; }
.xt-login { width: 100%; min-height: 44px; }
.explore-empty { margin: 16px; }
.explore-more { display: block; margin: 14px auto 18px; min-height: 48px; }

/* ---------------- Playdates (Buddies tab + "New playdate" dialog, app.js section 6e) ----------------
   Cards in the Buddies tab scroller; the dialog is a full screen on phones
   (one scroller + a sticky Send bar above the home bar), a card on desktop. */
.pd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pd-head .section-title { margin: 0; }
.pd-new-btn { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
.pd-list { list-style: none; margin: 0; padding: 0 16px; }
.pd-card {
  margin: 0 0 10px; padding: 10px 14px 12px;
  border: 2px solid var(--sand); border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--edge);
}
.pd-card.state-now { border-color: var(--quiet); }
.pd-card.state-cancelled, .pd-card.state-past { background: var(--cream); box-shadow: none; }
.pd-card.state-cancelled .pd-when, .pd-card.state-cancelled .pd-where { text-decoration: line-through; text-decoration-color: rgba(59, 42, 32, 0.45); }
.pd-card.state-cancelled .pd-guests, .pd-card.state-past .pd-guests { opacity: 0.7; }
.pd-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pd-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0; font-family: var(--display); }
.pd-day { font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); }
.pd-time { font-size: 1.05rem; font-weight: 600; }
.pd-tag {
  flex: none; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
  background: var(--sand); color: var(--ink-soft);
}
.pd-tag.now { background: #e3f0dc; color: #3e6b2f; }
.pd-tag.invited { background: var(--brand-soft); color: var(--brand-dark); }
.pd-tag.cancelled { background: #f3d9d4; color: var(--brand-dark); }
.pd-where { margin: 6px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.pd-city { color: var(--ink-soft); font-weight: 500; }
.pd-host { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.pd-host-dog { font-weight: 600; color: var(--ink); }
.pd-note {
  margin: 8px 0 0; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--sand); font-size: 0.92rem; overflow-wrap: anywhere;
}
.pd-counts { margin: 8px 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.pd-count.yes { color: #3e6b2f; font-weight: 700; }
.pd-guests { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; }
.pd-guest {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 2px 10px 2px 2px; border-radius: 999px;
  background: var(--cream); border: 1px solid var(--sand-dark);
  font-size: 0.85rem;
}
[dir='rtl'] .pd-guest { padding: 2px 2px 2px 10px; }
.pd-guest-avatar {
  position: relative; width: 32px; height: 32px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #eef5e2 0 50%, #e0edcb 70%, #d3e5b8 100%);
}
.pd-guest-avatar svg, .pd-guest-avatar .avatar-photo { width: 30px; height: 30px; border-radius: 50%; }
.pd-guest-avatar > span[aria-hidden] { font-size: 1rem; }
.pd-guest-mark {
  position: absolute; inset-inline-end: -4px; bottom: -3px;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 0.68rem; font-weight: 800; line-height: 1;
  background: var(--sand-dark); color: var(--ink); border: 2px solid #fff;
}
.pd-guest.status-yes .pd-guest-mark { background: #4f9a46; color: #fff; }
.pd-guest.status-maybe .pd-guest-mark { background: var(--busy); color: #fff; }
.pd-guest.status-no { opacity: 0.6; }
.pd-guest.status-no .pd-guest-mark { background: var(--ink-soft); color: #fff; }
.pd-guest-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pd-rsvp-box { margin-top: 10px; }
.pd-rsvp-q { margin: 0 0 6px; font-weight: 700; font-size: 0.92rem; }
.pd-rsvp { flex-wrap: nowrap; }
.pd-rsvp button { flex: 1 1 0; min-width: 0; padding: 0 8px; min-height: 46px; }
.pd-rsvp button[data-status='yes'][aria-pressed='true'] { border-color: #4f9a46; background: #e3f0dc; color: #2f5a22; box-shadow: 0 2px 0 #4f9a46; }
.pd-card .pd-cancel { width: 100%; margin-top: 10px; color: var(--brand-dark); }
.pd-card .pd-confirm { margin-top: 10px; }
.pd-past { margin: 4px 16px 0; }
.pd-past > summary {
  min-height: 44px; display: flex; align-items: center; gap: 6px;
  font-weight: 700; color: var(--ink-soft); cursor: pointer;
  list-style: none;
}
.pd-past > summary::-webkit-details-marker { display: none; }
.pd-past > summary::before { content: '▸'; display: inline-block; transition: transform 0.15s ease; }
[dir='rtl'] .pd-past > summary::before { content: '◂'; }
.pd-past[open] > summary::before { transform: rotate(90deg); }
[dir='rtl'] .pd-past[open] > summary::before { transform: rotate(-90deg); }
.pd-past .pd-list { padding: 0; }
.pd-flash { animation: pd-flash 1.4s var(--ease-out); }
/* Buddy card button + park popup link */
.profile-body .pd-invite-btn { width: 100%; margin-top: 4px; min-height: 46px; font-size: 1rem; }
.pd-invite-link { width: 100%; margin-top: 2px; font-size: 0.92rem; }
/* The dialog's fields */
.pd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.pd-row > .field { min-width: 0; }
.field select, .field input[type='date'], .field input[type='time'], .field textarea {
  width: 100%; min-width: 0;
  min-height: 50px; padding: 0 12px;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-md);
  background: var(--paper);
  font-size: 1rem; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.field select {
  padding-inline-end: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
  text-overflow: ellipsis;
}
[dir='rtl'] .field select { background-position: 12px 50%, 18px 50%; }
.field textarea { padding: 12px; min-height: 76px; resize: vertical; line-height: 1.4; }
.field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.15); }
.pd-durations { flex-wrap: nowrap; }
.pd-durations button { flex: 1 1 0; min-width: 0; padding: 0 4px; font-size: 0.95rem; white-space: nowrap; }
.pd-pick-list {
  list-style: none; margin: 0; padding: 0;
  border: 2px solid var(--sand-dark); border-radius: var(--radius-md);
  background: var(--paper); overflow: hidden;
}
.pd-pick-list:empty { display: none; }
.pd-pick-list li + li { border-top: 1px solid var(--sand); }
.pd-pick { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 4px 12px; cursor: pointer; }
.pd-pick input { width: 24px; height: 24px; flex: none; accent-color: var(--brand); }
.pd-pick .buddy-avatar { width: 40px; height: 40px; flex-basis: 40px; }
.pd-pick .buddy-avatar svg { width: 36px; height: 36px; }
.pd-pick:has(input:checked) { background: var(--brand-soft); }
.pd-note-count { text-align: end; }
.playdate-sheet > .sheet-form { flex: 1 1 auto; height: auto; }
.playdate-sheet .designer-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.playdate-sheet .designer-actions .primary-btn { flex: none; }
@media (min-width: 820px) {
  .sheet.picker.playdate-sheet { width: min(100vw, 540px); }
}

/* Small phones */
@media (max-width: 480px) {
  .brand-logo { width: 34px; height: 34px; flex-basis: 34px; border-radius: 9px; }
  .fab { font-size: 1rem; }
}

/* ---------------- Desktop ---------------- */
@media (min-width: 820px) {
  :root { --header-h: 70px; }
  .only-mobile { display: none !important; }
  .brand h1 { font-size: 1.7rem; }
  .subtitle { font-size: 0.85rem; }

  .sidebar {
    position: relative;
    transform: none !important;
    width: 360px;
    flex: 0 0 360px;
    box-shadow: 2px 0 0 var(--sand-dark);
    border-radius: 0;
    z-index: 1;
  }
  [dir='rtl'] .sidebar { box-shadow: -2px 0 0 var(--sand-dark); border-radius: 0; }

  .sheet { margin: auto; border-radius: 28px; max-height: 92dvh; }
  /* Desktop: dialogs are centered cards that grow with their content. */
  .sheet.lang-sheet, .sheet.picker { width: min(100vw, 480px); height: auto; max-height: 92dvh; margin: auto; border-radius: 28px; }
  .sheet.lang-sheet .lang-screen { height: auto; }
  /* Desktop: tab screens are a centered card on the sand background. */
  .screen { background-color: var(--sand); padding: 20px; align-items: center; }
  .screen > .sheet-form {
    width: min(100%, 860px);
    background-color: var(--cream);
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .screen.owner > .sheet-form, .screen.buddies > .sheet-form, .screen.explore > .sheet-form { width: min(100%, 560px); }
  .screen .designer-actions { padding-bottom: 14px; }
  .designer-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas:
      'intro intro'
      'preview fields'
      'badges fields'
      'links fields';
    align-items: start;
  }
  .badge-box { grid-area: badges; padding: 0 16px 16px; }
  .my-links { grid-area: links; padding: 0 16px 16px; }
  .designer-intro { grid-area: intro; }
  .preview-card { grid-area: preview; justify-content: flex-start; padding-top: 20px; }
  .preview, .preview svg { width: 220px; height: 220px; }
  .fields { grid-area: fields; }
}


/* ---------------- Dog profile card ----------------
   A small centered card on every screen size (not full-screen): it fits a
   390×844 phone with room to spare and stays clear of the notch, home bar and
   Safari toolbar. Only the body scrolls if the screen is very short. */
.sheet.profile-sheet {
  width: min(calc(100vw - 24px), 400px);
  max-height: calc(min(100dvh, var(--vv-h, 100dvh)) - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin: auto;
  border-radius: var(--radius);
  overflow: hidden;
}
.sheet.profile-sheet[open] { display: flex; flex-direction: column; }
.profile-card { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.profile-card .designer-head { flex: none; }
.profile-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 4px 20px 12px;
  text-align: center;
}
.profile-avatar {
  width: 140px; height: 140px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #eef5e2 0 50%, #e0edcb 70%, #d3e5b8 100%);
  border: 4px solid #fff;
  box-shadow: var(--shadow-sm);
}
.profile-avatar svg, .profile-avatar .avatar-photo { width: 132px; height: 132px; }
/* Buddy card: the owner's photo (buddies only) sits beside the dog, overlapping a little. */
.profile-avatar-row { display: flex; align-items: flex-end; justify-content: center; }
.profile-owner {
  margin: 0 0 0 -22px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
[dir='rtl'] .profile-owner { margin: 0 -22px 0 0; }
.profile-owner-img {
  width: 68px; height: 68px; border-radius: 50%; object-fit: cover;
  border: 4px solid #fff; background: var(--sand);
  box-shadow: 0 3px 8px rgba(59, 42, 32, 0.25);
}
.profile-owner figcaption {
  padding: 1px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 0.75rem; font-weight: 700;
}
.profile-name {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  margin: 4px 0 0;
  font-family: var(--display); font-size: 1.6rem; font-weight: 700; line-height: 1.2;
  overflow-wrap: anywhere;
}
.profile-facts {
  width: 100%;
  margin: 4px 0 0;
  border-radius: var(--radius-md);
  background: var(--paper);
  border: 2px solid var(--sand);
  overflow: hidden;
}
.profile-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.profile-row + .profile-row { border-top: 1px solid var(--sand); }
.profile-row dt { color: var(--ink-soft); font-size: 0.9rem; }
.profile-row dd { margin: 0; font-weight: 600; text-align: end; overflow-wrap: anywhere; }
.profile-meta { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.85rem; }
.profile-body .secondary-btn { width: 100%; margin-top: 4px; }
.profile-own-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 4px; }
.profile-own-actions .primary-btn { width: 100%; }
/* Add buddy / Requested / Accept + Decline / Buddies ✓ on a map dog's card */
/* Dog card (Explore author, section 6m): the small card, same frame as the profile */
.dog-card-avatar { width: 108px; height: 108px; }
.dog-card-avatar svg, .dog-card-avatar .avatar-photo { width: 100px; height: 100px; }
.dog-card-user { margin: -4px 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.dog-card-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 6px; }
.dog-card-actions > .secondary-btn { min-height: 48px; margin-top: 0; }
.dog-card-actions .profile-buddy { margin-top: 0; }
.profile-buddy { display: flex; gap: 8px; width: 100%; margin-top: 4px; justify-content: center; }
.profile-buddy .primary-btn, .profile-buddy .secondary-btn { flex: 1; width: auto; margin-top: 0; min-height: 48px; }
.profile-buddy .secondary-btn:disabled { opacity: 0.7; cursor: default; }
.profile-buddy .buddy-tag { font-size: 0.95rem; padding: 10px 18px; }
.profile-actions { flex: none; padding: 8px 20px 16px; }
.profile-actions .primary-btn { width: 100%; }

/* ---------------- Social links (social.js) ----------------
   The owner's optional Instagram / Facebook, as pills that open in a new tab.
   Only on your own card / My Dog tab and on buddies' cards. */
.social-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 10px 0 0; padding: 0; list-style: none;
}
.social-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; max-width: 100%;
  padding: 6px 14px;
  background: #fff;
  border: 2px solid var(--sand);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-family: var(--display); font-size: 0.9rem; font-weight: 600;
  text-decoration: none;
}
.social-link svg { flex: none; }
.social-link.instagram svg { color: #c13584; }
.social-link.facebook svg { color: #1877f2; }
.social-link:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.social-handle {
  font-family: var(--body); font-weight: 400; font-size: 0.82rem; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px;
}
.my-links {
  max-width: 452px;
  margin: 12px auto 4px;
  padding: 0 16px;
}
.my-links[hidden] { display: none; }
.my-links .social-links { justify-content: flex-start; margin: 6px 0 8px; }
.my-links-edit { margin: 4px 0 8px; font-size: 0.9rem; color: var(--ink-soft); }

/* ---------------- Badges (badges.js) ----------------
   Small storybook stickers, not a trophy wall. */
.profile-badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  margin: 2px 0 0; padding: 0; list-style: none;
}
.badge-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 6px;
  background: #fff8e6;
  border: 2px solid #f0d58c;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-family: var(--display); font-size: 0.85rem; font-weight: 600;
  transform: rotate(-1.5deg);
}
.badge-chip:nth-child(even) { transform: rotate(1.5deg); }
.badge-chip .badge-icon { font-size: 1rem; line-height: 1; }

.badge-box {
  max-width: 452px;
  margin: 12px auto 4px;
  padding: 0 16px;
}
.badge-box[hidden] { display: none; }
.badge-grid { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; }
.badge-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 2px solid var(--sand);
  border-radius: var(--radius-md);
}
.badge-tile .badge-icon {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff8e6;
  border: 2px solid #f0d58c;
  font-size: 1.3rem;
}
.badge-text { display: flex; flex-direction: column; min-width: 0; }
.badge-tile .badge-name { font-family: var(--display); font-weight: 600; }
.badge-desc { font-size: 0.82rem; color: var(--ink-soft); }
.badge-lock { font-family: var(--body); font-weight: 400; font-size: 0.8rem; color: var(--ink-soft); }
.badge-tile.earned { border-color: #f0d58c; box-shadow: var(--shadow-sm); }
.badge-tile.locked { background: var(--paper); border-style: dashed; }
.badge-tile.locked .badge-icon { filter: grayscale(1); opacity: 0.45; background: var(--sand); border-color: var(--sand-dark); }
.badge-tile.locked .badge-name { color: var(--ink-soft); }

/* ---------------- Real dog photo as the avatar ---------------- */
/* Fills whatever round avatar box it's in (header, FAB, mini list, map pin). */
.avatar-photo {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-fallback { display: contents; }

.photo-box {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; max-width: 320px;
  margin-top: 8px; padding: 10px 12px;
  background: #fff;
  border: 2px dashed var(--sand-dark);
  border-radius: 20px;
  text-align: center;
}
/* Kept small on purpose: a big photo would push name/breed off the screen. */
.photo-preview {
  width: 72px; height: 72px; flex: none;
  border-radius: 50%;
  border: 4px solid var(--brand);
  box-shadow: 0 3px 8px rgba(59, 42, 32, 0.25);
  overflow: hidden;
  background: var(--sand);
}
.photo-title { margin: 0; font-weight: 600; }
/* Settings → About you: the owner's own photo (round, like the dog photo). */
.owner-photo-box {
  max-width: none; margin: 0 0 12px;
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; row-gap: 6px;
  text-align: start;
}
.owner-photo-box .owner-photo-preview { grid-row: span 2; }
.owner-photo-box .photo-actions { justify-content: flex-start; gap: 6px; }
.owner-photo-box .photo-btn { padding: 0 12px; font-size: 0.85rem; }
.owner-photo-box .photo-error { grid-column: 1 / -1; }
.owner-photo-preview {
  width: 72px; height: 72px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%; overflow: hidden;
  border: 4px solid var(--brand);
  box-shadow: 0 3px 8px rgba(59, 42, 32, 0.25);
  background: var(--sand);
}
.owner-photo-preview .avatar-photo { width: 64px; height: 64px; object-fit: cover; }
.owner-photo-empty { font-size: 2.2rem; line-height: 1; }
.owner-photo-box .photo-error:empty { display: none; }
.photo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.photo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--sand-dark); border-radius: 999px;
  background: var(--cream);
  font: inherit; font-weight: 600; font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--sand-dark);
}
.photo-btn:hover { border-color: var(--brand); }
.photo-btn:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }
.photo-remove { background: #fff; color: var(--brand); }
.photo-error { flex: none; min-height: 0; }
.photo-error.working { color: var(--ink-soft); }

/* ---------------- Motion ----------------
   Small, quick animations. All of them are switched off for people who ask
   for reduced motion (see the block right after the keyframes). */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-in {
  from { opacity: 0.4; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes sheet-up {
  from { transform: translateY(24px); }
  to   { transform: none; }
}
/* These two keep the translateX(-50%) centering the elements already use */
@keyframes chip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.94); }
  to   { opacity: 1; transform: translateX(-50%); }
}
@keyframes pd-flash {
  0%   { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.5), var(--edge); }
  40%  { box-shadow: 0 0 0 8px rgba(198, 40, 40, 0.2), var(--edge); }
  100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0), var(--edge); }
}
@keyframes me-pulse {
  0%   { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.9); opacity: 0; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo, .pet-marker.mine .pet-marker-inner, .park-pin, .park-pin::before, .cluster-pin, .cluster-pin::before,
  .park-list .empty::before, .breed-list .breed-empty::before,
  .leaflet-popup-content-wrapper, .status-chip, .toast:not([hidden]), .reminder:not([hidden]),
  .sheet[open], .lang-logo, .screen, .pd-flash, .lost-banner, .tour-dog-me,
  .sticker-dog, .sticker-fx, .sticker-fx * {
    animation: none !important;
  }
  .me-pulse { display: none; }
  .primary-btn, .secondary-btn, .danger-btn, .icon-btn, .nav-btn, .round-btn,
  .seg button, .tiles button, .photo-btn, .lang-choice, .swatch, .fab,
  .park-item, .park-pin, .sidebar, .leaflet-container a.dir-btn, .city-btn, .city-item, .star, .chip {
    transition-duration: 0.01s !important;
  }
  .primary-btn:active, .secondary-btn:active, .danger-btn:active, .icon-btn:active, .nav-btn:active,
  .seg button:active, .tiles button:active, .photo-btn:active, .lang-choice:active,
  .round-btn:active, .swatch:active, .park-item:active, .park-item:hover, .city-btn:active, .city-item:active, .chip:active,
  .leaflet-container a.dir-btn:active, .star:active { transform: none; }
  .fab:active { transform: translateX(-50%); }
}

/* ---------------- Buddy chat (app.js section 6i) ----------------
   Full screen on phones (a .sheet.picker), a 560 px card on desktop.
   [head] [messages: the only scroller] [stickers?] [composer above the safe area] */
.buddy-row-top { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; min-width: 0; }
.chat-open-btn {
  position: relative; flex: none;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: 2px solid var(--sand); border-radius: 50%;
  background: var(--cream); font-size: 1.4rem; cursor: pointer;
  box-shadow: var(--edge);
}
.chat-open-btn:hover { background: var(--brand-soft); }
.chat-open-btn.has-unread { border-color: var(--brand); background: var(--brand-soft); }
.chat-unread {
  position: absolute; top: -4px; inset-inline-end: -4px;
  min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 999px; border: 2px solid var(--paper);
  background: var(--brand); color: #fff;
  font-size: 0.75rem; font-weight: 700; line-height: 18px; text-align: center;
}
.buddy-actions .chat-locked { opacity: 0.6; cursor: not-allowed; }
.profile-body .chat-card-btn { width: 100%; }

.sheet.chat-sheet[open] { display: flex; flex-direction: column; }
/* Phones: pin the open chat to the *visual* viewport (--vv-top / --vv-h from
   syncViewportHeight in app.js). On iOS the keyboard shrinks and pans the
   visual viewport, not the layout one, so top:0 + 100dvh would put the head
   under the notch and the composer under the keyboard. No transition on
   purpose: the sheet follows the keyboard without a jumping animation. */
@media (max-width: 819px) {
  .sheet.chat-sheet {
    top: var(--vv-top, 0px); bottom: auto;
    height: var(--vv-h, 100dvh);
    max-height: var(--vv-h, 100dvh);
  }
  /* The keyboard covers the home indicator, so no safe-area gap under the composer. */
  .kb-open .chat-composer { padding-bottom: 8px; }
  .kb-open .chat-stickers { max-height: calc(var(--vv-h, 100dvh) * 0.4); }
}
.chat { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; height: 100%; }
.chat-head {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: var(--brand); color: #fff;
  box-shadow: var(--shadow-sm);
}
.chat-back { color: #fff; font-size: 2rem; line-height: 1; background: transparent; }
[dir='rtl'] .chat-back span { display: inline-block; transform: scaleX(-1); }
.chat-who {
  display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto;
  min-height: 52px; padding: 2px 6px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.chat-who .buddy-user { color: rgba(255, 255, 255, 0.85); }
.chat-who-avatar { width: 44px; height: 44px; flex-basis: 44px; }
.chat-who-avatar svg { width: 40px; height: 40px; }
.chat-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 12px 6px;
  background:
    radial-gradient(circle at 20% 10%, rgba(167, 201, 138, 0.18), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(198, 40, 40, 0.06), transparent 45%),
    var(--sand);
  display: flex; flex-direction: column;
}
.chat-earlier { align-self: center; }
.chat-list { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-empty { text-align: center; margin: auto; font-size: 1.05rem; }
.chat-day { align-self: center; margin: 6px 0; }
.chat-day span {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 253, 248, 0.9); color: var(--ink-soft); font-size: 0.78rem; font-weight: 600;
}
.chat-msg { display: flex; }
.chat-msg.mine { justify-content: flex-end; }
.bubble {
  position: relative;
  max-width: min(78%, 420px);
  padding: 7px 10px 5px;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 1px 1.5px rgba(59, 42, 32, 0.18);
  display: flex; flex-direction: column;
}
.chat-msg.theirs .bubble { border-end-start-radius: 6px; }
.chat-msg.mine .bubble { background: var(--brand-soft); border-end-end-radius: 6px; }
.bubble-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.38; }
.bubble-time { align-self: flex-end; margin-top: 2px; font-size: 0.7rem; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; }
/* Read ticks (my messages): ✓ sent, ✓✓ read (brand red). Always left-to-right glyphs. */
.ticks { direction: ltr; font-size: 0.78rem; font-weight: 700; letter-spacing: -0.28em; padding-inline-end: 0.28em; color: var(--ink-soft); line-height: 1; }
.ticks.read { color: var(--brand); }
.chat-msg.kind-sticker .bubble-time { padding: 0 6px; }
.chat-msg.kind-sticker .bubble { background: transparent; box-shadow: none; padding: 0; }
.chat-msg.kind-photo .bubble { padding: 4px 4px 3px; }
.chat-photo { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.chat-photo img { display: block; max-width: 100%; width: 240px; max-height: 320px; object-fit: cover; border-radius: 14px; background: var(--sand-dark); }
.chat-sticker { line-height: 0; }
.chat-error { flex: none; margin: 0; padding: 0 14px; background: var(--cream); }
.chat-error:empty { display: none; }
.chat-composer {
  flex: none;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px calc(10px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
  background: var(--cream);
  border-top: 2px solid var(--sand);
}
.chat-tool {
  flex: none; width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--paper); font-size: 1.35rem; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--sand);
  overflow: hidden;
}
.chat-tool[aria-expanded='true'] { box-shadow: inset 0 0 0 2px var(--brand); background: var(--brand-soft); }
.chat-tool-dog { display: grid; place-items: center; line-height: 0; }
.chat-tool-dog svg, .chat-tool-dog img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.chat-input {
  flex: 1 1 auto; min-width: 0;
  min-height: 46px; max-height: 120px;
  padding: 11px 14px;
  border: 2px solid var(--sand); border-radius: 23px;
  background: #fff; color: var(--ink);
  /* 16px exactly: iOS Safari zooms the page into any field under 16px. */
  font: inherit; font-size: 16px; line-height: 1.3;
  resize: none;
}
.chat-input:focus { outline: none; border-color: var(--brand); }
.chat-send {
  flex: none; width: 46px; height: 46px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer;
  box-shadow: inset 0 -3px 0 var(--brand-dark);
}
.chat-send svg { width: 22px; height: 22px; }
[dir='rtl'] .chat-send svg { transform: scaleX(-1); }
.chat-send:disabled { opacity: 0.6; }
.chat-stickers {
  flex: none;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  max-height: 46vh; overflow-y: auto;
  padding: 10px 10px 4px;
  background: var(--cream);
  border-top: 2px solid var(--sand);
}
.sticker-pick {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px 6px;
  border: 2px solid transparent; border-radius: var(--radius-md);
  background: var(--paper); cursor: pointer; font: inherit;
}
.sticker-pick:hover, .sticker-pick:focus-visible { border-color: var(--brand); }
.sticker-pick .sticker { width: 72px; height: 72px; }
.sticker-pick-name { font-size: 0.78rem; font-weight: 600; color: var(--ink); }
@media (min-width: 820px) {
  .sheet.chat-sheet { width: min(100vw, 560px); height: min(760px, 92dvh); margin: auto; border-radius: 28px; overflow: hidden; }
}

/* ---------------- Safety: block / report (app.js section 6j) ----------------
   Small, quiet buttons at the bottom of a buddy card and in the chat's ⋮ panel. */
.safety-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.safety-btn {
  min-height: 44px; padding: 8px 14px;
  border: 2px solid var(--sand); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer;
}
.safety-btn:hover, .safety-btn:focus-visible { border-color: var(--brand); color: var(--brand-dark); }
.safety-confirm { margin-top: 10px; }
.chat-more-btn { color: #fff; font-size: 1.6rem; line-height: 1; background: transparent; flex: none; }
.chat-more {
  flex: none;
  padding: 8px 12px 12px;
  background: var(--cream);
  border-bottom: 2px solid var(--sand);
}
.chat-more .safety-row { margin-top: 0; }
.chat-more .buddy-confirm { margin-top: 0; }
.blocks-list { padding: 0; }
.block-item .buddy-row-top { justify-content: space-between; }
.block-item .buddy-main { cursor: default; }
.report-form { text-align: start; }
.report-form > p { text-align: center; }
.report-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.report-reason {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 6px 10px;
  border: 2px solid var(--sand); border-radius: var(--radius-sm);
  background: var(--paper); cursor: pointer; font-weight: 600; font-size: 0.92rem;
}
.report-reason:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.report-reason input { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
.report-body {
  width: 100%; min-height: 56px; padding: 10px 12px;
  border: 2px solid var(--sand); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; resize: vertical;
}
.report-body:focus { outline: none; border-color: var(--brand); }
.report-error:empty { display: none; }
.chat-more .report-form .buddy-actions { margin-top: 8px; }
.chat-msg.theirs { flex-direction: column; align-items: flex-start; }
.chat-msg.theirs .bubble { cursor: pointer; }
.msg-report {
  margin-top: 4px; min-height: 36px; padding: 4px 12px;
  border: 2px solid var(--brand-soft); border-radius: 999px;
  background: var(--paper); color: var(--brand-dark);
  font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
}

/* ---------------- Recovery code (app.js section 6b) ----------------
   A small centered card everywhere; the code itself big, Latin, easy to copy. */
.sheet.recovery-sheet {
  width: min(92vw, 400px); max-height: min(92dvh, var(--vv-h, 92dvh));
  margin: auto; padding: 22px 20px 18px;
  border-radius: var(--radius); text-align: center;
}
.recovery-sheet h2 { margin: 0 0 12px; font-family: var(--display); font-size: 1.3rem; }
.recovery-code {
  margin: 0 0 16px; padding: 14px 10px;
  border: 2px dashed var(--brand); border-radius: var(--radius-md);
  background: var(--brand-soft);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 1.45rem; font-weight: 700; letter-spacing: 0.06em; color: var(--ink);
  user-select: all; -webkit-user-select: all;
}
.recovery-actions { display: flex; gap: 10px; }
.recovery-actions > * { flex: 1 1 0; }
.account-forgot { align-self: flex-start; margin-top: 2px; }
.recovery-input { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.05em; text-transform: uppercase; }
.recovery-rotate { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.recovery-rotate .form-error:empty { display: none; }

/* ---------------- Group chats (app.js section 6k) ----------------
   Same chat screen as 1:1; a 👥 circle (or the group picture), sender names
   on their bubbles, and the group info in the ⋮ panel. */
.group-new-btn { min-height: 44px; padding: 6px 14px; font-size: 0.92rem; }
.group-avatar {
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: var(--brand-soft); font-size: 1.35rem; line-height: 1;
  box-shadow: inset 0 0 0 2px var(--sand);
}
.group-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.group-avatar.in-head { width: 40px; height: 40px; background: var(--cream); }
.group-item .buddy-user { direction: inherit; }
.bubble-who { font-size: 0.78rem; font-weight: 700; color: var(--brand-dark); margin-bottom: 1px; }
.chat-msg.kind-sticker .bubble-who { padding: 0 6px; }
.group-info-title { margin: 0 0 6px; font-weight: 700; }
.group-members { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 32vh; overflow-y: auto; }
.group-member { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.group-member .buddy-avatar { width: 32px; height: 32px; flex-basis: 32px; }
.group-member .buddy-avatar svg { width: 30px; height: 30px; }
.group-member .buddy-tag { margin-inline-start: auto; }
.group-add-list { margin-bottom: 8px; max-height: 30vh; overflow-y: auto; }
.group-info .safety-row { justify-content: flex-start; }
.group-info .safety-btn { display: inline-flex; align-items: center; gap: 6px; }
.group-info-error:empty { display: none; }
.group-photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-photo-preview { width: 64px; height: 64px; font-size: 1.8rem; }
.group-photo-field .photo-error:empty { display: none; }

/* ---------------- Chat stickers (stickers.js) ----------------
   The sender's dog (cartoon or photo in a circle) + an action overlay.
   Transform/opacity animations only; all listed in the reduced-motion block. */
.sticker { position: relative; display: inline-block; width: 120px; height: 120px; line-height: 0; }
.sticker-dog {
  position: absolute; inset: 12%;
  display: grid; place-items: center;
  transform-origin: 50% 100%;
}
.sticker-dog svg { width: 100%; height: 100%; }
.sticker-dog .avatar-photo {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(59, 42, 32, 0.25);
}
.sticker-fx { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sticker-fx * { transform-box: fill-box; transform-origin: center; }

.sticker-poop .sticker-dog { animation: st-squat 1.4s ease-in-out infinite; }
.sticker-poop .fx-stink { animation: st-rise 1.6s ease-in-out infinite; }
.sticker-jump .sticker-dog { animation: st-jump 0.9s cubic-bezier(0.3, 0, 0.3, 1) infinite; }
.sticker-jump .fx-shadow { animation: st-shadow 0.9s cubic-bezier(0.3, 0, 0.3, 1) infinite; }
.sticker-lick .fx-tongue { animation: st-lick 0.8s ease-in-out infinite; transform-origin: 50% 0; }
.sticker-lick .fx-drops { animation: st-rise 1.2s ease-out infinite; }
.sticker-love .sticker-dog { animation: st-sway 2s ease-in-out infinite; }
.sticker-love .fx-hearts path { animation: st-heart 2.2s ease-in infinite; }
.sticker-love .fx-hearts .h2 { animation-delay: 0.5s; }
.sticker-love .fx-hearts .h3 { animation-delay: 1s; }
.sticker-love .fx-hearts .h4 { animation-delay: 1.5s; }
.sticker-sleep .sticker-dog { animation: st-breathe 3s ease-in-out infinite; }
.sticker-sleep .fx-z path { animation: st-z 2.4s ease-in-out infinite; }
.sticker-sleep .fx-z .z2 { animation-delay: 0.6s; }
.sticker-sleep .fx-z .z3 { animation-delay: 1.2s; }
.sticker-zoomies .sticker-dog { animation: st-zoom 0.7s ease-in-out infinite; }
.sticker-zoomies .fx-speed, .sticker-zoomies .fx-dust { animation: st-puff 0.7s ease-out infinite; }
.sticker-beg .sticker-dog { animation: st-tilt 1.6s ease-in-out infinite; }
.sticker-beg .fx-bubble { animation: st-bob 1.6s ease-in-out infinite; }
.fx-sparks { animation: st-twinkle 1.4s ease-in-out infinite; }

@keyframes st-squat { 0%, 100% { transform: none; } 50% { transform: scale(1.06, 0.9); } }
@keyframes st-rise { 0% { transform: translateY(4px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }
@keyframes st-jump { 0%, 100% { transform: translateY(0) scale(1.05, 0.95); } 15% { transform: translateY(0); } 50% { transform: translateY(-18%); } }
@keyframes st-shadow { 0%, 100% { transform: scale(1); opacity: 0.18; } 50% { transform: scale(0.6); opacity: 0.08; } }
@keyframes st-lick { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1.1); } }
@keyframes st-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes st-heart { 0% { transform: translateY(6px) scale(0.6); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-16px) scale(1.15); opacity: 0; } }
@keyframes st-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04, 0.97); } }
@keyframes st-z { 0% { transform: translate(-4px, 6px) scale(0.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(4px, -8px) scale(1.1); opacity: 0; } }
@keyframes st-zoom { 0%, 100% { transform: translateX(-6%) rotate(-8deg); } 50% { transform: translateX(6%) rotate(8deg); } }
@keyframes st-puff { 0% { transform: translateX(4px); opacity: 0.9; } 100% { transform: translateX(-8px) scale(1.2); opacity: 0; } }
@keyframes st-tilt { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes st-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes st-twinkle { 0%, 100% { opacity: 0.4; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.1); } }

/* ---------------- Welcome tour (tour.js) ----------------
   Full screen on phones, a centered card on desktop. The cards sit in a
   horizontal scroll-snap strip, so swiping is native and follows RTL. */
.sheet.tour-sheet {
  inset: 0;
  margin: 0;
  width: 100vw; max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: min(100dvh, var(--vv-h, 100dvh));
  border-radius: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, var(--cream) 0%, var(--cream) 45%, var(--sand) 100%);
}
.tour { display: flex; flex-direction: column; height: 100%; }
.tour-track {
  flex: 1 1 auto; min-height: 0;
  display: flex;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.tour-track::-webkit-scrollbar { display: none; }
.tour-card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 28px 12px;
  text-align: center;
  overflow-y: auto;
}
.tour-art {
  position: relative;
  width: min(320px, 82vw);
  aspect-ratio: 3 / 2;
  margin-bottom: 10px;
}
.tour-scene { width: 100%; height: 100%; display: block; }
.tour-dog { position: absolute; line-height: 0; filter: drop-shadow(0 3px 0 rgba(142, 27, 27, 0.08)); }
.tour-dog svg { display: block; width: 100%; height: auto; }
.tour-dog-hello-a { width: 34%; left: 33%; bottom: 0; }
.tour-dog-hello-b { width: 26%; left: 13%; bottom: 4%; }
.tour-dog-hello-c { width: 26%; right: 13%; bottom: 4%; transform: scaleX(-1); }
.tour-dog-map { width: 32%; right: -4%; bottom: -10%; }
.tour-dog-map-c { width: 23%; left: 30%; bottom: 6%; }
.tour-dog-post { width: 24%; left: 21%; bottom: 33%; }
.tour-dog-explore { width: 28%; right: -3%; bottom: -12%; }
.tour-dog-left { width: 34%; left: 12%; bottom: 0; }
.tour-dog-right { width: 34%; right: 12%; bottom: 0; transform: scaleX(-1); }
.tour-dog-me { width: 46%; left: 27%; bottom: 0; animation: tour-bob 2.4s ease-in-out infinite; }
@keyframes tour-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.tour-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.9rem, 8vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--brand);
}
.tour-text {
  margin: 0;
  max-width: 22em;
  font-size: 1.12rem;
  line-height: 1.45;
  color: var(--ink);
}
.tour-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px calc(16px + env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
}
.tour-skip { flex: none; }
.tour-next { flex: none; min-width: 108px; padding: 0 20px; white-space: nowrap; }
.tour-next.tour-go { min-width: 140px; }
.tour-dots { flex: 1 1 auto; display: flex; justify-content: center; gap: 2px; }
.tour-dot {
  width: 28px; height: 44px;
  padding: 0; border: 0; background: none;
  cursor: pointer;
  display: grid; place-items: center;
}
.tour-dot::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--sand-deep);
  transition: width 0.2s var(--ease-out), background-color 0.2s;
}
.tour-dot[aria-current='step']::before { width: 22px; background: var(--brand); }
.settings-tour-btn { width: 100%; min-height: 52px; margin-bottom: 10px; }
@media (min-width: 820px) {
  .sheet.tour-sheet { width: min(100vw, 480px); height: min(720px, 92dvh); margin: auto; border-radius: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-dog-me { animation: none; }
  .tour-track { scroll-behavior: auto; }
  .tour-dot::before { transition: none; }
}

/* ---------------- Launch splash (splash.js) ----------------
   Full-screen logo + "Havhav" on every page load, then fades away.
   Always English: the one allowed exception to the single-language rule. */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100000; /* above the map, header and Leaflet panes */
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 42%, var(--cream) 0%, var(--sand) 70%, var(--sand-dark) 100%);
  opacity: 1;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: splash-pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.splash-logo {
  width: 132px;
  height: 132px;
  border-radius: 30px;
  box-shadow: 0 6px 0 var(--brand-dark), 0 18px 40px rgba(142, 27, 27, 0.28);
}
.splash-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.6rem;
  letter-spacing: 0.02em;
  color: var(--brand);
}
.splash.splash-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@keyframes splash-pop {
  from { opacity: 0; transform: scale(0.82) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* While the splash is up, keep open dialogs (top layer) invisible, then fade them in. */
dialog { transition: opacity 0.5s ease; }
dialog::backdrop { transition: opacity 0.5s ease; }
.splash-active dialog[open],
.splash-active dialog[open]::backdrop { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .splash { transition: none; }
  .splash-inner { animation: none; }
  dialog, dialog::backdrop { transition: none; }
}

/* ---------------- Keyboard-safe layout (phones, every text field) ----------------
   iOS Safari doesn't shrink the layout viewport when the keyboard opens: it
   shrinks the *visual* viewport and often pans it down. syncViewportHeight()
   in app.js publishes that visible box (--vv-top, --vv-h, --vv-bottom), and
   here the whole app and every full-screen sheet are pinned to it, so the
   field you type in (a treat, a new post, Settings, search, chat, a review…)
   stays right above the keyboard instead of sliding off screen.
   - <body> is position:fixed on the visible box, so the tab screens (Explore,
     My Dog, Settings, Buddies) and the map follow the pan. No transform or
     filter on <body>: that would make the fixed dialogs below move twice.
   - Dialogs are fixed to the layout viewport, so they get the same top/height.
   - No transitions on these: the UI follows the keyboard without a jump.
   Desktop (≥ 820 px) is untouched: dialogs stay centered cards. */
@media (max-width: 819px) {
  html { overflow: hidden; }
  body {
    position: fixed;
    top: var(--vv-top, 0px); left: 0; right: 0;
    width: 100%;
    height: var(--vv-h, 100dvh);
    overflow: hidden;
  }
  /* Full-screen sheets: exactly the visible box. */
  .sheet.lang-sheet, .sheet.picker, .sheet.tour-sheet, .sheet.chat-sheet {
    top: var(--vv-top, 0px); bottom: auto;
    height: var(--vv-h, 100dvh);
    max-height: var(--vv-h, 100dvh);
  }
  /* Small centered cards: centered inside the visible box. */
  .sheet.profile-sheet, .sheet.recovery-sheet, .sheet.photo-viewer {
    top: var(--vv-top, 0px); bottom: var(--vv-bottom, 0px);
  }
  /* The keyboard covers the home indicator: no safe-area gap under the Save
     bars and composers while it's open (the chat does the same). */
  .kb-open .designer-actions,
  .kb-open .reviews-sheet .designer-actions,
  .kb-open .account-sheet .designer-actions,
  .kb-open .playdate-sheet .designer-actions, .kb-open .lost-sheet .designer-actions { padding-bottom: 12px; }
  .kb-open .picker-body { padding-bottom: 16px; }
  /* Treat box (Explore): docked at the bottom of the feed while typing, with
     the post and its treats above it (exploreViewportChanged in app.js). */
  .kb-open .xp-thread .xt-form {
    position: sticky; bottom: 0; z-index: 2;
    margin: 0 -12px -10px; padding: 8px 12px 10px;
    background: var(--cream);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
  /* Map search results never run under the keyboard. */
  .kb-open .search-results { max-height: max(120px, calc(var(--vv-h, 100dvh) - 140px)); }
  /* Every field that opens the keyboard is at least 16 px, so Safari doesn't
     zoom the page in when you tap it (rem keeps bigger phone font sizes). */
  input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
  textarea, select { font-size: max(16px, 1rem); }
}

/* ---------------- Consent popup + sign-up "I agree" (app.js section 6p) ----------------
   The usual "before you start" card: centered, the logo popping in, four short
   points with emoji in sand circles, the policy links and one big "I agree". */
.sheet.consent-sheet {
  width: min(92vw, 420px); max-height: min(92dvh, var(--vv-h, 92dvh));
  margin: auto; padding: 24px 20px 20px;
  border-radius: var(--radius); text-align: center; overflow-y: auto;
}
.consent-logo {
  display: block; margin: 0 auto 10px;
  border-radius: 20px; box-shadow: 0 0 0 3px var(--cream), 0 4px 0 var(--brand-dark);
  animation: consent-pop 0.6s var(--ease-pop) both;
}
@keyframes consent-pop { from { transform: scale(0.6) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .consent-logo { animation: none; } }
.consent-sheet h2 { margin: 0 0 14px; font-family: var(--display); font-size: 1.45rem; color: var(--brand-dark); }
.consent-points { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: start; }
.consent-points li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--paper); border: 2px solid var(--sand); box-shadow: var(--edge);
  font-size: 0.95rem; line-height: 1.4;
}
.consent-icon {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--sand); font-size: 1.25rem;
}
.consent-links { margin: 0 0 16px; font-size: 0.95rem; line-height: 1.5; }
.legal-link { color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.consent-agree { width: 100%; font-size: 1.15rem; }
.terms-row { align-items: flex-start; padding-top: 6px; line-height: 1.45; }
.terms-row input { flex: 0 0 auto; margin-top: 1px; }
@media (max-width: 819px) {
  .sheet.consent-sheet { top: var(--vv-top, 0px); bottom: var(--vv-bottom, 0px); }
}

/* ---------------- Settings → Privacy & terms + Delete account (app.js section 6p) ---------------- */
.legal-box { padding-bottom: 12px; }
.legal-links { display: flex; gap: 10px; flex-wrap: wrap; }
.legal-btn {
  flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 12px; color: var(--ink); text-decoration: none; font-size: 0.95rem; line-height: 1.2;
}
.delete-account-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 46px; margin-top: 12px;
  border: 2px dashed var(--brand); border-radius: 999px;
  background: transparent; color: var(--brand-dark);
  font: inherit; font-weight: 700; cursor: pointer;
}
.delete-account-btn:hover { background: var(--brand-soft); }
.delete-account-btn[hidden] { display: none; }
/* The confirmation: a small centered card, like the recovery code. */
.sheet.delete-sheet {
  width: min(92vw, 400px); max-height: min(92dvh, var(--vv-h, 92dvh));
  margin: auto; padding: 22px 20px 18px;
  border-radius: var(--radius); text-align: center; overflow-y: auto;
}
.delete-art {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 8px;
  border-radius: 50%; background: var(--brand-soft); font-size: 2rem;
  transform: rotate(-12deg);
}
.delete-sheet h2 { margin: 0 0 8px; font-family: var(--display); font-size: 1.35rem; color: var(--brand-dark); }
.delete-text { margin: 0 0 14px; line-height: 1.5; }
.delete-field { text-align: start; margin-bottom: 6px; }
.delete-sheet .form-error:empty { display: none; }
.delete-sheet .form-error { margin: 4px 0 8px; }
.delete-actions { display: flex; gap: 10px; margin-top: 8px; }
.delete-actions > * { flex: 1 1 0; min-height: 50px; }
.delete-actions .danger-btn:disabled { opacity: 0.6; cursor: wait; }
@media (max-width: 819px) {
  .sheet.delete-sheet { top: var(--vv-top, 0px); bottom: var(--vv-bottom, 0px); }
}
