:root {
  --night: #161a33;
  --night-2: #20264a;
  --night-3: #2b3260;
  --ink: #f3ead8;
  --muted: #aaa6c4;
  --saffron: #e8a93a;
  --sadu-red: #a3282b;
  --sadu-cream: #efe3cc;
  --ok: #7fc8a0;
  --sadu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16'%3E%3Crect width='32' height='16' fill='%23141414'/%3E%3Cpath d='M0 16 8 3 16 16Z' fill='%23a3282b'/%3E%3Cpath d='M16 16 24 3 32 16Z' fill='%23efe3cc'/%3E%3Cpath d='M5 16 8 11 11 16Z' fill='%23e8a93a'/%3E%3Cpath d='M21 16 24 11 27 16Z' fill='%23a3282b'/%3E%3Crect y='0' width='32' height='2' fill='%23efe3cc'/%3E%3C/svg%3E");
  font-family: "Alexandria", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--night); color: var(--ink); }
body { min-height: 100dvh; display: flex; flex-direction: column; font-size: 15px; line-height: 1.6; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.masthead { position: relative; z-index: 2; background: var(--night); padding: 0 16px 10px; }
.sadu { height: 16px; margin: 0 -16px 10px; background: var(--sadu) repeat-x; }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 34px; line-height: 1.2; color: var(--sadu-cream); }
.city select {
  appearance: none; background: var(--night-2); border: 1px solid var(--night-3); border-radius: 999px;
  padding: 7px 34px 7px 14px; font-size: 14px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--saffron) 50%), linear-gradient(135deg, var(--saffron) 50%, transparent 50%);
  background-position: 16px 50%, 11px 50%; background-size: 5px 5px; background-repeat: no-repeat;
}

.search { display: flex; gap: 8px; margin-top: 10px; }
.search input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--night-3);
  background: var(--night-2); font-size: 16px;
}
.search input::placeholder { color: var(--muted); }
.go {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 92px; padding: 6px 14px;
  border: 0; border-radius: 12px; background: var(--saffron); color: #241a05; font-weight: 700; cursor: pointer; line-height: 1.25;
}
.go:disabled { opacity: .55; cursor: progress; }
.go-price { font-size: 11px; font-weight: 600; opacity: .8; }
.go-price:empty { display: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--night-3); background: transparent;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { border-color: var(--saffron); color: var(--saffron); }

main { flex: 1; display: flex; flex-direction: column; }
.map-wrap { position: relative; height: 42dvh; min-height: 240px; }
#map { position: absolute; inset: 0; background: #0f1226; }
.maplibregl-ctrl-attrib { font-size: 9px; }
.locate {
  position: absolute; z-index: 500; inset-inline-start: 12px; bottom: 26px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--night-3); background: rgba(22, 26, 51, .92); font-size: 13px; cursor: pointer;
}
.pin {
  cursor: pointer;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--saffron); border: 2px solid var(--night); box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.pin span { transform: rotate(45deg); color: #241a05; font-weight: 700; font-size: 12px; }
.pin.active { background: var(--sadu-red); }
.you { width: 16px; height: 16px; border-radius: 50%; background: var(--sadu-red); border: 3px solid var(--sadu-cream); box-shadow: 0 0 0 6px rgba(163, 40, 43, .3); }
.pin.active span { color: var(--sadu-cream); }

.sheet {
  position: relative; z-index: 3; margin-top: -18px; flex: 1; padding: 18px 16px 24px;
  background: var(--night); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}
.sheet::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: var(--night-3); margin: -8px auto 14px; }
.intro p { margin: 0; color: var(--muted); max-width: 46ch; }
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 6px 0 12px; }
.status::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--night-3); border-top-color: var(--saffron); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { border: 1px solid rgba(232, 169, 58, .45); background: rgba(232, 169, 58, .08); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.error p { margin: 0 0 8px; }
.error p:last-child { margin: 0; }
.error-action { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 0; background: var(--saffron); color: #241a05; font-weight: 700; text-decoration: none; cursor: pointer; }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.result {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px 6px;
  border-bottom: 1px solid var(--night-2); cursor: pointer; text-align: start; background: none; border-inline: 0; border-top: 0; width: 100%;
}
.result:hover, .result.active { background: var(--night-2); border-radius: 10px; }
.rank { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--night-2); color: var(--saffron); font-weight: 700; font-size: 14px; }
.result.active .rank { background: var(--sadu-red); color: var(--sadu-cream); }
.r-name { font-weight: 600; font-size: 16px; line-height: 1.35; }
.r-meta { color: var(--muted); font-size: 13px; }
.r-side { text-align: end; font-size: 13px; white-space: nowrap; }
.stars { color: var(--saffron); font-weight: 600; }
.dist { color: var(--muted); display: block; }
.empty { color: var(--muted); padding: 8px 0; }
.last-search { color: var(--muted); font-size: 13px; margin: 0 0 6px; }

.detail h2 { margin: 4px 0 2px; font-size: 22px; line-height: 1.3; }
.back { background: none; border: 0; color: var(--saffron); padding: 0; cursor: pointer; font-size: 14px; }
.d-meta { color: var(--muted); margin: 0 0 12px; }
.d-rating { display: flex; align-items: baseline; gap: 8px; margin: 10px 0; }
.d-rating strong { font-size: 30px; color: var(--saffron); line-height: 1; }
.eta { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--night-2); }
.eta small { color: var(--muted); display: block; font-size: 12px; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.actions a, .actions button {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 10px; border-radius: 12px;
  border: 1px solid var(--night-3); background: var(--night-2); text-decoration: none; font-size: 14px; cursor: pointer;
}
.actions .primary { grid-column: 1 / -1; background: var(--saffron); border-color: var(--saffron); color: #241a05; font-weight: 700; font-size: 16px; }
.reviews-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 10px; }
.reviews-head h3 { margin: 0; font-size: 17px; }
.reviews-btn { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--saffron); background: none; color: var(--saffron); font-weight: 600; cursor: pointer; }
.reviews-btn:disabled { opacity: .55; cursor: progress; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.topics li { padding: 4px 10px; border-radius: 999px; background: var(--night-2); font-size: 13px; }
.topics b { color: var(--saffron); font-weight: 600; margin-inline-start: 4px; }
.review { padding: 12px 0; border-top: 1px solid var(--night-2); }
.review header { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.review header strong { color: var(--ink); font-weight: 600; }
.review p { margin: 6px 0 0; white-space: pre-line; max-width: 62ch; }

.credit { padding: 10px 16px 18px; color: var(--muted); font-size: 11px; text-align: center; }

@media (min-width: 900px) {
  body { display: grid; grid-template-columns: 420px 1fr; grid-template-rows: auto 1fr auto; height: 100dvh; }
  .masthead { grid-column: 1; grid-row: 1; }
  main { display: contents; }
  .map-wrap { grid-column: 2; grid-row: 1 / 4; height: auto; }
  .sheet { grid-column: 1; grid-row: 2; margin: 0; border-radius: 0; overflow-y: auto; box-shadow: none; }
  .sheet::before { display: none; }
  .credit { grid-column: 1; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) { .status::before { animation: none; } }
