:root {
  --bg: #fdf8f3;
  --card: #ffffff;
  --text: #1f1a17;
  --muted: #6b625b;
  --accent: #c2410c;
  --accent-text: #ffffff;
  --border: #eadfd5;
  --chip: #fde8d7;
  --chip-text: #8a2f08;
  --error: #b91c1c;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171311;
    --card: #221c19;
    --text: #f5eee8;
    --muted: #b3a79e;
    --accent: #f97316;
    --accent-text: #1a0d05;
    --border: #3a302a;
    --chip: #3b2416;
    --chip-text: #fdba8c;
    --error: #f87171;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; color: var(--accent); }
.tagline { margin: 0.25rem 0 1.5rem; color: var(--muted); }

button, input { font: inherit; }

.primary {
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}
#locate { width: 100%; font-size: 1.1rem; }
.primary:disabled { opacity: 0.6; cursor: progress; }

form { margin-top: 1rem; }
label { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.95rem; }
.row { display: flex; gap: 0.5rem; }
input {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--card);
  color: var(--text);
  font-size: 16px; /* prevents iOS zoom on focus */
}

#status { min-height: 1.5em; margin: 1rem 0 0.5rem; color: var(--muted); }
#status.error { color: var(--error); }

#map {
  height: 15rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  z-index: 0; /* keep Leaflet's panes below anything layered on the page */
}
@media (prefers-color-scheme: dark) {
  #map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9); }
}

.you-dot {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25), 0 1px 3px rgba(0, 0, 0, 0.4);
}

.pin {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font: 700 14px/1 system-ui, -apple-system, sans-serif;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}
.pin.active { transform: scale(1.3); }

.rank {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 700;
}

#results { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }

.card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  overflow: hidden;
}
summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
summary::-webkit-details-marker { display: none; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 1rem; }
.name { flex: 1; min-width: 0; font-size: 1.1rem; font-weight: 600; line-height: 1.25; }
.distance { flex-shrink: 0; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.chevron {
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}
details[open] .chevron { transform: rotate(-135deg) translate(-2px, -2px); }
details[open] summary { border-bottom: 1px solid var(--border); }
.body { padding: 0.75rem 1rem 1rem; }
.address { margin: 0; color: var(--muted); font-size: 0.95rem; }
.note {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--chip);
  white-space: pre-line; /* keep line breaks typed in the sheet cell */
}
.note::before {
  content: "Param's take";
  display: block;
  margin-bottom: 0.15rem;
  color: var(--chip-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.note:empty { display: none; }

.meals { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0.75rem 0 0; padding: 0; }
.meals:empty { display: none; }
.meals li {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 0.85rem;
  text-transform: capitalize;
}

.maps {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin-top: 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

footer { margin-top: 2rem; text-align: center; }
.link { background: none; border: 0; padding: 0.5rem; color: var(--accent); text-decoration: underline; cursor: pointer; }
.credit { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--muted); }
.credit a { color: inherit; }
