:root {
  --bg: #0d100e; --surface: #131815; --raised: #1a201c; --field: #0a0d0b;
  --line: #242c27; --line-strong: #34403a;
  --text: #e8ece6; --muted: #9ba79e; --faint: #66716a;
  --accent: #f5a524; --accent-ink: #1a1203; --accent-soft: #35280c;
  --danger: #ee5d57; --ok: #4ade80;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r: 3px; --target: 40px;
  --font: 'Fira Sans', system-ui, 'Segoe UI', sans-serif;
  --font-cond: 'Fira Sans Condensed', 'Fira Sans', system-ui, sans-serif;
  --t: 120ms ease-out;
  color-scheme: dark;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }
#app { height: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h2, h3, h4, h5 { margin: 0; font-weight: 600; text-wrap: balance; }
p, li, .muted, .caption, .lead, .hint, .empty { text-wrap: pretty; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.grow { flex: 1; }
.muted { color: var(--muted); margin: 0; } .small { font-size: 12px; }
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; } .ico svg { width: 100%; height: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- form controls ---------- */
input[type=text], input[type=search], textarea {
  appearance: none; background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 0 var(--s3); width: 100%; height: 38px; transition: border-color var(--t);
}
textarea { height: auto; padding: var(--s2) var(--s3); resize: none; line-height: 1.4; }
input[type=text]:hover, input[type=search]:hover, textarea:hover { border-color: #46564d; }
input[type=text]:focus, input[type=search]:focus, textarea:focus { outline: 0; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { appearance: none; display: none; }
.field { display: grid; gap: 6px; }
.field > span, .grp-label { font: 500 12px/1 var(--font); color: var(--muted); }
.caption { margin: 0; color: var(--muted); font-size: 13px; }
.search-field { position: relative; width: 260px; } .search-field .ico { position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; } .search-field input { padding-left: 34px; }

input[type=checkbox] {
  appearance: none; width: 18px; height: 18px; margin: 0; flex: none; display: inline-grid; place-content: center; cursor: pointer;
  background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--r); transition: background var(--t), border-color var(--t);
}
input[type=checkbox]:hover { border-color: #5a6c61; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ''; width: 9px; height: 5px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: translateY(-1px) rotate(-45deg); }
.check { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--target); padding: 0 var(--s4); border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--raised); font-weight: 500; white-space: nowrap; transition: background var(--t), border-color var(--t), color var(--t); }
.btn:hover:not(:disabled) { background: #232b26; border-color: #46564d; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #ffb73d; border-color: #ffb73d; }
.btn.danger { color: var(--danger); } .btn.danger:hover:not(:disabled) { background: #2a1717; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); border-color: transparent; }
.btn.small { min-height: 30px; padding: 0 var(--s3); font-size: 13px; } .btn.small .ico { width: 16px; height: 16px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn.google { background: #fff; color: #1f1f1f; border-color: #fff; width: 100%; font-weight: 600; } .btn.google:hover { background: #ececec; border-color: #ececec; } .btn.google .g { display: grid; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); border: 0; background: transparent; color: var(--muted); flex: none; transition: background var(--t), color var(--t); }
.icon-btn:hover { background: var(--raised); color: var(--text); } .icon-btn.warn:hover { color: var(--danger); }
.link { background: none; border: 0; padding: 0 var(--s1); color: var(--accent); font-size: 12px; } .link:hover { text-decoration: underline; }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--field); }
.seg button { background: transparent; border: 0; min-width: 36px; height: 30px; padding: 0 var(--s3); color: var(--muted); display: grid; place-items: center; font-weight: 500; transition: background var(--t), color var(--t); }
.seg button + button { border-left: 1px solid var(--line-strong); } .seg button:hover { color: var(--text); background: var(--raised); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; } .seg .ico { width: 18px; height: 18px; }

/* stars */
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.star { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; background: none; color: #44504a; } .star svg { width: 16px; height: 16px; }
.star.on { color: var(--accent); } .star.on svg { fill: currentColor; }
.stars.input .star { cursor: pointer; } .stars.input .star:hover { color: #ffc65a; }

/* hints: [data-tip] shows to the right, [data-tip-below] underneath */
[data-tip], [data-tip-below] { position: relative; }
[data-tip]:hover::after, [data-tip-below]:hover::after {
  content: attr(data-tip) attr(data-tip-below); position: absolute; z-index: 1200; white-space: nowrap; pointer-events: none;
  background: #050706; color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 4px 8px; font-size: 12px; font-weight: 500;
}
[data-tip]:hover::after { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
[data-tip][data-key]:hover::after { content: attr(data-tip) ' · ' attr(data-key); }
[data-tip-below]:hover::after { top: calc(100% + 6px); right: 0; }

/* ---------- brand / top bar ---------- */
.logo { font: 700 22px/1 var(--font-cond); letter-spacing: .1em; text-transform: uppercase; } .logo b { color: var(--accent); font-weight: 700; } .logo.small { font-size: 17px; }
.topbar { display: flex; align-items: center; gap: var(--s3); height: 48px; padding: 0 var(--s3); background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.nav { display: flex; align-self: stretch; margin-left: var(--s4); } .nav a { display: grid; align-items: center; padding: 0 var(--s4); color: var(--muted); font: 500 14px var(--font); border-bottom: 2px solid transparent; margin-bottom: -1px; } .nav a:hover { color: var(--text); } .nav a.on { color: var(--accent); border-color: var(--accent); }
.user-menu { display: flex; align-items: center; gap: var(--s2); } .uname { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; border: 2px solid; color: #111; font-weight: 700; object-fit: cover; flex: none; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: var(--s4); background: linear-gradient(#0d100eb8, #0d100ef2), url('/tiles/1/1/1.png') center/cover; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); border-radius: var(--r); padding: var(--s5); display: grid; gap: var(--s4); }
.login-card .logo { font-size: 34px; }
.lead { margin: 0; color: #c4cdc6; font-size: 15px; line-height: 1.5; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.how li { display: flex; align-items: center; gap: var(--s3); color: var(--text); }
.dot { width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #0b0e12; border: 2px solid #0b0e12; box-shadow: 0 0 0 1px #ffffff90; display: grid; place-items: center; font: 700 13px/1 var(--font-cond); flex: none; }
.dev { display: grid; gap: var(--s3); } .or { color: var(--faint); font-size: 12px; text-align: center; }

/* ---------- home ---------- */
.home { height: 100%; display: flex; flex-direction: column; }
.home-grid { flex: 1; overflow: auto; padding: var(--s5); max-width: 1240px; width: 100%; margin: 0 auto; }
.home-main > h2 { margin-bottom: var(--s3); } .home-main > h2:not(:first-child) { margin-top: var(--s5); }
.catalog-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: var(--s4); }
.empty { color: var(--muted); margin: var(--s4) 0; }
.route-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-align: left; transition: border-color var(--t); }
.route-card:hover, .route-card:focus-visible { border-color: var(--accent); }
.thumb-wrap { position: relative; }
.thumb { aspect-ratio: 16 / 10; background: #0a0f0c; overflow: hidden; } .thumb svg { width: 100%; height: 100%; display: block; }
.fav, .rc-del { position: absolute; top: var(--s2); width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--r); background: #0d100ed9; color: #d4dcd6; transition: color var(--t), background var(--t); } .fav { right: var(--s2); } .rc-del { left: var(--s2); }
.fav:hover { background: #0d100e; color: var(--accent); } .fav.on { color: var(--accent); } .fav.on svg { fill: currentColor; } .rc-del:hover { background: #0d100e; color: var(--danger); }
@media (hover: hover) { .rc-del { opacity: 0; } .route-card:hover .rc-del, .rc-del:focus-visible { opacity: 1; } }
.rc-body { padding: var(--s3); display: grid; gap: 6px; } .rc-title { font: 600 15px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-sub { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: 12px; min-height: 20px; flex-wrap: wrap; } .by { display: inline-flex; align-items: center; gap: 5px; }
.rc-stats { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: 13px; } .stat { display: inline-flex; align-items: center; gap: 4px; } .stat .ico { width: 15px; height: 15px; color: var(--accent); } .stat small { color: var(--faint); } .when { margin-left: auto; font-size: 12px; color: var(--faint); }
.route-card.new { align-items: center; justify-content: center; min-height: 220px; gap: var(--s2); color: var(--accent); border: 1px dashed var(--line-strong); background: transparent; font: 500 14px var(--font); } .route-card.new .ico { width: 28px; height: 28px; }
.chip { height: 26px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: var(--r); background: transparent; color: var(--muted); font: 500 12px/1.4 var(--font); } .chip .ico { width: 13px; height: 13px; }
.chip.public { color: var(--ok); border-color: #2d5f40; background: #4ade8012; }
button.chip:not(:disabled):hover { border-color: var(--accent); color: var(--accent); } button.chip:disabled { opacity: 1; cursor: default; }
.col-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); display: grid; gap: var(--s4); }
.my-code { display: flex; align-items: center; gap: var(--s2); background: var(--field); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s1) var(--s1) var(--s1) var(--s3); } .my-code span { color: var(--muted); font-size: 12px; flex: 1; } .my-code b { font: 600 17px var(--font-cond); letter-spacing: .12em; }
.add-friend { display: flex; gap: var(--s2); }
.fr-group h4 { color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: var(--s1); }
.fr-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) 0; } .fr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- friends ---------- */
.nav .count { margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 600 11px/18px var(--font); text-align: center; align-self: center; }
.friends-layout { display: grid; grid-template-columns: 320px 1fr; gap: var(--s5); align-items: start; }
.fr-side { display: grid; gap: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); }
.fr-main { display: grid; gap: var(--s5); min-width: 0; }
.fr-group h4 { display: flex; justify-content: space-between; } .fr-group h4 small { color: var(--faint); font-weight: 400; }
.fr-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); margin: 0 calc(var(--s2) * -1); border-radius: var(--r); cursor: pointer; transition: background var(--t); }
.fr-item:hover { background: var(--raised); } .fr-item.on { background: var(--accent-soft); }
.fr-item .icon-btn { opacity: 0; } .fr-item:hover .icon-btn, .fr-item:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .fr-item .icon-btn { opacity: 1; } }
.fr-text { flex: 1; min-width: 0; } .fr-text .fr-name { font-weight: 500; }
.fr-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fr-sub.live { color: var(--ok); }
.av-wrap { position: relative; display: inline-flex; flex: none; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.av-wrap .status-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border: 2px solid var(--surface); }
.status-dot.on { background: var(--ok); }
.live-list { display: grid; gap: var(--s2); }
.live-row { display: flex; align-items: center; gap: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s3); }
.thumb-wrap .live { position: absolute; left: var(--s2); bottom: var(--s2); display: inline-flex; align-items: center; gap: 6px; background: #0d100eda; border-radius: var(--r); padding: 3px 8px; font-size: 12px; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: var(--s2); align-items: center; } .row > input { flex: 1; min-width: 0; }

/* ---------- editor layout ---------- */
.editor { height: 100%; display: flex; flex-direction: column; }
.editor .title { font: 600 17px var(--font); padding: 4px var(--s2); border: 0; background: transparent; border-radius: var(--r); max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.editor .title:not(:disabled):hover { background: var(--raised); } .editor .title:disabled { opacity: 1; cursor: default; }
.route-meta { display: flex; align-items: center; gap: var(--s3); }
.badge { font: 500 12px var(--font); color: var(--muted); border: 1px solid var(--line-strong); padding: 2px 7px; border-radius: var(--r); }
.rate { display: inline-flex; align-items: center; gap: var(--s2); } .rate-num { font-weight: 600; font-size: 13px; } .rate-num small { color: var(--faint); font-weight: 400; }
.route-meta .fav { position: static; width: 34px; height: 34px; background: transparent; } .route-meta .fav:hover { background: var(--raised); }
.status { font-size: 12px; color: var(--muted); } .status.off { color: var(--danger); }
.presence { display: flex; } .presence .avatar { margin-left: -6px; } .presence .more { margin-left: var(--s1); color: var(--muted); font-size: 12px; align-self: center; }
.workspace { flex: 1; min-height: 0; display: flex; position: relative; }
.toolbar { width: 52px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: var(--s2) 0; gap: 2px; z-index: 8; }
.tool { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r); border: 0; background: transparent; color: #b4bfb7; transition: background var(--t), color var(--t); }
.tool:hover:not(:disabled) { background: var(--raised); color: #fff; }
.tool.active { background: var(--accent); color: var(--accent-ink); }
.tool .key { position: absolute; right: 3px; bottom: 2px; font: 600 9px/1 var(--font-cond); font-style: normal; opacity: .5; }
.toolbar .sep { width: 24px; height: 1px; background: var(--line); margin: var(--s1) 0; }
.map-wrap { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.options { display: flex; align-items: flex-end; gap: var(--s4); padding: 0 var(--s3) 10px; height: 64px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.options > * { flex: none; }
.grp { display: grid; gap: 6px; } .grp-label { white-space: nowrap; line-height: 1; min-height: 12px; } .ctl { height: 30px; display: flex; align-items: center; gap: var(--s2); }
.hint { color: var(--muted); font-size: 13px; } .label { font: 600 14px var(--font); color: var(--accent); }
.vsep { width: 1px; height: 30px; background: var(--line); }
#map { flex: 1; min-height: 0; background: #0a1118; outline: none; isolation: isolate; }

.swatches { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.sw { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #ffffff44; padding: 0; transition: transform var(--t); } .sw:hover { transform: scale(1.12); }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #fff; }
.sw-custom { background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #22d3ee, #6366f1, #d946ef, #f43f5e); }
.sw-custom.on { background: var(--c); }
.widths { display: flex; gap: var(--s1); }
.wd { width: 34px; height: 28px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--field); display: grid; place-items: center; padding: 0; } .wd i { display: block; width: 16px; background: #cfd6d0; border-radius: 3px; } .wd:hover { border-color: #5a6c61; } .wd.on { border-color: var(--accent); background: var(--accent-soft); }
.icon-select { display: flex; align-items: center; gap: var(--s1); }
.picker .pv { display: grid; place-items: center; width: 22px; height: 22px; } .picker .pv svg, .picker .pv img { width: 22px; height: 22px; }
.options .pi { width: 30px; height: 30px; padding: 2px; } .options .pi img, .options .pi svg { width: 24px; height: 24px; }
.pi { width: 36px; height: 36px; padding: 3px; border-radius: var(--r); border: 1px solid transparent; background: transparent; display: grid; place-items: center; } .pi:hover { background: var(--raised); } .pi.on { border-color: var(--accent); background: var(--accent-soft); } .pi img, .pi svg { width: 28px; height: 28px; display: block; }

/* popovers: colour & icon pickers */
.popover { position: fixed; z-index: 1100; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 10px 28px #000a; padding: var(--s3); }
.cp { width: 236px; display: grid; gap: var(--s3); }
.cp-sv { position: relative; height: 150px; border-radius: var(--r); background: linear-gradient(to top, #000, #0000), linear-gradient(to right, #fff, var(--hue, red)); touch-action: none; cursor: crosshair; }
.cp-hue { position: relative; height: 14px; border-radius: 7px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); touch-action: none; cursor: pointer; }
.cp-thumb { position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #000a; transform: translate(-50%, -50%); pointer-events: none; } .cp-hue-thumb { top: 50%; }
.cp-row { display: flex; gap: var(--s2); align-items: center; } .cp-preview { width: 38px; height: 38px; border-radius: var(--r); border: 1px solid #ffffff40; flex: none; }
.cp-hex { font-family: ui-monospace, Consolas, monospace; } .cp-hex.bad { border-color: var(--danger); }
.cp-group { display: grid; gap: var(--s2); } .cp-title { font: 500 12px var(--font); color: var(--muted); }
.ip { width: 320px; display: grid; gap: var(--s2); }
.ip-search { position: relative; } .ip-search .ico { position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; color: var(--faint); } .ip-search input { padding-left: 34px; }
.ip-body { max-height: 340px; overflow: auto; display: grid; gap: var(--s3); align-content: start; }
.ip-body h5 { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: var(--s1); }
.ip-grid { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: var(--s1); }
.ip .pi { width: 44px; height: 44px; }
.ip-name { font-size: 12px; color: var(--muted); min-height: 18px; border-top: 1px solid var(--line); padding-top: var(--s2); }

/* ---------- map ---------- */
.tool-arrow, .tool-pen, .tool-area { cursor: crosshair !important; } .tool-step, .tool-icon, .tool-text { cursor: copy; }
.tool-arrow .leaflet-grab, .tool-pen .leaflet-grab, .tool-area .leaflet-grab { cursor: crosshair; }
.leaflet-container.panning, .leaflet-container.space { cursor: grab !important; }
.tool-arrow .leaflet-pane > svg path.leaflet-interactive, .tool-pen .leaflet-pane > svg path.leaflet-interactive, .tool-area .leaflet-pane > svg path.leaflet-interactive,
.tool-step .leaflet-pane > svg path.leaflet-interactive, .tool-icon .leaflet-pane > svg path.leaflet-interactive, .tool-text .leaflet-pane > svg path.leaflet-interactive { pointer-events: none; }
.tool-arrow .leaflet-marker-icon, .tool-pen .leaflet-marker-icon, .tool-area .leaflet-marker-icon, .tool-step .leaflet-marker-icon, .tool-icon .leaflet-marker-icon, .tool-text .leaflet-marker-icon,
.tool-eraser .leaflet-official-pane .leaflet-marker-icon, .tool-eraser .leaflet-official-pane { pointer-events: none !important; }
.tool-eraser .leaflet-interactive { cursor: not-allowed; }
.leaflet-container { font: inherit; background: #0a1118; }
.leaflet-bar { border: 1px solid var(--line-strong) !important; border-radius: var(--r) !important; box-shadow: none !important; }
.leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--line-strong); width: 34px; height: 34px; line-height: 34px; } .leaflet-bar a:hover { background: var(--raised); color: #fff; }
.leaflet-bar a:first-child, .leaflet-bar a:last-child { border-radius: 0; }
.leaflet-control-attribution { background: #0d100eb3 !important; color: #8a958d !important; font-size: 10px; }

.grid-label { background: none; border: 0; pointer-events: none; white-space: nowrap; color: #fff; font: 600 11px/1 var(--font-cond); opacity: .72; padding: 3px 4px; text-shadow: 0 1px 2px #000; }

/* map items (kept light: no filters or stacked shadows, they make zooming stutter) */
.it-wrap { background: none; border: 0; }
.it-wrap.selected .it-step, .it-wrap.selected .it-icon, .it-wrap.selected .it-text { outline: 2px dashed #fff; outline-offset: 3px; border-radius: 6px; }
.it-step { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2.5px solid #0b0e12; box-shadow: 0 0 0 1.5px #ffffffa0; display: grid; place-items: center; color: #0b0e12; cursor: pointer; }
.it-step b { font: 700 15px/1 var(--font-cond); }
.it-note { position: absolute; left: 34px; top: 50%; transform: translateY(-50%); background: #0d100ee8; color: #fff; padding: 2px 8px; border-radius: var(--r); white-space: nowrap; font-size: 12px; border-left: 3px solid var(--c); pointer-events: none; }
.it-icon { position: relative; width: 32px; height: 32px; cursor: pointer; } .it-icon img, .it-icon svg { width: 32px; height: 32px; display: block; }
.it-label { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); background: #0d100ee8; color: #fff; padding: 1px 7px; border-radius: var(--r); white-space: nowrap; font-size: 12px; pointer-events: none; }
.it-text { position: absolute; white-space: pre; font-family: var(--font-cond); font-weight: 700; line-height: 1.15; letter-spacing: .02em; text-shadow: 0 1px 3px #000; cursor: pointer; transform: translate(-4px, -50%); padding: 2px 4px; }
.poi-label { background: none; border: 0; pointer-events: none; }
.poi-label span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; color: #fff; font-family: var(--font-cond); paint-order: stroke fill; -webkit-text-stroke: 3px #000c; }
.poi-label.primary span { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; }
.poi-label.secondary span { font-weight: 600; font-size: 12px; color: #dfe6e0; display: none; -webkit-text-stroke-width: 2.5px; }
.z-far .poi-label.primary span { font-size: 12px; } .z-mid .poi-label.secondary span, .z-near .poi-label.secondary span { display: block; } .z-near .poi-label.primary span { font-size: 19px; }
.official-ico { transition: transform var(--t); } .official-ico:hover { transform: scale(1.15); }
.rcur { background: none; border: 0; pointer-events: none; } .rcur > div { position: relative; } .rcur span { position: absolute; left: 14px; top: 12px; background: var(--c); color: #111; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: var(--r); white-space: nowrap; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 8px 24px #000a; }
.leaflet-popup-content { margin: var(--s3) var(--s4); font-size: 13px; }
.poi-pop h3 { margin-bottom: 2px; font-size: 17px; font-weight: 600; } .poi-cat { color: var(--accent); font: 500 12px var(--font); margin-bottom: var(--s2); } .poi-img { width: 100%; border-radius: var(--r); margin-bottom: var(--s2); display: block; }
.poi-text { max-height: 180px; overflow: auto; color: #cdd5ce; padding-right: var(--s1); } .poi-text h3 { font-size: 14px; } .poi-text p { margin: 0 0 var(--s2); }

/* equal columns so labels centre and edges line up with neighbouring fields */
.panel-body .seg, .modal .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.panel-body p { margin: 0; }
.panel-body > * { flex: none; }
.copy-link input { flex: 1; min-width: 0; width: auto; text-overflow: ellipsis; }

/* ---------- side panel ---------- */
.panel { width: 316px; flex: none; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 8; }
.editor.panel-collapsed .panel { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); } .tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font: 500 14px var(--font); } .tabs button:hover { color: var(--text); } .tabs button.on { color: var(--accent); border-color: var(--accent); } .tabs .ico { display: none; }
.panel-body { flex: 1; overflow: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.panel-body h4 { font: 600 13px var(--font); color: var(--text); margin: var(--s2) 0 0; display: flex; align-items: center; justify-content: space-between; } .panel-body h4.mt { margin-top: var(--s4); } .panel-body h4 .mini { display: flex; gap: var(--s2); letter-spacing: 0; text-transform: none; }
.layer-row, .member-row, .step-row { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) 0; min-height: 40px; } .layer-row.off { opacity: .5; }
.lr-main { flex: 1; min-width: 0; } .lr-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lr-main small, .lr-name small, .member-row small { color: var(--muted); font-weight: 400; }
.cat-group { border-top: 1px solid var(--line); } .cat-group:first-of-type { border-top: 0; }
.cat-group summary { display: flex; align-items: center; gap: var(--s2); min-height: 36px; cursor: pointer; list-style: none; color: var(--muted); font: 500 13px var(--font); } .cat-group summary::-webkit-details-marker { display: none; }
.cat-group summary::before { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--t); margin-right: var(--s1); } .cat-group[open] summary::before { transform: rotate(45deg); }
.sum-name { flex: 1; }
.cat-row { display: flex; align-items: center; gap: var(--s2); min-height: 34px; cursor: pointer; } .cat-row img { width: 22px; height: 22px; } .cat-row.off > span, .cat-row.off img { opacity: .45; } .cat-row > span:not(.txt-ico) { flex: 1; } .cat-row small { color: var(--muted); }
.txt-ico { width: 22px; height: 22px; display: grid; place-items: center; color: var(--muted); } .txt-ico .ico { width: 18px; height: 18px; }
.search-results { display: grid; } .result { display: flex; justify-content: space-between; gap: var(--s2); text-align: left; background: var(--raised); border: 0; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); min-height: 36px; } .result:hover { background: #232b26; } .result small { color: var(--muted); }
.step-row { cursor: pointer; border-radius: var(--r); padding: var(--s1) var(--s2); } .step-row:hover { background: var(--raised); } .step-row .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #0b0e12; font: 700 13px var(--font-cond); flex: none; } .step-row .note { flex: 1; } .step-row i { color: var(--muted); font-style: normal; }
.copy-link { display: flex; gap: var(--s2); align-items: center; }
.mr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); cursor: pointer; padding: var(--s1); } .chk .ico { width: 18px; height: 18px; } .chk:has(input:checked) { color: var(--accent); }

/* ---------- dialogs & toasts ---------- */
.modal-bg { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 1000; padding: var(--s4); }
.modal { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; width: min(400px, 100%); box-shadow: 0 16px 40px #000c; }
.modal > header { display: flex; align-items: center; justify-content: space-between; padding: var(--s2) var(--s2) var(--s2) var(--s4); border-bottom: 1px solid var(--line); } .modal h3 { font-size: 16px; font-weight: 600; }
.modal > form, .modal > p { margin: 0; padding: var(--s4); display: grid; gap: var(--s4); }
.modal > footer { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); background: #101511; border-radius: 0 0 4px 4px; }
#toasts { position: fixed; bottom: var(--s5); left: 50%; transform: translateX(-50%); display: grid; gap: var(--s2); z-index: 2000; }
.toast { background: var(--raised); border: 1px solid var(--line-strong); border-left-width: 3px; padding: var(--s2) var(--s4); border-radius: var(--r); box-shadow: 0 6px 20px #000a; transition: opacity .3s; } .toast.err { border-left-color: var(--danger); } .toast.ok { border-left-color: var(--ok); } .toast.out { opacity: 0; }
.fatal { padding: var(--s5); color: var(--danger); }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  :root { --target: 44px; }
  .home-grid { padding: var(--s4); }
  .friends-layout { grid-template-columns: 1fr; }
  .nav a { padding: 0 var(--s3); } .uname, .share > span:not(.ico) { display: none; }
  .search-field { width: 100%; }
  .editor .title { max-width: 26vw; }
  .rate-num, .route-meta .badge, .route-meta .btn > span:not(.ico) { display: none; }
  .workspace { flex-direction: column-reverse; }
  .toolbar { width: 100%; flex-direction: row; justify-content: flex-start; overflow-x: auto; padding: var(--s1) var(--s2); border-right: 0; border-top: 1px solid var(--line); gap: var(--s1); }
  .toolbar .sep { width: 1px; height: 26px; margin: 0 var(--s1); } .toolbar .grow { display: none; }
  .tool { flex: none; width: 44px; height: 44px; }
  .panel { position: absolute; inset: 0 0 56px 0; width: auto; display: none; border-left: 0; }
  .editor.panel-open .panel { display: flex; }
  .editor.panel-collapsed .panel { display: none; }
  .presence { display: none; }
  .leaflet-control-zoom { display: none; }
  .sw { width: 28px; height: 28px; }
  [data-tip]:hover::after, [data-tip-below]:hover::after { display: none; }
  .ip { width: min(320px, calc(100vw - 32px)); }
}
/* ---------- page transitions ---------- */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes nav-run { from { transform: scaleX(0); } to { transform: scaleX(.85); } }
.enter { animation: view-in .2s ease-out both; }
.enter .routes > * { animation: view-in .26s ease-out both; animation-delay: calc(var(--i, 0) * 28ms); }
.editor.enter { animation-duration: .18s; animation-name: fade-in; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.login-card { animation: view-in .24s ease-out both; }
#nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: left; z-index: 3000; animation: nav-run 1.4s cubic-bezier(.2, .7, .2, 1) forwards; }
#nav-progress.end { animation: none; transform: scaleX(1); opacity: 0; transition: transform .15s ease-out, opacity .25s ease-out .12s; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
