/*
 * KASKAL's map editors' site. The map fills the window; the tools sit on glass over it: a bar on top (search, the
 * day / night switch, the reviewer), a rail of tools on the right, a panel beside it. On a phone the rail is a bar at
 * the bottom and the panel a sheet over it. The colours are the admin panel's (deploy/web/admin/admin.css), both
 * themes; sizes 4 / 8 spacing, controls 44 px, text 16 / 14 / 12, two weights. Our own files only (strict policy).
 */

@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url("fonts/plex-400.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url("fonts/plex-600.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0c0e12;
  --glass: rgba(20, 23, 29, 0.74);
  --glass-strong: rgba(22, 25, 31, 0.9);
  --raised: rgba(255, 255, 255, 0.06);
  --raised-2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eceef2;
  --dim: #a4aab6;
  --faint: #737b8a;
  --accent: #8ea4ff;
  --accent-fill: #4a66ea;
  --accent-soft: rgba(110, 139, 255, 0.18);
  --on-accent: #ffffff;
  --good: #3ecf8e;
  --good-soft: rgba(62, 207, 142, 0.16);
  --warn: #f5b83d;
  --warn-soft: rgba(245, 184, 61, 0.16);
  --bad: #ff8588;
  --bad-soft: rgba(255, 133, 136, 0.16);
  --bad-fill: #c9353b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --rim: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --hit: 44px;
  --radius: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --rail: 68px;
  --panel: 380px;
}

:root[data-theme="day"] {
  color-scheme: light;
  --bg: #eef0f4;
  --glass: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.94);
  --raised: rgba(16, 20, 30, 0.05);
  --raised-2: rgba(16, 20, 30, 0.09);
  --line: rgba(16, 20, 30, 0.12);
  --text: #171a20;
  --dim: #596070;
  --faint: #7d8494;
  --accent: #2f4fd6;
  --accent-fill: #2f4fd6;
  --accent-soft: rgba(47, 79, 214, 0.12);
  --good: #0f7a52;
  --good-soft: rgba(15, 122, 82, 0.12);
  --warn: #8f5b00;
  --warn-soft: rgba(143, 91, 0, 0.12);
  --bad: #c2313a;
  --bad-soft: rgba(194, 49, 58, 0.1);
  --bad-fill: #c2313a;
  --shadow: 0 16px 40px rgba(20, 30, 60, 0.18);
  --rim: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 "Plex", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { font: 400 11px/1.4 "Plex", sans-serif; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--safe-bottom) + 4px); }
.maplibregl-ctrl-top-left { top: calc(var(--safe-top) + 80px); left: 4px; }
.maplibregl-ctrl-group { border-radius: 14px; overflow: hidden; background: var(--glass-strong); box-shadow: var(--shadow); }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
:root:not([data-theme="day"]) .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); }
body.locked .maplibregl-ctrl-top-left { display: none; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--rim);
}

.ic { width: 22px; height: 22px; fill: currentColor; flex: none; }
.ic.small { width: 18px; height: 18px; }
.ic.flip { transform: scaleX(-1); }

/* ------------------------------------------------------------------ the door */
.veil {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 600ms var(--ease);
  background:
    radial-gradient(1200px 700px at 30% 20%, rgba(74, 102, 234, 0.28), transparent 60%),
    radial-gradient(900px 600px at 80% 90%, rgba(62, 207, 142, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(8, 10, 14, 0.25), rgba(8, 10, 14, 0.7));
}
body.locked .veil { opacity: 1; }
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 30; }
.gate-card {
  width: min(440px, 100%); border-radius: 28px; padding: 32px 28px 22px; text-align: center;
  animation: rise 700ms var(--ease) both;
}
.gate-mark {
  width: 84px; height: 84px; margin: -2px auto 14px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(110, 139, 255, 0.35), rgba(74, 102, 234, 0.08));
  box-shadow: 0 0 0 1px rgba(142, 164, 255, 0.35), 0 10px 40px rgba(74, 102, 234, 0.45);
  animation: glow 3.2s ease-in-out infinite;
}
.gate h1 { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -0.2px; }
.gate-sub { margin: 0 0 22px; color: var(--dim); font-size: 15px; }
.gate-foot { margin: 18px 0 0; color: var(--faint); font-size: 12px; }
.google {
  width: 100%; min-height: 52px; border-radius: 16px; border: 0; display: flex; align-items: center;
  justify-content: center; gap: 12px; font-weight: 600; font-size: 16px;
  background: #fff; color: #1f2329; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.google:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); }
.google:active { transform: scale(0.98); }
.g-logo { width: 22px; height: 22px; }
.code-label { display: block; margin: 0 0 10px; color: var(--dim); font-size: 14px; }
.code {
  width: 100%; height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--raised);
  text-align: center; font: 600 24px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: 4px;
  direction: ltr; text-transform: uppercase; transition: border-color 160ms, box-shadow 160ms;
}
.code:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.code.shake { animation: shake 420ms; border-color: var(--bad); }
.gate .btn { width: 100%; margin-top: 12px; }
.gate-error {
  margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--bad-soft); color: var(--bad);
  font-size: 14px; animation: rise 300ms var(--ease) both;
}
.gate-who { margin: 0 0 14px; color: var(--dim); font-size: 14px; }
.link { background: none; border: 0; color: var(--accent); padding: 6px; font-size: 14px; }

/* ------------------------------------------------------------------ the frame */
.top {
  position: fixed; z-index: 10; top: calc(var(--safe-top) + 12px); inset-inline: 12px; height: 60px;
  border-radius: 20px; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 12px;
  animation: drop 500ms var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; padding-inline-start: 4px; }
.brand img { border-radius: 8px; }
.search { position: relative; flex: 1; max-width: 560px; margin-inline: auto; }
.search input {
  width: 100%; height: 44px; border-radius: 14px; border: 1px solid transparent; background: var(--raised);
  padding: 0 44px 0 14px; font-size: 16px; transition: border-color 160ms, background 160ms, box-shadow 160ms;
}
.search input:focus { outline: none; border-color: var(--accent); background: var(--raised-2); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-icon { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--dim); pointer-events: none; }
.results {
  position: absolute; top: 52px; inset-inline: 0; border-radius: 16px; padding: 6px; max-height: 60vh; overflow: auto;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise 220ms var(--ease) both;
}
.result {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: start; padding: 10px 12px;
  border: 0; border-radius: 12px; background: none;
}
.result:hover, .result.on { background: var(--raised-2); }
.result .t { font-weight: 600; }
.result .s { color: var(--dim); font-size: 13px; }
.result .ic { color: var(--accent); }
.top-end { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: var(--hit); height: var(--hit); border-radius: 14px; border: 0; background: var(--raised);
  display: grid; place-items: center; color: var(--text); transition: background 160ms, transform 160ms var(--ease);
}
.icon-btn:hover { background: var(--raised-2); }
.icon-btn:active { transform: scale(0.94); }
.me {
  height: var(--hit); border-radius: 14px; border: 0; background: var(--raised); padding: 0 12px 0 6px;
  display: flex; align-items: center; gap: 8px; max-width: 220px;
}
.me .av {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 600;
  background: linear-gradient(145deg, var(--accent-fill), #7b5cf0); color: #fff;
}
.me .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.role { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.rail {
  position: fixed; z-index: 9; top: calc(var(--safe-top) + 84px); inset-inline-start: 12px; width: var(--rail);
  border-radius: 22px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100vh - var(--safe-top) - 100px); overflow-y: auto; scrollbar-width: none;
  animation: slide-in 520ms var(--ease) 80ms both;
}
.tool {
  position: relative; height: 56px; border-radius: 16px; border: 0; background: none; color: var(--dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px;
  transition: background 160ms, color 160ms, transform 160ms var(--ease);
}
.tool:hover { background: var(--raised); color: var(--text); }
.tool:active { transform: scale(0.95); }
.tool.on { background: var(--accent-soft); color: var(--accent); }
.tool.on::before {
  content: ""; position: absolute; inset-inline-start: -5px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px;
  background: var(--accent);
}
.tool .dot {
  position: absolute; top: 6px; inset-inline-end: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--warn); color: #1d1300; font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.rail hr { width: 70%; border: 0; border-top: 1px solid var(--line); margin: 4px auto; }

.panel {
  position: fixed; z-index: 9; top: calc(var(--safe-top) + 84px); inset-inline-start: calc(12px + var(--rail) + 10px);
  width: var(--panel); max-height: calc(100vh - var(--safe-top) - 100px); border-radius: 22px; overflow: hidden;
  display: flex; flex-direction: column; animation: slide-in 380ms var(--ease) both;
}
.panel-body { overflow: auto; padding: 18px 18px 20px; overscroll-behavior: contain; }
.grab { display: none; }
.panel h2 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; }
.panel h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--dim); }
.panel p { margin: 6px 0; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.head { display: flex; align-items: flex-start; gap: 12px; }
.head .kind {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.head .x { margin-inline-start: auto; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fact { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--raised); color: var(--dim); }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--raised); margin: 14px 0 4px; }
.seg button {
  flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: none; color: var(--dim); font-size: 14px;
  transition: background 160ms, color 160ms;
}
.seg button.on { background: var(--glass-strong); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }

.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised);
  padding: 10px 14px; font-size: 16px; transition: border-color 160ms, box-shadow 160ms;
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input.big { font-size: 20px; font-weight: 600; min-height: 56px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: none;
  color: var(--dim); font-size: 13px; transition: background 160ms, color 160ms, border-color 160ms;
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent-fill); }

.btn {
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #5b76f2, var(--accent-fill)); color: var(--on-accent);
  box-shadow: 0 8px 22px rgba(74, 102, 234, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 160ms var(--ease), filter 160ms, box-shadow 160ms;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.quiet { background: var(--raised); color: var(--text); box-shadow: none; }
.btn.good { background: linear-gradient(180deg, #49d89a, #1fa56c); box-shadow: 0 8px 22px rgba(31, 165, 108, 0.3); }
.btn.danger { background: linear-gradient(180deg, #e2525a, var(--bad-fill)); box-shadow: 0 8px 22px rgba(201, 53, 59, 0.3); }
.btn.wide { width: 100%; margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1; }

.say {
  margin-top: 16px; padding: 14px; border-radius: 16px; background: var(--raised);
  display: flex; align-items: center; gap: 10px; font-size: 15px; animation: rise 260ms var(--ease) both;
}
.say .from { color: var(--faint); text-decoration: line-through; }
.say .to { font-weight: 600; color: var(--accent); }
.say .ic { color: var(--faint); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.approved { background: var(--accent-soft); color: var(--accent); }
.pill.live { background: var(--good-soft); color: var(--good); }
.pill.rejected { background: var(--bad-soft); color: var(--bad); }
.pill.withdrawn, .pill.gone { background: var(--raised); color: var(--faint); }
.pill.removed { background: var(--warn-soft); color: var(--warn); }

.card {
  border-radius: 16px; border: 1px solid var(--line); background: var(--raised); padding: 12px 14px; margin-top: 10px;
  transition: border-color 160ms, background 160ms, transform 160ms var(--ease); animation: rise 260ms var(--ease) both;
}
.card.click { cursor: pointer; }
.card.click:hover { border-color: var(--accent); background: var(--raised-2); }
.card .line1 { display: flex; align-items: center; gap: 8px; }
.card .what { font-weight: 600; overflow-wrap: anywhere; }
.card .meta { color: var(--faint); font-size: 12px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.card .acts { display: flex; gap: 6px; margin-top: 10px; }
.card .acts .btn { min-height: 38px; font-size: 13px; padding: 0 12px; flex: 1; }
.warnline { color: var(--warn); font-size: 12px; margin-top: 6px; }

.empty { text-align: center; padding: 28px 8px; color: var(--dim); }
.empty .ic { width: 40px; height: 40px; color: var(--faint); }

.big-n { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.big-n div { border-radius: 16px; background: var(--raised); padding: 12px; text-align: center; }
.big-n b { display: block; font-size: 26px; line-height: 1.2; }
.big-n span { font-size: 12px; color: var(--dim); }
.big-n .a b { color: var(--accent); }
.big-n .w b { color: var(--warn); }

.steps { list-style: none; margin: 16px 0 0; padding: 0; }
.steps li { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--faint); font-size: 14px; }
.steps li::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex: none;
  transition: background 300ms, border-color 300ms;
}
.steps li.done { color: var(--dim); }
.steps li.done::before { background: var(--good); border-color: var(--good); }
.steps li.now { color: var(--text); font-weight: 600; }
.steps li.now::before { border-color: var(--accent); background: var(--accent-soft); animation: ping 1.4s ease-out infinite; }
.steps li.fail::before { background: var(--bad); border-color: var(--bad); }
.bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; margin-top: 12px; }
.bar > i {
  display: block; height: 100%; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-fill), var(--accent), transparent);
  animation: sweep 1.6s ease-in-out infinite;
}

.badge {
  position: fixed; z-index: 8; top: calc(var(--safe-top) + 84px); left: 0; right: 0; margin-inline: auto; width: max-content; padding: 10px 14px;
  border-radius: 14px; display: flex; align-items: center; gap: 8px; font-size: 13px; animation: drop 300ms var(--ease) both;
}
.badge .ic { color: var(--accent); }
.status {
  position: fixed; z-index: 8; bottom: calc(var(--safe-bottom) + 12px); left: 12px; font-size: 12px;
  color: var(--dim); background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); direction: ltr;
}

.toasts {
  position: fixed; z-index: 40; bottom: calc(var(--safe-bottom) + 24px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px;
  animation: rise 300ms var(--ease) both; max-width: min(92vw, 520px);
}
.toast.ok .ic { color: var(--good); }
.toast.bad .ic { color: var(--bad); }
.toast.out { animation: fade-out 260ms ease-in both; }

.ask { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(5, 7, 10, 0.5); animation: fade 200ms both; }
.ask-card { width: min(460px, 100%); border-radius: 24px; padding: 22px; background: var(--glass-strong); animation: pop 280ms var(--ease) both; }
.ask-card h2 { margin: 0 0 8px; font-size: 19px; }
.ask-card p { margin: 6px 0; color: var(--dim); }
.ask-row { display: flex; gap: 8px; margin-top: 18px; }
.ask-row .btn { flex: 1; }

.pin-at { width: 34px; height: 44px; display: grid; place-items: start center; pointer-events: none; }
.pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  background: linear-gradient(145deg, #6f86ff, var(--accent-fill)); box-shadow: 0 10px 24px rgba(74, 102, 234, 0.55);
  animation: pin-drop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.pin::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #fff; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin-top: 12px; font-size: 14px; }
kbd {
  font: 600 12px/1 ui-monospace, Menlo, monospace; padding: 5px 8px; border-radius: 8px; background: var(--raised-2);
  border: 1px solid var(--line); direction: ltr; text-align: center;
}
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
/* ------------------------------------------------------------------ drawing and reshaping (shapes.js) */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 12px; }
.tbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px;
  padding: 8px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised); color: var(--text);
  font-size: 12.5px; line-height: 1.3; text-align: center; transition: background 160ms, border-color 160ms, transform 120ms;
}
.tbtn .ic { color: var(--accent); }
.tbtn:hover { background: var(--raised-2); border-color: var(--accent); }
.tbtn:active { transform: scale(0.96); }
.tbtn.danger .ic { color: var(--bad); }
.tbtn.danger:hover { border-color: var(--bad); }
.tbtn.off { opacity: 0.45; pointer-events: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 78px; padding: 10px 6px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--raised); color: var(--text); font-size: 12.5px;
  line-height: 1.3; text-align: center; transition: background 160ms, border-color 160ms, transform 120ms;
}
.tile .ic { width: 26px; height: 26px; color: var(--accent); }
.tile:hover { background: var(--raised-2); border-color: var(--accent); }
.tile:active { transform: scale(0.96); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; vertical-align: -1px; }
.swatch.f-road { background: #8ea4ff; } .swatch.f-rail { background: #b0a4d8; } .swatch.f-waterway, .swatch.f-water { background: #4fa3f7; }
.swatch.f-green { background: #4cc38a; } .swatch.f-land { background: #d6b46b; } .swatch.f-building { background: #e5a77a; }
.swatch.f-poi { background: #f08fb0; } .swatch.f-house { background: #c9ced8; }
.chips.fams { margin-top: 10px; }
.field select, .field input[type="number"] {
  width: 100%; min-height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised);
  padding: 8px 12px; font-size: 15px; color: var(--text);
}
.field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
details.more { margin-top: 12px; border-radius: 14px; border: 1px solid var(--line); padding: 2px 12px 12px; }
details.more > summary { cursor: pointer; padding: 12px 0 6px; color: var(--dim); font-size: 13.5px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; color: var(--accent); }
details.more[open] > summary::before { content: "− "; }
.drawbar {
  position: fixed; z-index: 25; inset-inline: 0; margin-inline: auto; width: max-content; bottom: calc(var(--safe-bottom) + 18px);
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 20px; max-width: calc(100vw - 24px);
  animation: rise 300ms var(--ease) both;
}
.drawbar .tip { display: flex; flex-direction: column; min-width: 0; padding-inline-end: 6px; }
.drawbar .tip b { font-size: 14px; }
.drawbar .tip span { font-size: 12.5px; color: var(--dim); }
.drawbar .btn { min-height: 40px; padding: 0 12px; font-size: 13px; white-space: nowrap; }

@keyframes glow { 50% { box-shadow: 0 0 0 1px rgba(142, 164, 255, 0.5), 0 10px 56px rgba(74, 102, 234, 0.7); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(142, 164, 255, 0.55); } 100% { box-shadow: 0 0 0 12px rgba(142, 164, 255, 0); } }
@keyframes sweep { from { transform: translateX(-120%); } to { transform: translateX(260%); } }
@keyframes pin-drop { from { opacity: 0; transform: translateY(-40px) rotate(-45deg); } to { opacity: 1; transform: rotate(-45deg); } }

/* ------------------------------------------------------------------ phones */
@media (max-width: 767px) {
  :root { --panel: 100%; }
  .top { inset-inline: 8px; top: calc(var(--safe-top) + 8px); height: 56px; gap: 8px; }
  .brand span, .me .n, .me .role { display: none; }
  .me { padding: 0 6px; }
  .rail {
    top: auto; bottom: calc(var(--safe-bottom) + 8px); inset-inline: 8px; width: auto; height: 64px;
    flex-direction: row; justify-content: space-around; padding: 4px; border-radius: 20px;
  }
  .rail hr { display: none; }
  .rail { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .tool { flex: 1 0 58px; height: 54px; }
  .drawbar { bottom: calc(var(--safe-bottom) + 84px); flex-wrap: wrap; justify-content: center; }
  .drawbar .tip { flex-basis: 100%; text-align: center; padding: 0 0 4px; }
  .tool.on::before { inset-inline-start: 25%; inset-inline-end: 25%; top: -4px; bottom: auto; width: auto; height: 3px; }
  .panel {
    top: auto; inset-inline: 8px; bottom: calc(var(--safe-bottom) + 80px); width: auto; max-height: 58vh;
    border-radius: 22px; animation: rise 360ms var(--ease) both;
  }
  .panel.tall { max-height: calc(100vh - var(--safe-top) - 160px); }
  .grab { display: block; width: 100%; height: 22px; border: 0; background: none; position: relative; flex: none; }
  .grab::after {
    content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 4px; border-radius: 2px;
    transform: translateX(-50%); background: var(--line);
  }
  .panel-body { padding-top: 4px; }
  .badge { top: calc(var(--safe-top) + 72px); max-width: calc(100vw - 16px); }
  .maplibregl-ctrl-top-left { display: none; }
  .status { display: none; }
  .toasts { bottom: calc(var(--safe-bottom) + 92px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
