:root {
  --ink: #2b1d14;
  --muted: #7a5b45;
  --glass: rgba(255, 247, 236, 0.72);
  --edge: rgba(120, 72, 30, 0.14);
  --accent: #e0703a;
  --shadow: 0 8px 30px rgba(90, 45, 10, 0.18);
}
body[data-theme="night"] {
  --ink: #e9ecff;
  --muted: #9aa3d6;
  --glass: rgba(14, 18, 40, 0.62);
  --edge: rgba(140, 160, 255, 0.16);
  --accent: #ff4fd8;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 14px/1.4 Inter, system-ui, sans-serif;
  color: var(--ink);
  background: #0b1020;
  -webkit-font-smoothing: antialiased;
}
body[data-theme="golden"] { background: #f3dcc0; }
#map { position: fixed; inset: 0; }

.panel {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
  transition: background .6s, color .6s, border-color .6s;
}

.brand {
  position: fixed; top: calc(16px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left));
  padding: 12px 18px; border-radius: 16px;
  pointer-events: none;
}
.eyebrow { display: block; margin-bottom: 2px; font: 600 10px/1 Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand h1 {
  margin: 0; font: 600 22px/1.1 Fraunces, Georgia, serif; letter-spacing: -.01em;
}
.brand h1 em { font-style: italic; font-weight: 500; color: var(--accent); transition: color .6s; }
.brand p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.controls {
  position: fixed; top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right));
  display: flex; gap: 8px;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  font: 500 13px Inter, sans-serif; color: var(--ink);
  cursor: pointer;
}
.pill:hover { border-color: var(--accent); }
.pill:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: transparent; }
.ico {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe2a8, #ff9a4a);
  box-shadow: 0 0 10px #ffb36b;
}
body[data-theme="golden"] .ico {
  background: radial-gradient(circle at 65% 35%, transparent 38%, #39407a 40%);
  box-shadow: none;
}

.places {
  position: fixed; left: 50%; bottom: calc(34px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 6px; border-radius: 999px;
}
.places-track {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  padding: 0 6px;
}
.places-track::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  border: 0; background: transparent; color: var(--ink);
  font: 500 13px Inter, sans-serif; padding: 9px 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; transition: background .2s, color .2s;
}
.chip:hover { background: var(--edge); }
.chip.active { background: var(--accent); color: #fff; }

.me { width: 18px; height: 18px; border-radius: 50%; background: #2f7bff; border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(47,123,255,.6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 16px rgba(47,123,255,0); } 100% { box-shadow: 0 0 0 0 rgba(47,123,255,0); } }
.pill:disabled { opacity: .55; cursor: progress; }

.toast {
  position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 6;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; font-size: 13px; text-align: center;
}

.tip {
  position: fixed; pointer-events: none; z-index: 5;
  padding: 8px 12px; border-radius: 10px; font-size: 12px;
  transform: translate(12px, 12px);
}
.tip b { display: block; font-size: 13px; font-weight: 600; }
.tip span { color: var(--muted); }

.loader {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: inherit; transition: opacity .8s; z-index: 10;
}
.loader span {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--edge); border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
.loader.done { opacity: 0; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.maplibregl-ctrl-group { background: var(--glass) !important; border: 1px solid var(--edge); box-shadow: var(--shadow) !important; border-radius: 12px !important; }
body[data-theme="night"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: var(--glass) !important; color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
body[data-theme="night"] .maplibregl-ctrl-attrib-button { filter: invert(1); }

.maplibregl-ctrl-top-right { top: calc(60px + env(safe-area-inset-top)); }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

@media (max-width: 640px) {
  .brand { padding: 10px 14px; }
  .brand h1 { font-size: 18px; }
  .controls { top: auto; bottom: 76px; right: 16px; flex-direction: column; }
  .places { left: 16px; right: 60px; bottom: calc(16px + env(safe-area-inset-bottom)); transform: none; max-width: none; }
  .controls { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .pill .lbl { display: none; }
  .pill { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .maplibregl-ctrl-top-right { top: env(safe-area-inset-top); }
  .brand { max-width: calc(100vw - 90px); }
  .tip { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .loader span { animation-duration: 3s; }
}

/* Short screens (phones in landscape): compact chrome so the map stays visible */
@media (max-height: 500px) {
  .brand { padding: 8px 12px; border-radius: 12px; }
  .brand h1 { font-size: 16px; }
  .brand p, .eyebrow { display: none; }
  .pill { height: 34px; padding: 0 12px; font-size: 12px; }
  .places { padding: 4px; bottom: calc(26px + env(safe-area-inset-bottom)); }
  .chip { padding: 6px 11px; font-size: 12px; }
  .maplibregl-ctrl-top-right { top: calc(52px + env(safe-area-inset-top)); }
}
