:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #231a15;
  --muted: #6f625a;
  --line: #eadfd2;
  --brand: #c63f26;
  --brand-ink: #8f2a17;
  --brand-soft: #fbe6df;
  --ok: #2f7d4f;
  --bad: #b3261e;
  --focus: #1f6feb;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(35 26 21 / 8%), 0 4px 14px rgb(35 26 21 / 6%);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}

h1, h2, h3, p { margin: 0; }

button, input, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 1.35rem; line-height: 1.2; font-weight: 800; white-space: nowrap; }
.top .ghost { padding: 6px 12px; font-size: 0.85rem; }
.top h1 span { color: var(--brand); }
.tagline { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* ---------- buttons ---------- */

.chip, .ghost, .primary, .fab {
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.chip { background: var(--card); padding: 6px 14px; font-size: 0.9rem; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.ghost { background: var(--card); padding: 8px 14px; font-size: 0.9rem; color: var(--ink); }
.ghost:hover, .chip:hover { border-color: var(--muted); }
.small { padding: 5px 12px; font-size: 0.85rem; }
.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  padding: 10px 22px; font-weight: 700;
}
.primary:disabled { opacity: 0.6; cursor: progress; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand-ink); text-decoration: underline; cursor: pointer; }

.fab {
  position: fixed; z-index: 5;
  inset-inline-start: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--brand); border-color: var(--brand); color: #fff;
  padding: 12px 20px; font-weight: 700; font-size: 1rem;
  box-shadow: 0 6px 20px rgb(198 63 38 / 35%);
}

/* ---------- layout ---------- */

.map-pane { position: relative; }
.map { height: 46vh; min-height: 260px; background: #e9e4dc; }
.map-off { padding: 24px 16px; color: var(--muted); text-align: center; }
.chip-float { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2; box-shadow: var(--shadow); }

.list-pane { padding: 14px 16px 96px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.status { color: var(--muted); font-size: 0.9rem; margin: 10px 0; }

@media (min-width: 900px) {
  body { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
  .layout { display: grid; grid-template-columns: 420px 1fr; min-height: 0; }
  .list-pane { overflow-y: auto; border-inline-end: 1px solid var(--line); }
  .map-pane { order: 2; }
  .map { height: 100%; }
}

/* ---------- spot cards ---------- */

.spots { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.spot {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
  scroll-margin: 12px;
}
.spot.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow); }
.spot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.spot-name { font-size: 1.1rem; font-weight: 800; }
.price { color: var(--brand-ink); font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.meta { color: var(--muted); font-size: 0.9rem; }
.items { list-style: none; margin: 8px 0 0; padding: 0; }
.items li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--line); }
.dish-price { font-weight: 600; white-space: nowrap; }
.checked { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.spot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- map bits ---------- */

.popup { display: grid; gap: 2px; font: 14px/1.5 system-ui, "Segoe UI", Tahoma, sans-serif; text-align: right; }
.here-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--focus); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgb(31 111 235 / 20%);
}

/* ---------- footer ---------- */

.foot {
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: 0.8rem;
  border-top: 1px solid var(--line);
}
@media (min-width: 900px) {
  .foot { padding: 10px 16px; display: flex; justify-content: space-between; }
  .fab { bottom: 60px; } /* sit above the footer bar */
}

/* ---------- form dialog ---------- */

dialog {
  width: min(560px, 100% - 24px); max-height: 92dvh;
  border: 0; border-radius: 18px; padding: 0;
  background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgb(35 26 21 / 30%);
}
dialog::backdrop { background: rgb(35 26 21 / 45%); }
dialog form, .thanks { display: grid; gap: 12px; padding: 20px; }
dialog h2 { font-size: 1.25rem; font-weight: 800; }
.hint { color: var(--muted); font-size: 0.85rem; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 0.95rem; }
label small { font-weight: 400; color: var(--muted); }
input, textarea {
  width: 100%; padding: 10px 12px; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
input::placeholder, textarea::placeholder { color: #a8998e; }
[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 2px rgb(179 38 30 / 15%); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.where { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; display: grid; gap: 8px; margin: 0; }
.where legend { font-weight: 600; padding: 0 4px; }
.where .ghost { justify-self: start; }
.here-status { font-size: 0.85rem; color: var(--ok); }
.form-error { color: var(--bad); font-weight: 600; font-size: 0.9rem; }
.form-error:empty { display: none; }
.actions { display: flex; gap: 10px; }
.thanks { text-align: center; justify-items: center; padding: 32px 20px; }
.thanks .big { font-size: 1.4rem; font-weight: 800; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.notfound { display: grid; gap: 12px; justify-items: center; text-align: center; padding-top: 15vh; }

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