:root {
  --green: #1f8a4c;
  --green-dark: #166a3a;
  --amber: #f5a623;
  --ink: #1d2421;
  --muted: #5f6b66;
  --bg: #f4f7f5;
  --card: #ffffff;
  --line: #dfe5e2;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
[hidden] { display: none !important; }

button {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: var(--line); color: var(--ink); }

/* Splash */
#splash {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: linear-gradient(160deg, #e8f6ee, #fdf6e7);
}
#splash h1 { margin: 0; font-size: 2.6rem; color: var(--green-dark); letter-spacing: -0.02em; }
.tagline { margin: 0 0 24px; color: var(--muted); font-size: 1.1rem; }
#cart-button {
  width: min(70vw, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  box-shadow: 0 12px 30px rgba(31, 138, 76, 0.35);
  animation: bob 2.4s ease-in-out infinite;
}
#cart-button:active { transform: scale(0.95); }
#cart-button svg { width: 62%; height: 62%; color: #fff; }
.hint { color: var(--muted); margin-top: 20px; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* Map screen */
#map-screen { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; }

.round-button {
  position: absolute;
  right: 16px;
  z-index: 500;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.6rem;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.round-button.primary { background: var(--green); color: #fff; font-size: 2rem; }
#locate-button { bottom: calc(100px + env(safe-area-inset-bottom)); }
#add-button { bottom: calc(28px + env(safe-area-inset-bottom)); }

#toast, #route-info {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 500;
  background: var(--card);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
/* Sit the toast below the route bar so both can show at once. */
#route-info:not([hidden]) + #toast { top: calc(64px + env(safe-area-inset-top)); }
#route-info { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
#route-info button { background: none; color: var(--muted); padding: 4px 8px; }

/* Rating badge used as the supermarket map marker */
.shop-marker {
  background: var(--green);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 16px;
  padding: 3px 8px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  display: inline-block;
}
.shop-marker.unrated { background: var(--muted); }

#place-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 500;
  font-size: 2.4rem;
  transform: translate(-50%, -100%);
  pointer-events: none;
}
#place-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 600;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
#place-bar p { margin: 0 0 10px; text-align: center; }

.row { display: flex; gap: 10px; }
.row > button { flex: 1; }

/* Bottom sheets */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.2);
  max-width: 560px;
  margin: 0 auto;
}
.sheet h2 { margin: 0 40px 6px 0; }
.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--line);
  color: var(--ink);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
}
#d-summary { margin: 0 0 10px; color: var(--muted); }

.chips { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: #e8f6ee; color: var(--green-dark); border-radius: 999px; padding: 4px 10px; font-size: 0.9rem; }

.rate-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.rate-box p { margin: 0 0 6px; color: var(--muted); }

.star-input { display: flex; gap: 4px; }
.star-input button {
  background: none;
  color: var(--line);
  font-size: 2rem;
  padding: 0 4px;
  line-height: 1;
}
.star-input button.on { color: var(--amber); }
.star-input button:disabled { cursor: default; }

form label { display: block; font-weight: 600; margin-bottom: 12px; }
form input[type="text"], form input:not([type]) {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
}
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }

.segmented { display: flex; gap: 6px; }
.segmented label {
  flex: 1;
  margin: 0;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 4px;
  font-weight: 500;
}
.segmented input { position: absolute; opacity: 0; }
.segmented label:has(input:checked) { background: var(--green); color: #fff; border-color: var(--green); }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.checks label { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 6px; }

form button[type="submit"] { width: 100%; margin-top: 6px; }
.error { color: #b3261e; margin: 0 0 8px; }

/* User location dot */
.me-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2b7bff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(43, 123, 255, 0.25);
}
