:root {
  --accent: #F2762E;
  --accent-soft: rgba(242, 118, 46, 0.14);
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #1C1C1E;
  --muted: #6E6E73;
  --line: rgba(60, 60, 67, 0.14);
  --field: #E5E5EA;
  --danger: #E5484D;
  --green: #248A3D;
  --desk: #E9E4DF;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.05);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-soft: rgba(242, 118, 46, 0.22);
    --bg: #000000;
    --card: #1C1C1E;
    --text: #F2F2F7;
    --muted: #98989F;
    --line: rgba(84, 84, 88, 0.5);
    --field: #2C2C2E;
    --green: #30D158;
    --desk: #111111;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(84px + env(safe-area-inset-bottom));
  background: var(--bg);
}

/* On a laptop or projector, show the app as a phone-width column. */
@media (min-width: 600px) {
  body { background: var(--desk); }
  .app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, 0.12); }
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- Text ---------- */

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.footnote { font-size: 12px; color: var(--muted); margin: 24px 4px 8px; line-height: 1.45; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
h2.section { font-size: 20px; font-weight: 700; margin: 26px 0 10px; }
h1.title { font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; margin: 18px 0 4px; }

/* ---------- Top of each screen ---------- */

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 0 14px;
}
.topbar h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
.topbar-actions { display: flex; gap: 10px; }

.icon-btn {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.flat { background: transparent; box-shadow: none; color: var(--muted); }

/* Demo Mode's "a friend arrives" button: clearly labeled so it isn't mistaken for notifications. */
.demo-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 40px; padding: 0 14px;
  border: 0; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 15px; font-weight: 700;
}
.demo-btn svg { width: 18px; height: 18px; }

.back {
  display: inline-flex; align-items: center; gap: 2px;
  color: var(--accent); text-decoration: none; font-size: 17px;
  padding: calc(16px + env(safe-area-inset-top)) 0 12px;
}
.back svg { width: 22px; height: 22px; margin-left: -6px; }

/* ---------- Cards and lists ---------- */

.stack { display: grid; gap: 12px; }
.spaced { margin-top: 16px; }

.card {
  display: block;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.park-row { display: flex; align-items: center; gap: 12px; }
.park-row .name { font-weight: 650; font-size: 17px; }
.bell-mini svg { width: 13px; height: 13px; color: var(--accent); vertical-align: -1px; }
.who { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.count { text-align: center; min-width: 44px; }
.count b { display: block; font-size: 24px; line-height: 1; }
.count span { font-size: 11px; color: var(--muted); }
.chev { color: var(--muted); opacity: 0.5; display: grid; }
.chev svg { width: 16px; height: 16px; }

/* The two switches at the top of Parks. */
.controls { margin-bottom: 14px; }
.controls .row { align-items: flex-start; }
.controls .row .switch { margin-top: 2px; }
.control-icon { font-size: 22px; width: 28px; text-align: center; flex: none; line-height: 1.3; }

.here-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.here-card b { display: block; }

.pill-btn {
  border: 0; border-radius: 999px;
  background: var(--card); color: var(--text);
  padding: 8px 14px; font-weight: 600; font-size: 15px;
}

.list { background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.list-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin: 26px 16px 8px; }
.list-title.flush { margin: 6px 4px 0; }
.list-foot { font-size: 13px; color: var(--muted); margin: 8px 16px 0; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; min-height: 52px;
  color: inherit; text-decoration: none;
}
.row + .row { border-top: 0.5px solid var(--line); }
.row b { font-weight: 600; }
.row-btn { width: 100%; border: 0; background: none; color: var(--accent); text-align: left; gap: 10px; }
.row-btn svg { width: 20px; height: 20px; }
.row-btn.danger { color: var(--danger); justify-content: center; }
.row-link { width: 100%; border: 0; background: none; text-align: left; }
.check-row { cursor: pointer; }
.check-row input { accent-color: var(--accent); width: 22px; height: 22px; }

.tag {
  font-size: 12px; font-weight: 700; white-space: nowrap;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 9px; border-radius: 999px;
}

.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.badge {
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
  background: var(--field); color: var(--muted);
}
.badge.open { background: rgba(52, 199, 89, 0.15); color: var(--green); }

/* ---------- Dog badges ---------- */

.avatar {
  --s: 40px;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.1)), var(--c);
  color: #fff;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: calc(var(--s) * 0.42);
  box-shadow: 0 0 0 2px var(--card);
  flex: none; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.more { font-size: calc(var(--s) * 0.34); }
.avatars { display: inline-flex; flex: none; }
.avatars .avatar + .avatar { margin-left: calc(var(--s) * -0.3); }

/* ---------- Buttons ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  border: 0; border-radius: 14px;
  padding: 15px 16px;
  font-size: 17px; font-weight: 600;
  text-decoration: none;
  transition: transform 0.1s;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-plain { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.btn-danger { background: rgba(229, 72, 77, 0.12); color: var(--danger); }
.btn-icon { padding: 0; color: var(--accent); }
.btn-row { display: grid; grid-template-columns: 1fr 54px; gap: 10px; }

.link-btn { border: 0; background: none; color: var(--accent); font-size: 17px; padding: 6px 0; }

/* ---------- Switches ---------- */

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--field); border-radius: 999px; transition: background 0.2s; cursor: pointer; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: 0.5; cursor: default; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Map ---------- */

.map-slot {
  height: 220px;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  background: var(--field);
  box-shadow: var(--shadow);
}
.map-slot.small { height: 170px; }
.map { width: 100%; height: 100%; }
.map-fallback { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.leaflet-container { font: inherit; background: var(--field); }
.leaflet-control-attribution { font-size: 10px; }
.pin-wrap { background: none; border: 0; }
.pin {
  display: inline-block;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  background: #8E8E93; color: #fff;
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  padding: 5px 7px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.pin.busy { background: var(--accent); }

/* ---------- Moments ---------- */

.post { padding: 14px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-head b { font-weight: 650; }
.post-photo {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  display: grid; place-items: center;
  font-size: 72px;
}
.post-photo img { width: 100%; height: 100%; object-fit: cover; }
.post-actions { display: flex; gap: 16px; margin: 12px 0 6px; }
.like { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.like svg { width: 24px; height: 24px; }
.like.on { color: #FF2D55; }
.like.on svg { fill: currentColor; }
.caption { margin: 0; }

/* ---------- Me ---------- */

.plus-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; border: 0; text-align: left;
  margin-top: 26px;
}
.plus-icon { width: 44px; height: 44px; border-radius: 10px; }

.demo-tag {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); background: var(--field);
  padding: 2px 6px; border-radius: 6px; vertical-align: 1px;
}

.join-card { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.join-card .emoji { font-size: 28px; }

/* ---------- Joining ---------- */

.join { padding: calc(40px + env(safe-area-inset-top)) 4px 24px; text-align: center; }
.join-icon { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 8px 24px rgba(242, 118, 46, 0.35); }
.join h1 { font-size: 32px; letter-spacing: -0.02em; margin: 16px 0 4px; }
.join > p.muted { margin: 0 0 24px; }
.join form { text-align: left; }
.join .swatches { justify-content: center; }
.look-around { display: block; margin: 14px auto 0; }

.splash { min-height: 80dvh; display: grid; place-items: center; }
.splash img { width: 84px; height: 84px; border-radius: 20px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

.btn:disabled { opacity: 0.6; }

/* ---------- Bottom tabs ---------- */

.tabs {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 500;
}
.tabs[hidden] { display: none; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  padding: 4px 0;
}
.tab svg { width: 26px; height: 26px; }
.tab.active { color: var(--accent); }

/* ---------- Pop-down notification ---------- */

.banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 456px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 2000;
  cursor: pointer;
  animation: drop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.banner[hidden] { display: none; }
.banner .app-icon { width: 38px; height: 38px; border-radius: 9px; flex: none; }
.banner b { display: block; font-size: 15px; }
.banner span { font-size: 14px; }
.banner .grow span { color: var(--muted); }
.banner-action {
  border: 0; border-radius: 999px; flex: none;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 7px 14px;
}
.demo-arrive { display: block; margin: 14px auto 0; font-size: 15px; }
@keyframes drop {
  from { transform: translate(-50%, -130%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ---------- Sheets that slide up ---------- */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1500;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.2s;
}
.sheet {
  width: 100%; max-width: 480px; max-height: 92dvh;
  overflow: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  animation: rise 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
.sheet-head { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; margin-bottom: 12px; min-height: 36px; }
.sheet-head h3 { margin: 0; font-size: 17px; text-align: center; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-sub { text-align: center; color: var(--muted); margin: -4px 0 0; }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

.field {
  width: 100%;
  border: 0; border-radius: 12px;
  background: var(--card);
  padding: 13px 14px;
  font-size: 17px;
  box-shadow: var(--shadow);
}
textarea.field { resize: none; min-height: 96px; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 0; }

select.field { appearance: none; -webkit-appearance: none; color: var(--text);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }

/* Dog size buttons */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: grid; gap: 2px; text-align: center; padding: 10px 6px;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  border: 2px solid transparent;
}
.chip small { font-size: 12px; color: var(--muted); }
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }

/* Invites */
.invite-note { background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 10px 14px; margin: 16px 0; font-weight: 600; }
.invite-card { display: grid; gap: 6px; margin-top: 16px; }
.invite-code { font-size: 34px; font-weight: 800; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--accent); }
.code-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-form .field { text-transform: uppercase; letter-spacing: 0.05em; }
.code-form .field::placeholder { text-transform: none; letter-spacing: 0; }

/* Who's at the park: sizes and heads-ups */
.mix { margin: -2px 16px 8px; }
.heads-up { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: rgba(229, 72, 77, 0.1); color: var(--text); }

.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.photo-pick {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  background: var(--card);
  border: 2px dashed var(--line);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}
.photo-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; }
.photo-preview svg { width: 34px; height: 34px; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.dog-photo-pick {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 50%;
  margin: 0 auto;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--accent);
  display: grid; place-items: center;
  overflow: hidden;
  cursor: pointer;
}
.dog-photo-pick svg { width: 30px; height: 30px; }
.dog-photo-pick img { width: 96px; height: 96px; object-fit: cover; display: block; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c); }

.plus-hero { text-align: center; }
.plus-hero img { width: 72px; height: 72px; border-radius: 16px; }
.plus-hero h2 { margin: 10px 0 2px; font-size: 26px; }
.plus-hero p { margin: 0 0 18px; }
.widget {
  width: 170px; height: 170px;
  margin: 0 auto 8px;
  padding: 14px;
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex; flex-direction: column; gap: 6px;
}
.widget-top { font-size: 11px; font-weight: 700; color: var(--accent); }
.widget b { font-size: 15px; line-height: 1.2; }
.features { margin: 22px 0; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .emoji { font-size: 26px; width: 34px; text-align: center; flex: none; }
