@font-face {
  font-family: "Briefly Sans";
  src: local("Arial");
  font-display: swap;
}

:root {
  --paper: #f4f1e8;
  --ink: #17211c;
  --muted: #69716a;
  --line: rgba(23, 33, 28, 0.16);
  --green: #214e3b;
  --lime: #d7f36a;
  --white: #fffef9;
  --danger: #a33b2f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Briefly Sans", "Helvetica Neue", Arial, sans-serif;
}

body { min-height: 100dvh; }
button, select, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100dvh; }

.topbar {
  height: 84px;
  padding: 0 clamp(22px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1000;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.brand-mark {
  width: 25px;
  height: 25px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  background: var(--paper);
}
.brand-mark::before { width: 3px; height: 29px; }
.brand-mark::after { width: 29px; height: 3px; }
.brand-mark span {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  z-index: 1;
}

.privacy-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.privacy-chip svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.app-shell:has(.map-screen:not(.hidden)) .brand,
.app-shell:has(.map-screen:not(.hidden)) .privacy-chip {
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(244, 241, 232, .86);
  box-shadow: 0 3px 14px rgba(18,31,23,.08);
  backdrop-filter: blur(12px);
}

.landing {
  padding: clamp(58px, 9vh, 110px) clamp(22px, 8vw, 128px) 48px;
}

.hero { max-width: 880px; }
.eyebrow {
  margin: 0 0 24px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(49px, 7.4vw, 108px);
  font-weight: 600;
  letter-spacing: -.07em;
  line-height: .9;
}

.hero h1 em {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  color: var(--green);
}

.lede {
  max-width: 560px;
  margin: 36px 0 30px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.55;
}

.hero-actions, .share-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.button {
  border: 0;
  border-radius: 8px;
  min-height: 52px;
  padding: 0 22px;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  transition: transform .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .55; cursor: wait; }
.button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.button-primary { background: var(--green); color: var(--white); }
.button-primary:hover { background: #173e2e; }
.button-secondary { background: rgba(255,255,255,.78); border: 1px solid var(--line); }

.duration-control {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px 0 18px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
.duration-control select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.speed-option {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-top: 17px;
  cursor: pointer;
  color: var(--ink);
}
.speed-option input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--green);
}
.speed-option span { display: grid; gap: 2px; }
.speed-option strong { font-size: 14px; }
.speed-option small { color: var(--muted); font-size: 12px; }

.destination-control {
  display: grid;
  gap: 7px;
  max-width: 560px;
  margin-top: 18px;
  font-size: 14px;
  font-weight: 700;
}
.destination-control > span small {
  color: var(--muted);
  font-weight: 400;
}
.destination-control input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}
.destination-control > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.inline-error { color: var(--danger); min-height: 20px; font-size: 14px; }
.android-download {
  display: inline-flex;
  margin-top: 14px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
}
.android-download:hover { opacity: .75; }

.promise-grid {
  border-top: 1px solid var(--line);
  margin-top: clamp(78px, 13vh, 150px);
  padding-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(28px, 6vw, 90px);
}
.promise-grid article { position: relative; padding-left: 42px; }
.promise-number {
  position: absolute;
  left: 0;
  top: 3px;
  color: var(--green);
  font: italic 14px Georgia, serif;
}
.promise-grid h2 { margin: 0 0 9px; font-size: 16px; letter-spacing: -.02em; }
.promise-grid p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.hidden { display: none !important; }

.map-screen {
  position: fixed;
  inset: 0;
  background: #dbe0d5;
}
.map { position: absolute; inset: 0; }
.map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 400;
  box-shadow: inset 0 0 100px rgba(20,35,25,.10);
}
.map-screen .topbar { position: absolute; }

.map-overlay {
  position: absolute;
  z-index: 800;
  left: clamp(16px, 5vw, 72px);
  bottom: clamp(16px, 6vh, 64px);
  width: min(430px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 14px;
  background: rgba(244, 241, 232, .92);
  box-shadow: 0 18px 55px rgba(18, 31, 23, .18);
  backdrop-filter: blur(18px);
}

.status-row { display: flex; align-items: center; justify-content: space-between; }
.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}
.live-status i {
  width: 8px; height: 8px; border-radius: 50%; background: #43a55d;
  box-shadow: 0 0 0 5px rgba(67,165,93,.13);
}
.live-status.waiting i { background: #d19434; box-shadow: 0 0 0 5px rgba(209,148,52,.14); }
.live-status.ended i { background: #9b554b; box-shadow: none; }
.age-label, .map-meta, .eta-meta { color: var(--muted); font-size: 13px; }

.map-overlay h1 { margin: 19px 0 7px; font-size: 28px; letter-spacing: -.045em; }
.map-overlay > p { color: var(--muted); margin: 0 0 20px; line-height: 1.45; }
.share-actions { margin-bottom: 18px; }
.share-actions .button-primary { flex: 1; }
.map-meta { border-top: 1px solid var(--line); padding-top: 15px; }
.eta-meta {
  display: grid;
  gap: 3px;
  margin-top: 12px;
}
.eta-meta strong { color: var(--green); font-size: 16px; }
.eta-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-separator { margin: 0 5px; }
.text-button { border: 0; background: none; padding: 14px 0 0; cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.danger { color: var(--danger); }

.recenter {
  position: absolute;
  z-index: 800;
  right: 20px;
  bottom: 24px;
  min-height: 50px;
  padding: 0 18px;
  border: 2px solid var(--white);
  border-radius: 25px;
  background: var(--green);
  color: var(--white);
  box-shadow: 0 7px 24px rgba(18,31,23,.34), 0 0 0 1px rgba(23,33,28,.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.recenter:hover {
  background: #173e2e;
  box-shadow: 0 9px 28px rgba(18,31,23,.4), 0 0 0 1px rgba(23,33,28,.12);
  transform: translateY(-1px);
}
.recenter:active { transform: translateY(0); }
.recenter:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.recenter svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 2.2; }

.location-pin {
  width: 28px;
  height: 28px;
  background: var(--green);
  border: 4px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 3px 12px rgba(12, 43, 29, .36), 0 0 0 8px rgba(33,78,59,.13);
}
.location-pin::after {
  content: "";
  display: block;
  width: 6px; height: 6px;
  margin: 7px;
  border-radius: 50%;
  background: var(--lime);
}

.destination-pin {
  width: 22px;
  height: 22px;
  border: 4px solid var(--white);
  border-radius: 4px 50% 50% 50%;
  background: var(--danger);
  box-shadow: 0 3px 10px rgba(18,31,23,.3);
  transform: rotate(45deg);
}
.maplibregl-marker { z-index: 500; }

.toast {
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  padding: 11px 16px;
  border-radius: 8px;
  color: var(--white);
  background: var(--ink);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.maplibregl-ctrl-attrib {
  margin: 0 5px 5px 0 !important;
  padding: 3px 7px !important;
  border-radius: 7px;
  background: rgba(255,254,249,.84) !important;
  backdrop-filter: blur(8px);
  font-size: 9px;
}
.maplibregl-ctrl-top-right { top: 86px; right: 10px; }
.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(23,33,28,.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 5px 20px rgba(18,31,23,.15) !important;
}
.maplibregl-ctrl-group button {
  width: 38px !important;
  height: 38px !important;
  line-height: 36px !important;
  border-color: var(--line) !important;
  color: var(--green) !important;
  background: rgba(255,254,249,.94) !important;
}
.maplibregl-ctrl-group button:hover { background: var(--white) !important; }

@media (max-width: 700px) {
  .topbar { height: 70px; padding: 0 18px; }
  .privacy-chip { font-size: 0; }
  .privacy-chip svg { width: 21px; }
  .landing { padding: 56px 20px 36px; }
  .hero h1 { font-size: clamp(49px, 15vw, 72px); }
  .hero-actions { flex-direction: column; }
  .duration-control { justify-content: center; }
  .promise-grid { grid-template-columns: 1fr; margin-top: 75px; gap: 30px; }
  .map-overlay {
    left: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    padding: 12px 14px;
    border-radius: 16px;
  }
  .map-overlay h1 { margin: 9px 0 2px; font-size: 18px; }
  .map-overlay > p { display: none; }
  .status-row { min-height: 20px; }
  .live-status, .age-label, .map-meta, .eta-meta { font-size: 11px; }
  .share-actions { margin: 10px 0 8px; gap: 7px; }
  .share-actions .button { min-height: 38px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
  .map-meta { padding-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .text-button { padding-top: 8px; font-size: 11px; }
  .recenter { right: 12px; bottom: auto; top: 82px; min-height: 46px; padding: 0 14px; font-size: 13px; }
  .maplibregl-ctrl-top-right { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
