@font-face {
  font-family: "Romie";
  src: url("./fonts/Romie-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Roobert";
  src: url("./fonts/Roobert-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Roobert";
  src: url("./fonts/Roobert-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #ffe1eb;
  --paper-warm: #fff7f1;
  --olive: #6d6435;
  --violet: #7442d9;
  --violet-light: #9a68ff;
  --mist: #e2f1ff;
  --coral: #ee6d55;
  --line: rgba(109, 100, 53, .25);
  --soft-line: rgba(109, 100, 53, .14);
  --felt-overlay: #f7c7da;
  --felt-overlay-opacity: 0;
  --felt-filter: none;
  --background-filter: none;
  color: var(--olive);
  background: var(--paper);
  font-family: "Roobert", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="sage"] {
  --paper: #dfe9d8;
  --paper-warm: #f8f4e8;
  --olive: #40563d;
  --violet: #8c5276;
  --violet-light: #b8799e;
  --mist: #dcebe4;
  --coral: #c76358;
  --line: rgba(64, 86, 61, .26);
  --soft-line: rgba(64, 86, 61, .15);
  --felt-overlay: #93af83;
  --felt-overlay-opacity: .31;
  --felt-filter: saturate(.82) hue-rotate(20deg);
  --background-filter: sepia(.16) hue-rotate(34deg) saturate(.78);
}

:root[data-theme="blue"] {
  --paper: #dcecff;
  --paper-warm: #fff9ef;
  --olive: #40536d;
  --violet: #536fd1;
  --violet-light: #849aeb;
  --mist: #cae4ff;
  --coral: #db716d;
  --line: rgba(64, 83, 109, .26);
  --soft-line: rgba(64, 83, 109, .15);
  --felt-overlay: #91bee6;
  --felt-overlay-opacity: .39;
  --felt-filter: saturate(.78) hue-rotate(84deg);
  --background-filter: sepia(.1) hue-rotate(118deg) saturate(.84);
}

:root[data-theme="honey"] {
  --paper: #f8dfae;
  --paper-warm: #fff7e4;
  --olive: #66512e;
  --violet: #b6536d;
  --violet-light: #dd7d91;
  --mist: #f0e5ca;
  --coral: #c95e49;
  --line: rgba(102, 81, 46, .27);
  --soft-line: rgba(102, 81, 46, .15);
  --felt-overlay: #e7ad54;
  --felt-overlay-opacity: .31;
  --felt-filter: sepia(.12) saturate(1.08) hue-rotate(344deg);
  --background-filter: sepia(.23) saturate(1.08) hue-rotate(345deg);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--paper); }
body {
  position: relative;
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background-color: var(--paper);
  transition: color .18s ease, background-color .18s ease;
}
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  background-image: url("./felt-background-optimized.jpg");
  background-position: top center;
  background-size: min(100vw, 460px) auto;
  background-repeat: repeat-y;
  opacity: .48;
  filter: var(--background-filter);
  pointer-events: none;
}
.legal-page::before { display: none; }
body > * { position: relative; z-index: 1; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.hidden { display: none !important; }

.app-shell {
  width: min(100%, 460px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--soft-line);
}

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.theme-button {
  min-width: 43px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--olive);
  background: color-mix(in srgb, var(--paper-warm) 38%, transparent);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .09em;
  cursor: pointer;
}
.theme-button:active { transform: scale(.97); }

.store-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  border: 1px solid rgba(109, 100, 53, .20);
  border-radius: 13px;
  background: color-mix(in srgb, var(--paper-warm) 72%, transparent);
}
.store-mode-option {
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--olive);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.store-mode-option.selected { color: var(--paper-warm); background: var(--violet); }

.availability-switch {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 6px;
}
.availability-option {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 11px;
  color: rgba(109, 100, 53, .72);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.availability-option.selected {
  border-color: var(--line);
  color: var(--olive);
  background: color-mix(in srgb, var(--paper-warm) 76%, transparent);
}
.availability-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #4e9562;
  box-shadow: 0 0 0 3px rgba(78, 149, 98, .12);
}

.brand-lockup { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-icon { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; border: 1px solid var(--soft-line); filter: var(--felt-filter); }
.brand-name { margin: 0; font-family: "Romie", Georgia, serif; font-size: 25px; line-height: .95; letter-spacing: -.035em; }
.brand-subtitle { margin: 4px 0 0; font-size: 10px; letter-spacing: .09em; white-space: nowrap; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 8px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .11em;
  white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }
.status-pill.busy .status-dot { animation: pulse 1s ease-in-out infinite; }
.status-pill.error .status-dot { background: var(--coral); }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }

.screen { padding: 12px 0 4px; }

.start-screen { display: grid; gap: 13px; }
.felt-hero { position: relative; margin: 0; height: min(31svh, 245px); overflow: hidden; border-radius: 18px; border: 1px solid var(--soft-line); background: var(--paper-warm); }
.felt-hero img { width: 100%; height: 100%; display: block; object-fit: cover; }
.felt-hero::after, .compass-stage::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 0;
  border-radius: inherit;
  background: var(--felt-overlay);
  mix-blend-mode: color;
  opacity: var(--felt-overlay-opacity);
  pointer-events: none;
}

.intro-copy { padding-top: 3px; }
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .15em; }
h1, h2 { margin: 0; font-family: "Romie", Georgia, serif; font-weight: 400; letter-spacing: -.035em; }
h1 { font-size: clamp(44px, 13vw, 60px); line-height: .88; }
h2 { font-size: 32px; line-height: .95; }
.lead { margin: 11px 0 0; max-width: 34ch; font-size: 17px; line-height: 1.35; }
.support-copy { margin: 9px 0 0; max-width: 32ch; font-size: 16px; line-height: 1.4; text-align: center; }

.button {
  min-height: 48px;
  border: 1px solid var(--olive);
  border-radius: 10px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.button:active { transform: scale(.985); }
.button:disabled { opacity: .55; }
.button-primary { color: var(--paper-warm); border-color: var(--violet); background: var(--violet); }
.button-secondary { color: var(--olive); background: transparent; }
.text-button, .small-action {
  border: 0;
  background: transparent;
  padding: 7px 4px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.text-button { font-size: 13px; justify-self: center; }
.small-action { font-size: 12px; }

.state-screen {
  min-height: 650px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}
.state-screen .button { width: 100%; margin-top: 14px; }
.state-frog { width: min(64vw, 250px); aspect-ratio: 1; object-fit: cover; border-radius: 20px; margin-bottom: 12px; border: 1px solid var(--soft-line); filter: var(--felt-filter); }
.error-frog { filter: saturate(.65); }

.radar-screen { padding-top: 10px; }
.radar-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.live-label { margin: 0; color: var(--violet); font-size: 13px; font-weight: 700; }

.compass-stage {
  position: relative;
  width: min(72vw, 276px);
  aspect-ratio: 1;
  margin: 5px auto -3px;
  border-radius: 22px;
}
.compass-plate { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; filter: var(--felt-filter); }
.needle {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 176px;
  height: 176px;
  margin: -88px 0 0 -88px;
  display: grid;
  place-items: center;
  transform: rotate(0deg);
  transition: transform .14s ease-out;
  will-change: transform;
}
.needle img { width: 112px; height: 112px; display: block; object-fit: contain; filter: var(--felt-filter); }

.distance-row { display: flex; justify-content: center; align-items: baseline; gap: 7px; }
.distance-row strong { font-size: clamp(50px, 15vw, 62px); line-height: .84; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.distance-row small { font-size: 18px; font-weight: 700; }
.walking-eta { min-height: 15px; margin: 5px 0 0; color: var(--olive); text-align: center; font-size: 12px; font-weight: 700; }
.direction-hint { margin: 4px 0 10px; color: var(--violet); text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .12em; }

.store-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}
.store-number { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--paper-warm); background: var(--olive); font-size: 10px; font-weight: 700; }
.store-copy { min-width: 0; }
.store-copy h2 { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-copy p { margin: 3px 0 0; font-size: 12px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-copy .store-hours { margin-top: 4px; color: var(--violet); font-size: 10px; font-weight: 700; }
.store-hours.closed, .opening-status.closed { color: var(--coral); }
.store-hours.closing-soon, .opening-status.closing-soon { color: var(--coral); }
.store-hours.opening-soon, .opening-status.opening-soon { color: var(--violet); }
.store-hours.likely, .opening-status.likely { color: var(--olive); }
.store-hours.unknown, .opening-status.unknown { color: rgba(109, 100, 53, .68); }
.button-row { display: grid; grid-template-columns: .9fr 1.1fr; gap: 10px; margin-top: 10px; }
.arrived .distance-row, .arrived .direction-hint { color: var(--violet); }

footer { padding: 11px 4px 0; text-align: center; font-size: 9px; }
footer p { margin: 0 0 6px; opacity: .7; }
footer p a { color: inherit; text-underline-offset: 3px; }
.legal-links { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 0 0 7px; }
.legal-links a, .legal-footer a { color: inherit; text-underline-offset: 3px; }
.install-hint { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; color: var(--olive); background: transparent; font-size: 10px; }

.sheet-backdrop { position: fixed; z-index: 8; inset: 0; background: rgba(73, 57, 47, .35); }
.store-sheet {
  position: fixed;
  z-index: 9;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 480px);
  max-height: 78svh;
  overflow: auto;
  padding: 10px 18px max(22px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  color: var(--olive);
  background: var(--paper-warm);
}
.sheet-handle { width: 44px; height: 4px; border-radius: 4px; margin: 0 auto 18px; background: var(--line); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-header h2 { font-size: 31px; }
.close-button { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: transparent; font-size: 12px; }
.store-list { display: grid; margin-top: 17px; }
.store-item {
  width: 100%;
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--soft-line);
  padding: 12px 0;
  color: var(--olive);
  background: transparent;
}
.store-item.selected { color: var(--violet); }
.store-index { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; font-size: 11px; font-weight: 700; }
.store-item strong { display: block; font-size: 14px; }
.store-item small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.25; opacity: .75; }
.store-item .opening-status { margin-top: 5px; font-weight: 700; opacity: 1; }
.store-item .opening-status.open { color: #3f7f51; }
.store-item .opening-status.closing-soon { color: var(--coral); }
.store-item .store-metrics { display: grid; justify-items: end; gap: 4px; }
.store-item .meters { font-size: 12px; font-weight: 700; white-space: nowrap; }
.store-item .walking-estimate { margin: 0; font-size: 10px; font-weight: 700; white-space: nowrap; opacity: .72; }

.toast {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--paper-warm);
  background: var(--violet);
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.legal-page { min-width: 320px; background: var(--paper); }
.legal-shell {
  width: min(100%, 760px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) clamp(20px, 6vw, 54px) max(28px, env(safe-area-inset-bottom));
}
.legal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 17px; border-bottom: 1px solid var(--soft-line); }
.legal-brand { color: inherit; text-decoration: none; }
.legal-header .small-action { color: inherit; }
.legal-document { padding-top: clamp(36px, 8vw, 70px); }
.legal-document > h1 { max-width: 10ch; font-size: clamp(48px, 10vw, 76px); }
.legal-lead { max-width: 50ch; margin: 20px 0 0; font-size: clamp(18px, 3vw, 22px); line-height: 1.45; }
.legal-document section { margin-top: clamp(48px, 9vw, 76px); }
.legal-document section h2 { margin-bottom: 8px; font-size: clamp(36px, 7vw, 52px); }
.legal-document section h3 { margin: 30px 0 8px; font-size: 15px; letter-spacing: .02em; }
.legal-document section p { max-width: 66ch; margin: 0; font-size: 16px; line-height: 1.65; }
.legal-document a:not(.button) { color: var(--violet); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.legal-date { opacity: .68; }
.legal-document hr { margin: clamp(56px, 10vw, 90px) 0 0; border: 0; border-top: 1px solid var(--line); }
.support-callout { margin-top: 42px; padding: clamp(22px, 5vw, 36px); border: 1px solid var(--line); border-radius: 18px; background: var(--paper-warm); }
.support-callout h3 { margin-top: 0 !important; font-family: "Romie", Georgia, serif; font-size: 30px !important; font-weight: 400; letter-spacing: -.035em !important; }
.support-callout .button { width: fit-content; margin-top: 22px; text-decoration: none; }
.legal-footer { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: clamp(56px, 10vw, 90px); padding-top: 22px; border-top: 1px solid var(--soft-line); font-size: 12px; }

@media (max-width: 520px) {
  .legal-document > h1 { font-size: 50px; }
  .legal-document section h2 { font-size: 38px; }
  .support-callout .button { width: 100%; }
}

@media (max-height: 760px) {
  .felt-hero { height: 210px; }
  .screen { padding-top: 8px; }
  h1 { font-size: 44px; }
  .lead { font-size: 14px; }
  .compass-stage { width: 232px; margin-top: 2px; }
  .distance-row strong { font-size: 50px; }
  .walking-eta { margin-top: 3px; font-size: 11px; }
  .direction-hint { margin-bottom: 7px; }
  .store-card { padding: 7px 0; }
  .button-row { margin-top: 7px; }
  footer { padding-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
