:root {
  --bg: #0d1117;
  --text: #e6e1d3;
  --accent: #d9a441;
  /* frosted glass panels and buttons over the map */
  --glass: rgba(13, 17, 23, 0.6);
  --glass-hover: rgba(40, 46, 56, 0.72);
  --glass-active: rgba(60, 66, 76, 0.8);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-blur: blur(10px) saturate(1.4);
  --glass-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --btn: 42px;
  --compass: 96px;
  --edge: 16px;   /* gap of the buttons to the window edge */
  --fs-shift: 0px;   /* the buttons under the full screen button move up by a button when there is none (see body.no-fullscreen) */
}
/* thin scrollbars in the glass panels' own colours (the lists, the layers panel, the editors) */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent; }
@supports not (scrollbar-width: thin) {
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.28); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(217, 164, 65, 0.7); background-clip: padding-box; }
  ::-webkit-scrollbar-corner { background: transparent; }
}
@media (prefers-color-scheme: light) {
  :root { --bg: #1a1f26; }
}
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; }
#map { position: absolute; inset: 0; background: var(--bg); }
#info {
  position: absolute; left: 16px; bottom: 16px; padding: 8px 12px;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px; font-size: 13px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  display: flex; gap: 12px; align-items: baseline; pointer-events: none;
}
#info strong { color: #fff; font-size: 15px; }
#coords { font-variant-numeric: tabular-nums; min-width: 12ch; }
/* map buttons: glass squares like the search box. Zoom top right with full screen below it; home and day/night
   in the row of the search box. */
.ol-control, .ol-control:hover { background: none; padding: 0; border-radius: 0; }
.ol-control button {
  width: var(--btn); height: var(--btn); margin: 0; padding: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text); font: 400 22px/1 system-ui, sans-serif;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  cursor: pointer; transition: background-color 0.12s;
}
.ol-control button:hover, .ol-control button:focus { background: var(--glass-hover); color: var(--text); outline: none; }
.ol-control button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ol-control button:active { background: var(--glass-active); }
.ol-zoom { top: 16px; left: auto; right: 16px; display: flex; flex-direction: column; }
.ol-zoom .ol-zoom-in { border-radius: 8px 8px 0 0; border-bottom-color: transparent; }
.ol-zoom .ol-zoom-out { border-radius: 0 0 8px 8px; margin-top: -1px; position: relative; }
.ol-zoom .ol-zoom-out::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 0; border-top: 1px solid var(--glass-border);
}
.ol-full-screen { top: calc(16px + 2 * var(--btn) + 8px); right: 16px; }
:root.no-fullscreen { --fs-shift: calc(var(--btn) + 8px); }
/* not .ol-layers: OpenLayers uses that class for the container of the map layers */
.ol-layer-switch { top: calc(16px + 3 * var(--btn) + 16px - var(--fs-shift)); right: 16px; left: auto; }
/* the Roads button sits below the Layers button */
.ol-roads-switch { top: calc(16px + 4 * var(--btn) + 24px - var(--fs-shift)); right: 16px; left: auto; }
.ol-houses-switch { top: calc(16px + 5 * var(--btn) + 32px - var(--fs-shift)); right: 16px; left: auto; }
.ol-layer-switch.on button, .ol-roads-switch.on button, .ol-houses-switch.on button, .ol-directions.on button { background: var(--glass-active); color: var(--accent); }
#map-buttons { display: flex; gap: 6px; flex: none; }
#map-buttons .ol-control { position: static; }
/* view direction: a round glass compass in the bottom right corner; each quarter is a button for one diagonal direction */
.ol-direction { top: auto; left: auto; right: 16px; bottom: 16px; }
.ol-direction .compass {
  position: relative; width: var(--compass); height: var(--compass); box-sizing: border-box; overflow: hidden;
  border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.ol-direction .compass button {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0;
  background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.ol-direction .compass button svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ol-direction .compass button[data-dir="ne"] { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 50%); }
.ol-direction .compass button[data-dir="se"] { clip-path: polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%); }
.ol-direction .compass button[data-dir="sw"] { clip-path: polygon(50% 50%, 50% 100%, 0 100%, 0 50%); }
.ol-direction .compass button[data-dir="nw"] { clip-path: polygon(50% 50%, 0 50%, 0 0, 50% 0); }
.ol-direction .compass button:hover:not(:disabled) { background: var(--glass-hover); }
.ol-direction .compass button[aria-pressed="true"] { background: rgba(217, 164, 65, 0.28); color: var(--accent); }
.ol-direction .compass button:disabled { color: var(--text); opacity: 0.22; cursor: default; background: none; }
.ol-direction .compass button:focus-visible { outline: none; background: var(--glass-hover); }
.ol-direction .compass .face { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ol-direction .compass .ticks { stroke: var(--text); stroke-opacity: 0.45; stroke-width: 1.2; stroke-linecap: round; }
.ol-direction .compass .north { fill: var(--accent); }
.ol-direction .compass .pivot { fill: var(--text); stroke: rgba(13, 17, 23, 0.8); stroke-width: 1; }
.toggle { pointer-events: auto; cursor: pointer; display: flex; gap: 6px; align-items: center; user-select: none; }
.toggle input { accent-color: var(--accent); margin: 0; }
[hidden] { display: none !important; }
#weather {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px; padding: 1px 4px; cursor: pointer;
}
#weather:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* card above a picked marker: its name and type, directions, and for a portal where it leads */
.place-box {
  box-sizing: border-box; min-width: 200px; max-width: 280px; padding: 16px 18px; font-size: 14px; text-align: center;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.place-box .title { font-weight: 600; font-size: 17px; color: #fff; }
.place-box .sub { margin-top: 4px; opacity: 0.7; font-size: 13px; font-variant-numeric: tabular-nums; }
.place-box .dest { margin-top: 10px; opacity: 0.9; }
.place-box .desc { margin-top: 10px; white-space: pre-line; text-align: left; line-height: 1.45; max-height: 180px; overflow-y: auto; }
.place-box .actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.place-box button {
  padding: 7px 14px; font: inherit; font-weight: 600; color: #1a1408; cursor: pointer;
  background: var(--accent); border: 0; border-radius: 6px;
}
.place-box button.ghost { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.place-box button:hover { filter: brightness(1.15); }
.place-box button:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

/* search box and marker list, top left */
#search {
  position: absolute; left: 16px; top: 16px; width: min(460px, calc(100vw - 32px - var(--btn) - 10px)); z-index: 5;
  display: flex; flex-direction: column; max-height: calc(100vh - 136px);
}
.search-row { display: flex; gap: 6px; }
.search-box {
  flex: 1; min-width: 0; box-sizing: border-box;
  display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; height: var(--btn);
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.search-box svg { flex: none; opacity: 0.7; }
#q {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px;
  outline: none;
}
#q::placeholder { color: var(--text); opacity: 0.5; }
#list-toggle {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 6px; background: none; color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0.75;
}
#list-toggle:hover, #list-toggle.on { opacity: 1; background: rgba(255, 255, 255, 0.1); }
#list-toggle:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--glass-shadow); }
#results {
  margin-top: 6px; background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
#chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 12px 6px; }
.chip {
  display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2); background: none; color: var(--text); font: inherit; font-size: 12px;
}
.chip img { width: 16px; height: 16px; }
.chip:hover { background: rgba(255, 255, 255, 0.08); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1a1408; }
#result-count { padding: 8px 14px; font-size: 13px; opacity: 0.6; }
#result-list { list-style: none; margin: 0; padding: 0 0 6px; overflow-y: auto; min-height: 0; }
#result-list li { display: flex; align-items: center; gap: 12px; padding: 8px 14px; cursor: pointer; }
#result-list li:hover, #result-list li.active { background: rgba(255, 255, 255, 0.08); }
#result-list li.picked { box-shadow: inset 3px 0 0 var(--accent); }
#result-list .ico { flex: none; width: 24px; height: 24px; text-align: center; line-height: 24px; color: var(--accent); font-size: 18px; }
#result-list .txt { display: flex; flex-direction: column; min-width: 0; }
#result-list .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#result-list .meta { font-size: 13px; opacity: 0.6; font-variant-numeric: tabular-nums; }
/* layers panel, opened by the layers button (top right) */
.layers-panel {
  position: absolute; top: 16px; right: calc(16px + var(--btn) + 8px); width: 290px; max-height: calc(100vh - 32px);
  overflow-y: auto; box-sizing: border-box; padding: 8px 16px 16px; z-index: 6; font-size: 14px;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 12px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.lp-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 4px; font-weight: 600; font-size: 18px; color: #fff; }
.lp-close, .dir-close {
  width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; opacity: 0.7;
}
.lp-close:hover, .dir-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); }
.lp-sec { margin-top: 16px; }
.lp-title { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.6; margin-bottom: 8px; }
.lp-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.lp-seg button {
  flex: 1 1 auto; padding: 6px 10px; font: inherit; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px;
}
.lp-seg button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.lp-seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 600; }
.lp-seg button:disabled { opacity: 0.3; cursor: default; }
.lp-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; user-select: none; }
.lp-row input { accent-color: var(--accent); margin: 0; }
.lp-row img { width: 20px; height: 20px; }
.lp-name { flex: 1; }
.lp-count { opacity: 0.55; font-variant-numeric: tabular-nums; }
.lp-seg button:focus-visible, .lp-close:focus-visible, .dir-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* directions panel (in the search column, top left) */
.ol-directions { position: static; }
.dir-panel {
  margin-top: 6px; padding: 14px 16px 16px; font-size: 14px; position: relative;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  overflow-y: auto; min-height: 0;
}
.dir-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dir-head strong { color: #fff; font-size: 18px; }
/* folded: only the title and the summary of the route */
.dir-head .dir-fold { margin-left: auto; }
.dir-panel.folded .dir-rows, .dir-panel.folded .dir-add, .dir-panel.folded .dir-opts, .dir-panel.folded .dir-steps,
.dir-panel.folded .dir-note { display: none; }
.dir-panel.folded .dir-head { margin-bottom: 0; }
.dir-panel.folded .dir-result { margin-top: 4px; }
.dir-rows { position: relative; display: flex; flex-direction: column; gap: 8px; padding-right: 34px; }
.dir-row { position: relative; display: flex; align-items: center; gap: 6px; }
.dir-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; border: 2px solid #fff; box-sizing: border-box; }
.dir-dot.from { background: #3a9d4a; }
.dir-dot.to { background: #d04a3a; }
.dir-dot.via { background: #f4efe4; color: #2b2116; border-color: #2b2116; }
.dir-remove { font-size: 18px; }
.dir-add {
  margin: 6px 0 0 28px; padding: 3px 10px; border: 1px dashed rgba(255, 255, 255, 0.25); border-radius: 6px; cursor: pointer;
  background: none; color: var(--text); font: inherit; font-size: 12.5px; opacity: 0.8;
}
.dir-add:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }
.dir-input {
  flex: 1; min-width: 0; height: 34px; box-sizing: border-box; padding: 0 10px; color: var(--text); font: inherit; font-size: 14px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 6px; outline: none;
}
.dir-input:focus { border-color: var(--accent); }
.dir-input::placeholder { color: var(--text); opacity: 0.45; }
.dir-pick {
  flex: none; width: 34px; height: 34px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 6px; cursor: pointer;
  background: rgba(255, 255, 255, 0.07); color: var(--text); font-size: 18px; line-height: 1;
}
.dir-pick:hover, .dir-pick.on { background: var(--accent); color: #1a1408; border-color: var(--accent); }
.dir-swap {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.07); color: var(--text); font-size: 16px; line-height: 1;
}
.dir-swap:hover { background: rgba(255, 255, 255, 0.16); }
.dir-suggest {
  position: absolute; left: 28px; right: 0; top: 100%; z-index: 4; margin: 2px 0 0; padding: 4px 0; list-style: none;
  background: rgba(20, 25, 32, 0.97); border: 1px solid var(--glass-border); border-radius: 8px; box-shadow: var(--glass-shadow);
}
.dir-suggest li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer; }
.dir-suggest li:hover { background: rgba(255, 255, 255, 0.1); }
.dir-suggest .ico { flex: none; width: 22px; height: 22px; text-align: center; line-height: 22px; color: var(--accent); }
.dir-suggest .txt { display: flex; flex-direction: column; min-width: 0; }
.dir-suggest .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-suggest .meta { font-size: 11px; opacity: 0.6; }
.dir-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; }
.dir-result { margin-top: 14px; }
.dir-summary { font-size: 15px; }
.dir-summary strong { color: var(--accent); font-size: 18px; }
.dir-note { margin-top: 2px; opacity: 0.65; font-size: 12px; }
.dir-steps { margin: 12px 0 0; padding-left: 22px; line-height: 1.55; }
.dir-steps li { padding: 3px 0; }
.dir-turns { margin: 3px 0 2px; padding-left: 4px; list-style: none; font-size: 13.5px; opacity: 0.9; }
.dir-turns li { padding: 3px 0; }
.dir-turn-link { cursor: pointer; }
.dir-turn-link:hover { color: var(--accent); }
.dir-turn-icon { display: inline-flex; width: 18px; height: 18px; margin-right: 6px; vertical-align: -4px; color: var(--accent); }
.dir-turn-icon svg { width: 18px; height: 18px; }
#map.picking .ol-viewport { cursor: crosshair; }

/* menu of a right click or long press on the map */
.ctx-menu {
  position: fixed; z-index: 20; min-width: 190px; padding: 4px 0; font-size: 14px;
  background: rgba(20, 25, 32, 0.97); border: 1px solid var(--glass-border); border-radius: 8px; box-shadow: var(--glass-shadow);
}
.ctx-title { padding: 6px 14px 4px; font-size: 12px; opacity: 0.6; font-variant-numeric: tabular-nums; }
.ctx-menu button { display: block; width: 100%; padding: 8px 14px; text-align: left; font: inherit; color: var(--text); background: none; border: 0; cursor: pointer; }
.ctx-menu button:hover { background: rgba(255, 255, 255, 0.1); }

/* logging in: a small button in the bottom left corner (the info bar moves over), its panel above it */
.account { position: absolute; left: 16px; bottom: 16px; z-index: 7; }
.account-btn {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; cursor: pointer;
  color: var(--text); background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.account-btn:hover { background: var(--glass-hover); }
.account-btn.on { color: var(--accent); }
.account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body.has-account #info { left: calc(16px + 34px + 8px); }
.account-panel {
  position: absolute; left: 0; bottom: calc(34px + 8px); width: 280px; box-sizing: border-box; padding: 16px;
  background: rgba(20, 25, 32, 0.95); border: 1px solid var(--glass-border); border-radius: 10px; box-shadow: var(--glass-shadow);
  font-size: 13px;
}
.acc-form { display: flex; flex-direction: column; gap: 10px; }
.acc-title { font-weight: 600; font-size: 17px; color: #fff; }
.acc-note { font-size: 12px; opacity: 0.85; }
.acc-msg { font-size: 12px; color: #ff9a8a; }
.acc-msg.ok { color: #8fe08a; }
.acc-form button, .road-panel button {
  padding: 6px 10px; font: inherit; font-weight: 600; color: #1a1408; cursor: pointer;
  background: var(--accent); border: 0; border-radius: 6px;
}
.acc-form button.ghost, .road-panel button.ghost { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.road-panel button.danger { color: #ffb4a8; }
.acc-form button:hover, .road-panel button:hover { filter: brightness(1.15); }
.acc-form button:disabled { opacity: 0.6; cursor: default; }
/* naming roads: a panel on the right, like the layers panel */
.road-panel {
  position: absolute; top: 16px; right: calc(16px + var(--btn) + 8px); width: 300px; max-height: calc(100vh - 32px);
  overflow-y: auto; box-sizing: border-box; padding: 8px 16px 16px; z-index: 6; font-size: 14px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 12px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.road-panel .lp-close { background: none; color: var(--text); padding: 0 4px; font-size: 20px; font-weight: 400; }
.road-hint { font-size: 12px; opacity: 0.8; }
.house-desc { height: auto; padding: 8px 10px; resize: vertical; min-height: 70px; line-height: 1.4; }
.house-poi { width: 18px; height: 18px; opacity: 0.8; }
/* the title of an edited house is a button that folds the details away (a phone; the title only on a wide screen) */
.road-panel .sheet-toggle { background: none; border: 0; padding: 0; color: #fff; font: inherit; font-weight: 600; font-size: 18px; text-align: left; cursor: default; pointer-events: none; }
.sheet-toggle .sheet-caret { display: none; margin-left: auto; opacity: 0.7; }
.house-fields { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 600px) {
  .road-panel .sheet-toggle { cursor: pointer; pointer-events: auto; }
  .sheet-toggle .sheet-caret { display: inline; }
  .road-panel .sheet-toggle span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.house-lift { display: flex; flex-direction: column; gap: 4px; }
.house-lift input[type=range] { width: 100%; accent-color: var(--accent); }
.road-sec { margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.12); display: flex; flex-direction: column; gap: 8px; }
.road-actions { display: flex; gap: 6px; }
/* Save and Cancel stay in view when the panel scrolls (a small screen) */
.road-panel .sticky-actions { position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 10px 16px 14px; background: rgba(20, 25, 32, 0.95); border-radius: 0 0 12px 12px; }
.road-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.road-list li { display: flex; align-items: center; gap: 6px; }
.road-list .lp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.road-list button { padding: 3px 8px; font-weight: 500; }

@media (max-width: 600px) {
  #search { left: 8px; top: 8px; width: calc(100vw - 16px - var(--btn) - 8px); max-height: calc(100vh - 80px); }
  .ol-zoom { top: 8px; right: 8px; }
  .ol-full-screen { top: calc(8px + 2 * var(--btn) + 8px); right: 8px; }
  .ol-layer-switch { top: calc(8px + 3 * var(--btn) + 16px - var(--fs-shift)); right: 8px; }
  .ol-roads-switch { top: calc(8px + 4 * var(--btn) + 24px - var(--fs-shift)); right: 8px; }
  .ol-houses-switch { top: calc(8px + 5 * var(--btn) + 32px - var(--fs-shift)); right: 8px; }
  :root { --edge: 8px; }
  #info { left: 8px; bottom: 8px; gap: 4px 10px; flex-wrap: wrap; max-width: calc(100vw - 16px); box-sizing: border-box; }
  .account { left: 8px; bottom: 8px; }
  body.has-account #info { left: calc(8px + 34px + 6px); max-width: calc(100vw - 16px - 40px); }
  /* the editors (roads, houses) are a sheet at the bottom, above the login button, so the map above stays in view */
  .road-panel { top: auto; bottom: calc(8px + 34px + 8px); left: 8px; right: 8px; width: auto; max-height: 46vh; }
  .house-desc { min-height: 48px; }
  /* editing a house: the details are folded away to a bar (title, the area buttons, Save) until the title is tapped */
  .road-panel.folded .house-fields { display: none; }
  .road-panel.editing-house { max-height: 56vh; }
  .road-panel.folded { padding-bottom: 8px; gap: 4px; }
  .road-panel.folded .sticky-actions { margin-bottom: -8px; padding-bottom: 8px; }
  .sheet-toggle { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
  /* the readout follows the mouse; a touch screen has none, so it would only take room */
  #coords { display: none; }
  /* above the info bar, which spans most of the width on a phone */
  .ol-direction { right: 8px; bottom: calc(8px + 40px + 8px); }
  :root { --compass: 76px; }
}

/* A small screen or a phone: the layers panel is a compact popout beside its button, with a chevron pointing at it */
.lp-chevron { display: none; }
@media (max-width: 900px), (max-height: 560px) {
  :root { --lp-top: calc(var(--edge) + 3 * var(--btn) + 16px - var(--fs-shift)); }
  .layers-panel {
    top: var(--lp-top); left: auto; right: calc(var(--edge) + var(--btn) + 12px);
    width: min(244px, calc(100vw - var(--edge) - var(--btn) - 12px - 8px)); max-height: calc(100vh - var(--lp-top) - 8px);
    padding: 2px 12px 12px; font-size: 13px; border-radius: 10px;
  }
  .lp-head { padding: 6px 0 0; font-size: 15px; }
  .lp-sec { margin-top: 10px; }
  .lp-title { font-size: 11px; margin-bottom: 5px; }
  .lp-seg { gap: 4px; }
  .lp-seg button { padding: 5px 8px; border-radius: 7px; }
  .lp-row { padding: 4px 0; gap: 8px; }
  .lp-row img { width: 18px; height: 18px; }
  .lp-chevron {
    display: block; position: absolute; z-index: 6; width: 9px; height: 18px;
    right: calc(var(--edge) + var(--btn) + 3px); top: calc(var(--lp-top) + var(--btn) / 2 - 9px);
    background: rgba(30, 36, 44, 0.9); clip-path: polygon(0 0, 100% 50%, 0 100%);
  }
  .lp-chevron[hidden] { display: none; }
}

/* In the area: the markers and players in view, under the search box (pushed down by its list) */
#area {
  flex: none; margin-top: 6px; box-sizing: border-box;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 8px; font-size: 14px;
  box-shadow: var(--glass-shadow); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.area-head {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 14px; border: 0; background: none; cursor: pointer;
  color: #fff; font: inherit; font-size: 17px; font-weight: 600; text-align: left;
}
.area-count { margin-left: auto; color: var(--text); font-weight: 400; opacity: 0.7; font-variant-numeric: tabular-nums; }
.area-caret { color: var(--text); opacity: 0.7; }
.area-body { max-height: 40vh; overflow-y: auto; padding: 0 6px 8px; }
.area-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.area-row:hover, .area-row:focus { background: rgba(255, 255, 255, 0.08); outline: none; }
.area-row .ico { width: 24px; height: 24px; flex: none; }
.area-row .txt { display: flex; flex-direction: column; min-width: 0; }
.area-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-row .meta { font-size: 12.5px; opacity: 0.65; }
.area-none { padding: 4px 10px 8px; font-size: 13px; opacity: 0.7; }
.area-ico { display: none; }
/* a small screen or a phone: closed, a square button like the layers button (a marker and the number in view); open, a narrow list of single lines */
@media (max-width: 900px), (max-height: 560px) {
  #area { margin-top: 6px; font-size: 13px; border-radius: 8px; align-self: flex-start; width: min(244px, 100%); }
  .area-head { padding: 6px 10px; font-size: 13px; gap: 6px; }
  .area-ico { display: flex; color: var(--text); opacity: 0.8; }
  #area:not(.open) { position: relative; width: var(--btn); height: var(--btn); }
  #area:not(.open) .area-head { width: 100%; height: 100%; padding: 0; justify-content: center; }
  #area:not(.open) .area-title, #area:not(.open) .area-caret { display: none; }
  #area:not(.open) .area-count {
    position: absolute; top: -6px; right: -6px; margin: 0; min-width: 18px; height: 18px; box-sizing: border-box; padding: 0 5px;
    border-radius: 9px; background: var(--accent); color: #1a1408; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; opacity: 1;
  }
  .area-count:empty { display: none; }
  .area-body { max-height: 24vh; padding: 0 4px 4px; }
  .area-row { padding: 4px 8px; gap: 8px; }
  .area-row .ico { width: 18px; height: 18px; }
  .area-row .txt { flex-direction: row; align-items: baseline; gap: 8px; }
  .area-row .meta { font-size: 11.5px; white-space: nowrap; }
  .area-none { padding: 2px 8px 6px; font-size: 12px; }
}

/* the world menu in the name box, and the notice for a world without a map */
#world-select {
  pointer-events: auto; cursor: pointer; font: inherit; font-size: 15px; font-weight: 700; color: #fff;
  background: transparent; border: 0; padding: 0 2px; margin: 0 -2px; max-width: 60vw;
}
#world-select option { color: #111; font-weight: 400; }
.no-map { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; pointer-events: none; }
