/* TrafCon editor. The map is the page; everything else is laid on top of
   it in small panels of frosted glass that stay out of the way of the
   roads.

   Every colour is a token, declared twice: once for daylight and once for
   the dark. Nothing below the token block names a colour directly, so the
   night theme cannot drift away from the day one -- a colour added to one
   has nowhere to go but both. The map's own colours are NOT here: the
   drawing runs in a worker that has no stylesheet to read, so its palettes
   live in js/map.js and js/render.js and travel as data. */
:root {
  color-scheme: light;
  /* A near-white ground, sage blocks, and one deep green that means "this is
     the action". Nothing else carries colour, so the map always wins the eye. */
  --ink: #1b1e1b;
  --muted: #6b716b;
  --line: #e4e8e4;
  --line-strong: #d3d9d3;
  --card: #ffffff;
  --bg: #f7f8f6;
  --accent: #35694a;
  --accent-ink: #ffffff;
  --accent-soft: #e9f0ea;   /* the tint an active tab or tool takes */
  --accent-dark: #2b5740;
  --brand: #5b3f8c;         /* the logo's colour. Not ours to change. */
  --warn: #c0492f;
  --ok: #35694a;
  --edited: #c8822e;

  /* the glass: what a panel is made of over a moving map */
  --glass: rgba(255, 255, 255, .82);
  --glass-solid: #ffffff;   /* where a panel must be opaque: a sticky row, a menu */
  --edge: rgba(255, 255, 255, .9);
  --hi: rgba(255, 255, 255, .85);
  --blur: 20px;             /* one place to step the blur down if a pan drops a frame */

  --chip: #f1efe9;          /* a pill, a tab strip, an empty bar */
  --hover: #f4f6f3;
  --field: #ffffff;
  --field-bg: #f7f9f7;
  --sel: #eef4fd;           /* the row you are on */
  --edited-bg: #fbe8d7;
  --edited-ink: #8a4b12;
  --ok-bg: #dcefe3;
  --ok-ink: #24583c;
  --warn-bg: #f8dcd6;
  --warn-ink: #8a2a1b;
  --xsec-edge: #cfc9bd;
  --toast-bg: #1b1e1b;
  --toast-ink: #ffffff;
  --hint-bg: rgba(35, 38, 43, .86);
  --hint-ink: #ffffff;
  --scrim: rgba(30, 30, 40, .35);
  --credit-bg: #1d1f22;
  --credit-ink: #ffffff;

  --shadow: 0 1px 2px rgba(23, 30, 24, .06), 0 6px 20px rgba(23, 30, 24, .10);
  --radius: 14px;
}

/* Near-black, because the ground behind it is (basemap-dark.json). The
   glass goes darker than the panels it floats over rather than lighter:
   lightening it would put a grey fog over the roads, which are the only
   bright thing on a night map and the whole reason for looking. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9eaec;
  --muted: #9aa0a8;
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .18);
  --card: #1a1c21;
  --bg: #0f1012;
  --accent: #4fae78;
  --accent-ink: #0d1510;
  --accent-soft: rgba(79, 174, 120, .18);
  --accent-dark: #5cc086;
  --brand: #b49ae0;
  --warn: #e07a66;
  --ok: #4fae78;
  --edited: #d99a46;

  --glass: rgba(24, 26, 30, .76);
  --glass-solid: #1a1c21;
  --edge: rgba(255, 255, 255, .10);
  --hi: rgba(255, 255, 255, .06);

  --chip: rgba(255, 255, 255, .07);
  --hover: rgba(255, 255, 255, .06);
  --field: #202329;
  --field-bg: #1c1f24;
  --sel: rgba(100, 165, 255, .16);
  --edited-bg: rgba(217, 154, 70, .18);
  --edited-ink: #e2ab62;
  --ok-bg: rgba(79, 174, 120, .18);
  --ok-ink: #6cc893;
  --warn-bg: rgba(224, 122, 102, .18);
  --warn-ink: #ec9280;
  --xsec-edge: #3a3f46;
  --toast-bg: #e9eaec;
  --toast-ink: #15171a;
  --hint-bg: rgba(12, 14, 17, .9);
  --hint-ink: #e9eaec;
  --scrim: rgba(0, 0, 0, .55);
  --credit-bg: #e9eaec;
  --credit-ink: #15171a;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 28px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  /* Onest, vendored and declared in the page itself; the system's own font
     behind it, which has every Kazakh letter should the download fail. */
  font: 13px/1.45 Onest, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Noto Sans", sans-serif;
  color: var(--ink); background: var(--bg); overflow: hidden;
}
#map { position: absolute; inset: 0; }

/* A panel: frosted, with a hairline of light along its edge. The blur is
   a token, so if a pan ever drops a frame it is turned down in one place
   rather than hunted through the file. */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
}
/* A browser with no backdrop-filter gets a solid panel, not a see-through
   one: half-transparent words over a map are unreadable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card { background: var(--card); }
}
[hidden] { display: none !important; }

.btn {
  font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 6px 11px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .12s;
}
.btn:hover { border-color: var(--line-strong); background: var(--hover); }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--warn); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.icon { width: 30px; height: 28px; padding: 0; display: grid; place-items: center; font-size: 14px; line-height: 1; }

.seg { display: inline-flex; background: var(--chip); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-weight: 600; font-size: 12px; border: 0; background: transparent; padding: 4px 9px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

/* top left */
#top { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; max-width: calc(100vw - 24px - 280px); }
.brand { font-weight: 800; letter-spacing: -.01em; color: var(--brand); padding: 0 6px 0 4px; text-decoration: none; }
#place-box { position: relative; }
#place { font-weight: 600; white-space: nowrap; }
#place::after { content: "▾"; margin-left: 6px; color: var(--muted); font-size: 11px; }
#places { position: absolute; top: calc(100% + 6px); left: 0; min-width: 200px; padding: 4px; z-index: 6; }
#places a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
#places a:hover { background: var(--hover); }
#places .sub { color: var(--muted); font-size: 12px; }
#places .sub2 { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px 2px; }
#search-box { position: relative; }
#search { font: inherit; width: 340px; max-width: 42vw; border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; background: var(--field-bg); color: var(--ink); }
#search:focus { outline: 3px solid color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); background: var(--field); }
#search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 50vh; overflow: auto; padding: 4px; z-index: 5; }
#search-results button { display: block; width: 100%; text-align: left; font: inherit; border: 0; background: none; padding: 7px 9px; border-radius: 8px; cursor: pointer; color: var(--ink); }
#search-results button:hover, #search-results button.on { background: var(--hover); }
#search-results .sub { color: var(--muted); font-size: 12px; }

/* top right */
#account { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; }
#me { display: flex; align-items: center; gap: 6px; }
#me-name { font-weight: 600; }
#online {
  color: var(--muted); font-size: 12px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* left: the tools */
#tools { position: absolute; top: 66px; left: 12px; display: flex; flex-direction: column; gap: 2px; padding: 6px; }
#tools button { font: inherit; font-weight: 500; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 10px; border-radius: 9px; cursor: pointer; text-align: left; color: var(--ink); }
#tools button:hover { background: var(--hover); }
#tools button.on { background: var(--accent); color: var(--accent-ink); }
#tools button .key { margin-left: auto; font-size: 11px; color: var(--muted); padding-left: 10px; }
#tools button.on .key { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
#tools hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* right: the inspector */
#inspector { position: absolute; top: 66px; right: 12px; bottom: 56px; width: 340px; overflow: auto; padding: 16px 16px 14px; }
.x { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.x:hover { background: var(--hover); }
.insp-title { font-size: 17px; font-weight: 700; padding-right: 28px; }
.insp-kk { font-size: 17px; font-weight: 700; }
.insp-second { color: var(--muted); font-size: 13px; margin-top: 1px; }
.insp-sub { color: var(--muted); margin: 4px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 12px; }
.chip { font-size: 12px; background: var(--chip); border-radius: 99px; padding: 2px 9px; }
.chip.edited { background: var(--edited-bg); color: var(--edited-ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.insp h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; }
.kv .k { color: var(--muted); }
.xsec { display: flex; height: 22px; border-radius: 5px; overflow: hidden; border: 1px solid var(--xsec-edge); margin: 6px 0 2px; }
.xsec i { flex: 1; display: block; border-right: 1px dashed rgba(255,255,255,.7); position: relative; }
.xsec i:last-child { border-right: 0; }
.xsec i.car { background: #c8cec8; } .xsec i.bus, .xsec i.brt { background: #b4786a; } .xsec i.median { background: #a9c0a2; flex: 1.6; }
.xsec i.parking { background: #cfcfcf; } .xsec i.bike { background: #79b394; flex: .6; } .xsec i.tram { background: #9c928a; }
.xsec i::after { content: attr(data-d); position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 700; }
/* the cross-section is a picture OF the road, so its lanes keep the road's
   own colours -- the night palette, on a night map */
:root[data-theme="dark"] .xsec i.car { background: #3e424a; }
:root[data-theme="dark"] .xsec i.bus, :root[data-theme="dark"] .xsec i.brt { background: #7c4c42; }
:root[data-theme="dark"] .xsec i.median { background: #2d4433; }
:root[data-theme="dark"] .xsec i.parking { background: #34373d; }
:root[data-theme="dark"] .xsec i.bike { background: #3f8a62; }
:root[data-theme="dark"] .xsec i.tram { background: #4b4742; }
.arms { display: flex; flex-direction: column; gap: 6px; }
.arm { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.arm .moves { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.arm .mv { font-size: 12px; background: var(--chip); border-radius: 6px; padding: 1px 6px; }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.hist { display: flex; flex-direction: column; gap: 6px; }
.hist .h { border-left: 3px solid var(--line); padding-left: 8px; }
.hist .h .when { color: var(--muted); font-size: 12px; }

/* bottom left */
#layers-wrap { position: absolute; left: 12px; bottom: 14px; display: flex; flex-direction: column-reverse; gap: 8px; align-items: flex-start; }
#layers-btn { border: 0; }
#layers { padding: 12px 14px; width: 270px; }
#layers label { display: flex; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; }
#layers select { font: inherit; margin-top: 4px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--field); color: var(--ink); }
#layers .sub2 { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* bottom centre: what is on the screen */
#status { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 6px 14px; color: var(--muted); font-size: 12px; white-space: nowrap; max-width: calc(100vw - 420px); overflow: hidden; text-overflow: ellipsis; }
#status b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
#status .dim { opacity: .65; }
#toast { position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-ink); padding: 8px 14px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow); max-width: 70vw; z-index: 9; }

dialog#login { border: 0; border-radius: 18px; box-shadow: var(--shadow); padding: 20px 22px; width: 320px; background: var(--card); color: var(--ink); }
dialog#login::backdrop { background: var(--scrim); }
dialog#login h2 { margin: 0 0 12px; font-size: 18px; }
dialog#login label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; color: var(--muted); }
dialog#login input { font: inherit; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: var(--ink); background: var(--field); }
dialog#login .row { justify-content: flex-end; margin-top: 6px; }
.error { color: var(--warn); margin: 4px 0; }

.maplibregl-ctrl-bottom-right { bottom: 6px; right: 6px; }
/* the data's credit: an (i), closed until asked */
.tc-credit { display: flex; align-items: flex-end; gap: 6px; }
.tc-credit button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--credit-bg); color: var(--credit-ink); font: 700 13px/22px Georgia, serif; cursor: pointer; padding: 0; }
.tc-credit-box { max-width: min(320px, 70vw); padding: 6px 10px; font-size: 12px; color: var(--muted); }
.tc-credit-box a { color: inherit; }
/* the map library's own controls, in whichever theme is on */
.maplibregl-ctrl-group { background: var(--glass) !important; border: 1px solid var(--edge); box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }

@media (max-width: 760px) {
  #top { max-width: calc(100vw - 24px); flex-wrap: wrap; }
  #search { width: 100%; max-width: none; }
  #search-box { flex: 1 1 100%; }
  #account { top: auto; bottom: 12px; right: 58px; }
  /* above the bottom row of controls, and no taller than what it says */
  #inspector { width: auto; left: 12px; top: auto; bottom: 64px; height: auto; max-height: 45vh; }
  body:has(#inspector:not([hidden])) .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none; }
  #status { display: none; }
}

/* the tools' own panel, bottom centre */
#toolpanel { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); padding: 12px 14px; max-width: min(760px, calc(100vw - 24px)); z-index: 3; }
#toolpanel.builder { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
#toolpanel .pb-prev { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
#toolpanel .pb-prev .xsec { width: 180px; margin: 0; }
.pb-read { display: flex; flex-direction: column; }
.pb-read span { color: var(--muted); font-size: 12px; }
.pb-read code { font-size: 11px; }
.pb-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pb-row > label { color: var(--muted); font-size: 12px; min-width: 64px; }
.pb-step { display: flex; align-items: center; gap: 6px; }
.pb-step .btn { padding: 2px 9px; }
.pb-check { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.seg button:disabled { opacity: .35; cursor: default; }
.tp-title { font-weight: 700; margin-bottom: 8px; }
.tp-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.tp-row input:not([type=checkbox]) { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--field); color: var(--ink); }
#toolhint { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); background: var(--hint-bg); color: var(--hint-ink); font-size: 12px; padding: 5px 12px; border-radius: 99px; pointer-events: none; z-index: 2; }

/* the inspector's forms */
.f { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 5px 0; }
.f > span { color: var(--muted); min-width: 92px; }
.f input:not([type=checkbox]), .f select { font: inherit; flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--field); color: var(--ink); }
.f.checks { justify-content: flex-start; flex-wrap: wrap; gap: 12px; }
.f.checks label { display: flex; gap: 5px; align-items: center; }
.lane-row { display: grid; grid-template-columns: 48px 1fr 64px 28px; gap: 5px; margin: 4px 0; }
.lane-row select, .lane-row input { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 3px 5px; min-width: 0; background: var(--field); color: var(--ink); }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; margin-top: 10px; }
.row.sticky { position: sticky; bottom: -14px; background: var(--glass-solid); padding: 10px 0 2px; border-top: 1px solid var(--line); }
.revert { padding: 0 5px; font-size: 13px; color: var(--edited); }
.builder-inline { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.builder-inline .pb-prev .xsec { width: 100%; }

/* the intersection tool */
.tabs { display: flex; gap: 2px; background: var(--chip); border-radius: 10px; padding: 2px; margin: 10px 0 6px; }
.tabs button { flex: 1; font: inherit; font-size: 12px; font-weight: 600; border: 0; background: transparent; padding: 6px 4px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.banner { background: var(--edited-bg); color: var(--edited-ink); border-radius: 10px; padding: 7px 9px; margin: 6px 0; font-size: 12px; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
.items { display: flex; flex-direction: column; gap: 3px; max-height: 32vh; overflow: auto; }
.item { display: grid; grid-template-columns: 52px 72px 1fr auto; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.item:hover { background: var(--hover); }
.item.on { border-color: var(--accent); background: var(--sel); }
.item .code { font-weight: 700; font-variant-numeric: tabular-nums; }
.item .lab { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.mv.on { background: var(--warn); color: #fff; }
.note.warn { color: var(--warn); }
.styled { border-top: 1px solid var(--line); margin-top: 10px; }
#imt-comment { font: inherit; flex: 1 1 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--field); color: var(--ink); }

/* the review drawer */
#review { position: absolute; top: 66px; left: 190px; bottom: 56px; width: 320px; overflow: auto; padding: 14px; z-index: 2; }
#review .row b { font-size: 15px; }
#review .x { position: static; }
.bar { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar.small { height: 5px; flex: 1; margin: 0 8px; }
.dist { display: flex; align-items: center; font-size: 12px; margin: 3px 0; }
.dist span:first-child { width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist .n { color: var(--muted); width: 54px; text-align: right; }
.kinds { display: flex; flex-wrap: wrap; gap: 4px; }
.kinds .chip { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: 12px; }
.kinds .chip.on { border-color: var(--accent); background: var(--sel); }
.issues { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; max-height: 36vh; overflow: auto; }
.iss { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.iss:hover { background: var(--hover); }
.iss.on { background: var(--sel); outline: 1px solid var(--accent); }
.iss .ty { font-weight: 600; min-width: 120px; }
.iss .id { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-light-lost, .ty-stale { color: var(--warn); }
.ty-join { color: var(--accent); }

.map-pages { display: flex; gap: 12px; font-size: 12px; }
.map-pages a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.map-pages a:hover { color: var(--accent); }
body.embedded #top, body.embedded #account, body.embedded #tools,
body.embedded #layers-wrap, body.embedded #status { display: none; }
body.embedded #inspector { top: 12px; max-height: calc(100% - 24px); }
@media (max-width: 720px) { .map-pages { gap: 8px; font-size: 11px; } }
#status:empty { display: none; }
/* Live blur over a repainting canvas costs a frame on slower devices.
   The glass returns as soon as the camera settles. */
body.map-moving .card, body.map-moving .maplibregl-ctrl-group {
  background: var(--glass-solid) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* The map chrome follows the rounded, neutral glass of the reference. These
   overrides are scoped to the map so the admin keeps its own layout. */
.map-app {
  --ink: #1d1d1f;
  --muted: #5f6368;
  --line: rgba(0, 0, 0, .09);
  --line-strong: rgba(0, 0, 0, .14);
  --card: #ffffff;
  --bg: #f5f5f7;
  --accent: #1e9e48;
  --accent-ink: #ffffff;
  --accent-soft: rgba(30, 158, 72, .12);
  --accent-dark: #187d3b;
  --brand: #1e9e48;
  --glass: rgba(255, 255, 255, .72);
  --glass-solid: #ffffff;
  --edge: rgba(255, 255, 255, .9);
  --hi: rgba(255, 255, 255, .95);
  --chip: rgba(0, 0, 0, .06);
  --hover: rgba(0, 0, 0, .08);
  --field: #ffffff;
  --field-bg: rgba(255, 255, 255, .42);
  --blur: 26px;
  --radius: 22px;
  --shadow: 0 12px 34px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .08);
}
:root[data-theme="dark"] .map-app {
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .18);
  --card: #111113;
  --bg: #000000;
  --accent: #30d158;
  --accent-ink: #03250f;
  --accent-soft: rgba(48, 209, 88, .16);
  --accent-dark: #48df6c;
  --brand: #30d158;
  --glass: rgba(36, 36, 40, .6);
  --glass-solid: #1c1c1e;
  --edge: rgba(255, 255, 255, .16);
  --hi: rgba(255, 255, 255, .2);
  --chip: rgba(255, 255, 255, .09);
  --hover: rgba(255, 255, 255, .12);
  --field: #1c1c1e;
  --field-bg: rgba(255, 255, 255, .06);
  --shadow: 0 12px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
}
.map-app .card { border-radius: var(--radius); }
.map-app .btn {
  border-color: transparent;
  border-radius: 999px;
  background: var(--chip);
  padding: 9px 14px;
}
.map-app .btn:hover { background: var(--hover); }
.map-app .btn.icon { width: 38px; height: 38px; border-radius: 50%; padding: 0; }
.map-app .seg { gap: 2px; border-radius: 999px; padding: 4px; }
.map-app .seg button { border-radius: 999px; padding: 6px 10px; }
.map-app #top {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 50%;
  width: min(1120px, calc(100vw - 24px));
  max-width: none;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 999px;
}
.map-app .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 10px 8px 14px;
  color: var(--brand);
  font-size: 17px;
}
.map-app .brand-dots { display: inline-flex; gap: 3px; }
.map-app .brand-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.map-app .map-pages { gap: 2px; flex: none; font-size: 13px; }
.map-app .map-pages a, .map-app .map-pages button { padding: 8px 10px; border-radius: 999px; }
.map-app .map-pages a:hover { background: var(--chip); }
.map-app .map-pages button { font-size: inherit; }
.map-app #simulation { white-space: nowrap; }
.map-app #simulation-panel {
  position: absolute;
  z-index: 8;
  top: 68px;
  right: max(12px, calc((100vw - 1120px) / 2));
  width: min(320px, calc(100vw - 24px));
  padding: 14px 16px;
}
.map-app .simulation-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.map-app .simulation-head h2 { margin: 0; font-size: 17px; }
.map-app .simulation-note, .map-app .simulation-status { color: var(--muted); font-size: 12px; line-height: 1.45; }
.map-app .simulation-note { margin: 8px 0 12px; }
.map-app .simulation-modes { display: flex; width: 100%; padding: 3px; }
.map-app .simulation-modes button { flex: 1; min-width: 0; padding: 7px 8px; border: 0; border-radius: 999px; color: var(--ink); background: transparent; cursor: pointer; font: inherit; font-size: 12px; }
.map-app .simulation-modes button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 4px var(--lo); }
.map-app .simulation-status { margin: 10px 0 0; }
.map-app #place { border: 0; font-size: 13px; }
.map-app #search-box { flex: 1 1 150px; min-width: 120px; }
.map-app #search {
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--field-bg);
}
.map-app #search:focus { background: var(--field); }
.map-app #account {
  position: static;
  flex: none;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.map-app #lang button { padding: 6px 8px; font-size: 12px; }

@media (max-width: 860px) {
  .map-app #top {
    top: 8px;
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 22px;
  }
  .map-app .brand { padding-left: 8px; }
  .map-app .map-pages { gap: 0; font-size: 11px; }
  .map-app .map-pages a, .map-app .map-pages button { padding: 7px 6px; }
  .map-app #search-box { flex: 1 1 100%; }
  .map-app #account { margin-left: auto; }
  .map-app #simulation-panel { top: 116px; right: 12px; max-height: calc(100vh - 132px); }
  .map-app #tools { top: 104px; }
}
@media (max-width: 520px) {
  .map-app #top { justify-content: space-between; }
  .map-app .brand { gap: 5px; font-size: 15px; padding: 6px 2px 6px 4px; }
  .map-app .brand-dots { gap: 2px; }
  .map-app .brand-dots i { width: 6px; height: 6px; }
  .map-app #place { padding: 7px 8px; font-size: 12px; }
  .map-app .map-pages { order: 0; flex: none; }
  .map-app #search-box { order: 0; flex: 1 1 120px; }
  .map-app #account { gap: 2px; }
  .map-app #account .btn { padding: 7px 9px; font-size: 12px; }
  .map-app #account .btn.icon { width: 32px; height: 32px; }
  .map-app #lang { gap: 0; padding: 2px; }
  .map-app #lang button { padding: 5px 6px; font-size: 11px; }
  .map-app #simulation-panel { top: 112px; }
  .map-app #tools { top: 128px; }
}
