/*
  Styles for all pages: shared tokens and controls, then the editor, then the player.
  Colours are CSS variables on :root, with a dark set for devices in dark mode.
*/
:root {
  /* Must match APP_VERSION in the pages' version check (a stale cached stylesheet reloads). */
  --app-version: v49;
  --bg: #f6f5f2;
  --panel: #ffffff;
  --text: #1c1b19;
  --muted: #6b6860;
  --line: #e3e0d8;
  --accent: #2f6fdf;
  --accent-text: #ffffff;
  --danger: #c2372b;
  --ok: #1f8a4c;
  --radius: 10px;
  --r-btn: 8px; /* corners of buttons and boxes; Studio uses squarer ones */
  --r-input: 7px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  color-scheme: light dark;
  accent-color: var(--accent); /* sliders, tick boxes and radio buttons in the scheme's colour */
  /* Chart series (statistics): blue, orange, aqua — checked for colour-blind separation. */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
}
@media (prefers-color-scheme: dark) { :root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; } }
:root[data-theme="studio"], :root[data-theme="night"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --panel: #1f1f1d;
    --text: #ecebe6;
    --muted: #a09d94;
    --line: #34332f;
    --accent: #5b93f5;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}

/*
  Colour schemes (a walk's "Colour scheme", set on <html data-theme="…">). Each has a light
  set and a dark set for devices in dark mode; Studio (the default) and Night are always dark.
  Classic is the :root set above.
*/
:root[data-theme="forest"] { --bg: #f2f5f0; --panel: #ffffff; --text: #1d2a20; --muted: #5d6b60; --line: #dce5d7; --accent: #2e7d4f; --accent-text: #fff; }
:root[data-theme="terracotta"] { --bg: #f8f2ec; --panel: #fffcf9; --text: #2c1f19; --muted: #7b665b; --line: #eadbcf; --accent: #c2552c; --accent-text: #fff; }
:root[data-theme="dusk"] { --bg: #f4f2f9; --panel: #ffffff; --text: #221d30; --muted: #6b6482; --line: #e1dcee; --accent: #6a4fc4; --accent-text: #fff; }
/*
  Studio (the default): a dark, neutral charcoal like audio / video tools (Wwise, DaVinci
  Resolve): grey panels on a near-black background, soft light-grey text, thin borders, squarer
  corners, and one warm orange accent for what's active. Always dark.
*/
:root[data-theme="studio"] {
  --bg: #1a1b1d; --panel: #25272a; --text: #d6d6d4; --muted: #8e9196; --line: #383b40;
  --accent: #e8893a; --accent-text: #1a0f05; --danger: #e0564a; --ok: #4fb87a;
  --r-btn: 4px; --r-input: 3px; --radius: 6px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.6); color-scheme: dark;
}
:root[data-theme="studio"] input, :root[data-theme="studio"] textarea, :root[data-theme="studio"] select { background: #141517; }
:root[data-theme="studio"] h3 { color: #a2a5aa; letter-spacing: 0.08em; }
/* Active toggles and segments: lit, not filled (as in Wwise / Resolve toolbars). */
:root[data-theme="studio"] .toggle[aria-pressed="true"] { background: #32353a; border-color: #4a4e55; }
:root[data-theme="studio"] .seg button.on { background: #32353a; color: var(--accent); border-color: #4a4e55; }
:root[data-theme="studio"] .leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
:root[data-theme="night"] {
  --bg: #0e1116; --panel: #171b22; --text: #e9e6df; --muted: #9aa1ab; --line: #2a303a;
  --accent: #f0a93a; --accent-text: #1b1305; --shadow: 0 6px 24px rgba(0, 0, 0, 0.55); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="forest"] { --bg: #111713; --panel: #19211b; --text: #e3ece4; --muted: #98aa9b; --line: #2b3a2f; --accent: #5cbf83; --accent-text: #0c1a10; }
  :root[data-theme="terracotta"] { --bg: #191310; --panel: #231b17; --text: #f1e5dc; --muted: #b39b8d; --line: #3b2d26; --accent: #e57c50; --accent-text: #1e0f08; }
  :root[data-theme="dusk"] { --bg: #14121b; --panel: #1d1a27; --text: #ebe7f6; --muted: #a39bbd; --line: #332d45; --accent: #9c85ef; --accent-text: #150f28; }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

button, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0.5em 0.9em;
  border-radius: var(--r-btn);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); }
button.active { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: 0.5; cursor: default; }
button.big { padding: 0.8em 1.4em; font-size: 1.05rem; font-weight: 600; }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 0.45em 0.6em;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--bg);
  color: var(--text);
}
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="range"] { padding: 0; }
input[type="color"] { padding: 0; height: 2.2em; width: 3.5em; }
label { display: block; margin: 0.6em 0 0.2em; font-size: 0.85rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 0.5em; color: var(--text); font-size: 0.95rem; }
.row { display: flex; gap: 0.6em; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.8em; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.error { color: var(--danger); min-height: 1.2em; font-size: 0.9rem; }

/* ---------- landing ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 2rem 1rem; }
.walk-list { display: grid; gap: 0.8rem; margin-top: 1rem; }
.walk-list a.card { display: block; color: inherit; text-decoration: none; }
.walk-list a.card:hover { border-color: var(--accent); }

/* ---------- editor ---------- */
/*
  Editor layout: a grid with an always-visible top bar, the project panel (left), the map,
  and the properties dock — either a right-hand column (.dock-right) or a band below the
  map (.dock-bottom). .no-project and .no-props hide those panels; the map takes the room.
*/
.editor {
  /* Panel widths shrink on smaller screens so the map always keeps most of the room. */
  --sbw: clamp(250px, 22vw, 340px); --rw: 0px; --bh: 0px;
  display: grid; height: 100vh;
  grid-template-columns: var(--sbw) minmax(0, 1fr) var(--rw);
  grid-template-rows: auto minmax(0, 1fr) var(--bh);
  grid-template-areas: "top top top" "side map right" "side bottom bottom";
}
.editor.dock-right { --rw: clamp(290px, 25vw, 380px); }
.editor.dock-bottom { --bh: 40vh; }
.editor.no-props { --rw: 0px; --bh: 0px; }
.editor.no-props #props { display: none; }
.editor.no-project { --sbw: 0px; }
.editor.no-project .sidebar { display: none; }
.editor .ed-topbar { grid-area: top; }
.editor .sidebar { grid-area: side; }
.editor .map-wrap { grid-area: map; min-height: 0; }
.editor.dock-right #props { grid-area: right; border-left: 1px solid var(--line); }
.editor.dock-bottom #props { grid-area: bottom; border-top: 1px solid var(--line); }

.ed-topbar {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; z-index: 1100;
}
.ed-topbar .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-topbar button { padding: 0.3em 0.7em; font-size: 0.88rem; }
.tb-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.toggle { display: inline-flex; align-items: center; gap: 0.35em; }
.toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: var(--accent); color: var(--text); }
.toggle[aria-pressed="false"] { color: var(--muted); }
.toggle .tg-icon { color: var(--accent); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin: 0; }
.seg button:first-child { border-radius: var(--r-btn) 0 0 var(--r-btn); }
.seg button:last-child { border-radius: 0 var(--r-btn) var(--r-btn) 0; border-left-width: 0; }
.seg button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.seg button:disabled { opacity: 0.45; }

.sidebar { overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }
.sidebar section { padding: 1rem; border-bottom: 1px solid var(--line); }
.sidebar header { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 0.5em; }
.sidebar header .title { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map { height: 100%; width: 100%; }
.map-wrap { position: relative; }
.map-top {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 950;
  display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.map-menus {
  display: flex; gap: 6px; align-items: flex-start; background: var(--panel); padding: 6px;
  border-radius: 10px; box-shadow: var(--shadow);
}
.map-menus select { max-width: 220px; padding: 0.35em 0.5em; }
.layer-menu { position: relative; }
.layers-panel {
  position: absolute; top: calc(100% + 6px); left: 0; width: 270px; max-height: 60vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px;
}
.layers-panel .check { margin: 0.2em 0; font-size: 0.9rem; }
.layers-panel .layer-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 0.6em; }
.layers-panel .swatch { display: inline-block; vertical-align: middle; margin-right: 4px; }
.map-tools {
  margin-left: auto; margin-right: auto;
  background: var(--panel); padding: 6px; border-radius: 10px; box-shadow: var(--shadow);
  display: flex; gap: 6px; flex-wrap: nowrap; justify-content: center; overflow-x: auto; max-width: 100%;
}
/* POI sound objects: a pin at the spot (always clickable, whatever the zoom) */
.poi-pin {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.poi-pin.selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.poi-pin.invisible { opacity: 0.55; border-style: dashed; }
.map-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 500;
  background: rgba(20, 20, 20, 0.85); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 0.9rem;
}
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 0.5em; padding: 0.45em 0.5em; border-radius: 7px; cursor: pointer;
}
.list li:hover { background: var(--bg); }
.list li.selected { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pill { font-size: 0.75rem; padding: 0.1em 0.5em; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill.on { color: var(--ok); border-color: var(--ok); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }
/* Edit handles on the selected object: corners (white), centre (dark, moves it all),
   radius (square, drag sideways to resize), and the small "add a point here" dots. */
.edit-handle { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); }
.edit-handle:hover { transform: scale(1.25); }
.vertex-handle { background: #fff; border: 2px solid #222; border-radius: 50%; cursor: move; }
.center-handle { background: #222; border: 3px solid #fff; border-radius: 50%; cursor: move; }
.radius-handle { background: #fff; border: 2px solid #222; border-radius: 4px; cursor: ew-resize; }
.mid-handle { background: rgba(255, 255, 255, 0.75); border: 1px solid #222; border-radius: 50%; cursor: copy; box-shadow: none; }

.projects { max-width: 820px; margin: 0 auto; padding: 2rem 1rem; }
.projects .card { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.6rem; }
.auth { max-width: 380px; margin: 10vh auto; }

/* Narrow screens: the project panel and the dock overlay the map instead of sharing the width. */
@media (max-width: 800px) {
  .editor, .editor.dock-right, .editor.dock-bottom { --sbw: 0px; --rw: 0px; --bh: 45vh; grid-template-areas: "top top top" "map map map" "bottom bottom bottom"; }
  .editor.no-props { --bh: 0px; }
  .editor .sidebar {
    grid-area: map; z-index: 1050; width: min(88vw, 340px); box-shadow: var(--shadow);
  }
  .editor.dock-right #props, .editor.dock-bottom #props { grid-area: bottom; border-left: 0; border-top: 1px solid var(--line); }
  .seg { display: none; }
  .ed-topbar .toggle { font-size: 0; gap: 0; }
  .ed-topbar .toggle .tg-icon { font-size: 1rem; }
}

/* ---------- player ---------- */
.player { position: fixed; inset: 0; display: flex; flex-direction: column; }
.player .map { flex: 1; }
.player .topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 600; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  display: flex; gap: 8px; align-items: center; pointer-events: none;
}
.player .topbar > * { pointer-events: auto; }
.player .topbar .title {
  flex: 1; background: var(--panel); padding: 8px 12px; border-radius: 10px; box-shadow: var(--shadow);
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 600;
  background: var(--panel); border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
  padding: 14px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom));
  max-height: 60vh; overflow-y: auto;
}
.now-playing { list-style: none; padding: 0; margin: 0.4em 0; }
.now-playing li { display: flex; align-items: center; gap: 0.6em; padding: 0.25em 0; }
.meter { width: 70px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; flex: none; }
.meter > div { height: 100%; background: var(--ok); transition: width 0.4s; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.good { background: var(--ok); }
.status-dot.poor { background: #d99a1c; }
.status-dot.bad { background: var(--danger); }
.you-dot {
  position: relative; width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}
/* The listener's position pulses: two rings, half a beat apart, in the scheme's accent colour. */
.you-dot::before, .you-dot::after, .pin-pulse::before, .pin-pulse::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: var(--accent); opacity: 0; pointer-events: none;
  animation: you-pulse 2s ease-out infinite;
}
.you-dot::after, .pin-pulse::after { animation-delay: 1s; }
@keyframes you-pulse { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(4); opacity: 0; } }
.pin-wrap { position: relative; width: 34px; height: 44px; }
.pin-pulse { position: absolute; left: 17px; top: 42px; width: 0; height: 0; }
@media (prefers-reduced-motion: reduce) {
  .you-dot::before, .you-dot::after, .pin-pulse::before, .pin-pulse::after { animation-duration: 4s; }
}
.sim-banner { background: #d99a1c; color: #111; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; }

/* Player: "listen from a pin" banner and the 🎧 pin marker */
.explore-banner { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; }
.listen-pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: #d9480f; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center;
}
.listen-pin span { transform: rotate(45deg); font-size: 15px; line-height: 1; }
/* Player: keep the layer switcher clear of the title bar */
.player .leaflet-top.leaflet-right { top: calc(max(10px, env(safe-area-inset-top)) + 48px); }

/* Editor: map-style checklist rows */
.layer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.6em; margin: 0.35em 0; }
.layer-row .layer-note { flex-basis: 100%; margin-left: 1.9em; }
.layer-row label.check { margin: 0; }

/* ---------- path + flags ---------- */
.route-arrow { font-size: 11px; line-height: 14px; text-align: center; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.route-end { font: 600 11px/22px system-ui, sans-serif; text-align: center; border-radius: 11px; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); border: 2px solid #fff; }
.route-end.start { background: #1f8a4c; }
.route-end.finish { background: #1c1b19; background-image: repeating-conic-gradient(#1c1b19 0 25%, #555 0 50%); background-size: 8px 8px; }
.flag-pin { position: relative; width: 28px; height: 36px; }
.flag-pin::before { content: ''; position: absolute; left: 3px; top: 2px; width: 2px; height: 32px; background: #1c1b19; }
.flag-pin span {
  position: absolute; left: 5px; top: 2px; min-width: 20px; height: 18px; padding: 0 4px;
  background: #c2255c; color: #fff; font: 700 11px/18px system-ui, sans-serif; text-align: center;
  border-radius: 0 4px 4px 0; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.flag-pin.selected span { outline: 2px solid var(--accent); outline-offset: 1px; }
.flag-desc { margin-top: 0.3em; white-space: pre-line; }
/* Player: ◐ map-shading button */
.player .topbar #shade-btn { width: 40px; height: 40px; padding: 0; box-shadow: var(--shadow); }

/* ---------- editor: properties dock ---------- */
.props { overflow-y: auto; min-height: 0; min-width: 0; background: var(--panel); padding: 12px 14px 14px; }
.props-empty { padding: 1rem 0.2rem; }
.props-empty h2 { font-size: 1rem; }
.props:has(> div:not(.props-empty):not(.hidden)) .props-empty { display: none; }
/* In the bottom dock the settings flow into side-by-side columns. */
.pgroup { min-width: 0; }
.dock-bottom .pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 22px; align-items: start; }
.dock-bottom .pgrid > .pgroup { margin-top: 0; }
.node-nav {
  display: flex; align-items: center; gap: 6px; margin: 0.3em 0 0.4em; padding: 4px 6px;
  border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); font-size: 0.88rem;
}
.node-list li { gap: 0.4em; }
.node-list .node-num {
  flex: none; min-width: 20px; height: 20px; border-radius: 50%; color: #fff; font: 700 11px/20px system-ui, sans-serif; text-align: center;
}
.path-nodes { list-style: none; margin: 0 0 0.3em 1.3em; padding: 0; }
.path-nodes li { padding: 0.25em 0.5em; font-size: 0.9rem; }
.node-marker { font: 700 10px/18px system-ui, sans-serif; color: #fff; text-align: center; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.node-marker { cursor: pointer; }
.node-marker.editable { cursor: move; }
.node-marker.selected { outline: 3px solid var(--accent); outline-offset: 1px; }

/* Colour-scheme swatches in the project panel */
.theme-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; font-size: 0.72rem;
  background: none; border: 2px solid transparent; border-radius: 10px; cursor: pointer; color: var(--text);
}
.theme-swatch[aria-checked="true"] { border-color: var(--accent); }
.theme-swatch .chips3 { display: flex; width: 44px; height: 30px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.theme-swatch .chips3 i { flex: 1; }
.props-head { display: flex; align-items: center; gap: 0.5em; margin-bottom: 0.2em; }
.props-head h2 { margin: 0; font-size: 1rem; }
.props button.icon { padding: 0.2em 0.55em; }
.props input[type=range] { width: 100%; }
.flag-num { background: #c2255c; color: #fff; font: 700 12px/20px system-ui, sans-serif; min-width: 20px; text-align: center; border-radius: 4px; padding: 0 4px; }


/* No focus box around a zone after clicking it; keep the editor toolbar on one line;
   centre the shading button's icon */
.leaflet-interactive:focus { outline: none; }
.map-tools { flex-wrap: nowrap; }
.map-tools button { white-space: nowrap; }
.player .topbar #shade-btn { display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.player .topbar #shade-btn.hidden { display: none; }

/* Player: weather line and the simulator's time / weather controls */
.weather-line { margin: 8px 0 0; }
.sim-controls { margin-top: 10px; padding: 8px 10px; border: 1px dashed #d99a1c; border-radius: 8px; }
.sim-controls input, .sim-controls select { padding: 0.25em 0.4em; }

/* ---------- editor: when it plays ---------- */
.when { margin-top: 0.9em; padding-top: 0.7em; border-top: 1px solid var(--line); }
.when-summary { margin: 0.3em 0 0.5em; font-weight: 600; font-size: 0.9rem; }
.when details { margin-top: 0.6em; }
.when summary { cursor: pointer; font-size: 0.9rem; }
.when .small-btn { font-size: 0.85rem; padding: 0.25em 0.6em; margin-top: 0.3em; }
.win { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 0.4em 0; }
.win .edge { display: flex; gap: 4px; align-items: center; margin-top: 4px; font-size: 0.85rem; }
.win .edge > span { width: 2.6em; color: var(--muted); }
.win .edge select { flex: 1; min-width: 0; }
.win .edge input[type=number] { width: 4.6em; }
.win .edge input[type=time] { width: 6.5em; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 0.8rem; padding: 0.2em 0.55em; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; user-select: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.ghost { border-style: dashed; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 0.6em; }
.cond-icon { font-size: 0.8rem; }

/* Editor: the "Before / after sunrise or sunset" sentence control */
.primary-soft { border-color: var(--accent); color: var(--accent); }
.sun-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.88rem; }
.sun-timer input[type=number] { width: 4.4em; flex: none; padding: 0.25em 0.4em; }
.sun-timer select { width: auto; flex: none; padding: 0.25em 0.3em; }
.when input[type=date] { min-width: 0; width: 100%; }

/* ---------- editor: zone pop-up sub-sections ---------- */
.props .sub { margin-top: 0.9em; padding-top: 0.6em; border-top: 1px solid var(--line); }
.props .sub h3 { margin: 0 0 0.3em; }
.props .indent { margin-left: 1.9em; font-size: 0.88rem; gap: 0.35em; }
.props .grid3 input { min-width: 0; width: 100%; }
.atten-graph { height: 34px; margin-top: 6px; border-radius: 6px; background: var(--bg); position: relative; overflow: hidden; }
.atten-graph svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.group-badge { font-size: 0.7rem; padding: 0 0.4em; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }

/* ---------- player: debug panel ---------- */
.player .topbar #debug-btn { width: 40px; height: 40px; padding: 0; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.debug-panel {
  position: absolute; z-index: 650; left: 10px; right: 10px; top: calc(max(10px, env(safe-area-inset-top)) + 50px);
  max-height: 42vh; overflow-y: auto; padding: 8px 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.dbg-head { color: var(--muted); margin-bottom: 4px; }
.dbg-title { font-weight: 700; margin: 6px 0 2px; font-family: system-ui, sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.dbg-empty { color: var(--muted); }
.dbg-item { margin: 4px 0 6px; }
.dbg-row { display: flex; align-items: center; gap: 6px; }
.dbg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dbg-tags span { font-size: 10px; padding: 0 5px; margin-left: 3px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); }
.dbg-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 3px 0 2px; }
.dbg-bar > div { height: 100%; transition: width 0.25s linear; }
.dbg-meta { color: var(--muted); gap: 10px; }
.dbg-silent { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.dbg-silent .dbg-name { flex: 0 1 auto; max-width: 40%; font-weight: 500; }

/* ---------- accounts: top bar, sign-in panes, My account, Administration ---------- */
.topnav {
  display: flex; align-items: center; gap: 0.4em; padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 10;
}
.topnav .brand { margin-right: 0.8em; }
.topnav button.active { border-color: var(--accent); color: var(--accent); }
.badge { display: inline-block; min-width: 1.4em; padding: 0 0.4em; border-radius: 99px; background: var(--danger); color: #fff; font-size: 0.75rem; line-height: 1.4em; text-align: center; }
.pill.warn { color: #b25e00; border-color: #d99a1c; }
.warn-text { color: #b25e00; }
.ok-text { color: var(--ok); }
.auth .auth-pane input { width: 100%; }
.card.acct { margin-bottom: 1rem; display: block; }
.card.acct h2 { margin: 0 0 0.3em; font-size: 1.05rem; }
.card.acct input, .card.acct textarea { width: 100%; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.admin-box { margin-top: 0.8em; padding: 0.6em 0.8em; border: 1px dashed #d99a1c; border-radius: 8px; }
.admin-box input { width: 100%; }
.owner-banner { padding: 0.5rem 1rem; background: color-mix(in srgb, #d99a1c 25%, var(--panel)); font-size: 0.85rem; border-bottom: 1px solid var(--line); }
.projects.admin { max-width: 1100px; }
.stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.8rem; min-width: 6.5rem; }
.stat strong { display: block; font-size: 1.3rem; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.tabs { display: flex; gap: 0.3rem; margin: 0.8rem 0; border-bottom: 1px solid var(--line); }
.tabs button { border-radius: 8px 8px 0 0; border-bottom: 0; }
.tabs button.active { background: var(--panel); border-color: var(--accent); color: var(--accent); }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin: 0.6rem 0; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table tr[data-user] { cursor: pointer; }
.table tr[data-user]:hover, .table tr.selected { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.table input[data-note] { width: 100%; min-width: 8em; }
.nowrap { white-space: nowrap; }
#admin-user, #admin-new { display: block; margin-top: 1rem; }
#admin-new summary { cursor: pointer; }
#admin-user h3 { margin-top: 1.2em; }
.copy-row { display: flex; gap: 0.4em; margin-top: 0.5em; }
.copy-row input { flex: 1; font-size: 0.8rem; }
.card.message { display: block; margin-bottom: 0.6rem; }
.card.message.unread { border-left: 4px solid var(--accent); }
@media (max-width: 800px) {
  .table { display: block; overflow-x: auto; }
  .topnav { flex-wrap: wrap; }
}

/* ---------- home page map of live walks ---------- */
.home-map { height: 45vh; min-height: 260px; border-radius: 12px; border: 1px solid var(--line); margin: 1rem 0; }
.walk-list .by { font-size: 0.85rem; color: var(--muted); }

/* The Properties switch glows when something is selected while the dock is off. */
.toggle.attn { animation: attn 1.2s ease-in-out 3; border-color: var(--accent); }
@keyframes attn { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); } }

/* Player: pulsing ring on the path node to head for next (colour = the path's colour). */
.node-pulse { position: relative; width: 22px; height: 22px; }
/* The halo: a soft glow that breathes, under the rings. */
.node-pulse s {
  position: absolute; inset: -18px; border-radius: 50%; text-decoration: none;
  background: radial-gradient(circle, currentColor 0%, transparent 70%); opacity: 0.35;
  animation: node-halo 1.8s ease-in-out infinite;
}
@keyframes node-halo { 50% { opacity: 0.6; transform: scale(1.15); } }
.node-pulse b { position: absolute; inset: 4px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px #fff; }
.node-pulse i {
  position: absolute; inset: 0; border-radius: 50%; border: 3px solid currentColor;
  animation: node-pulse 1.8s ease-out infinite;
}
.node-pulse i + i { animation-delay: 0.9s; }
@keyframes node-pulse { from { transform: scale(0.6); opacity: 0.95; } to { transform: scale(3.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .node-pulse i { animation-duration: 4s; } }
@media (max-width: 800px) {
  .map-tools { justify-content: flex-start; padding: 4px; gap: 4px; margin-left: 0; }
  .map-menus select { max-width: 150px; }
  .map-tools button { padding: 0.3em 0.55em; font-size: 0.85rem; }
}

/* Editor: Listen mode — the visitor token and the listen bar over the map */
.visitor-token { position: relative; width: 34px; height: 34px; cursor: grab; }
.visitor-token b {
  position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 400; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  background: conic-gradient(from 20deg, #ff4d6d, #ffb703, #3ddc97, #3a86ff, #b5179e, #ff4d6d);
}
.visitor-token i {
  position: absolute; inset: 0; border-radius: 50%; border: 3px solid #ff4d6d; opacity: 0;
  animation: visitor-pulse 1.8s ease-out infinite;
}
.visitor-token i + i { border-color: #3a86ff; animation-delay: 0.9s; }
@keyframes visitor-pulse { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(2.6); opacity: 0; } }
.listen-bar {
  position: absolute; left: 12px; bottom: 28px; z-index: 900; width: min(360px, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 12px; max-height: 45%; overflow-y: auto;
}
.listen-bar .row { gap: 6px; }
.listen-bar button { padding: 0.25em 0.6em; font-size: 0.85rem; }
.listen-badge { font-weight: 600; white-space: nowrap; }
.listen-bar .now-playing li { cursor: pointer; }
.editor.listening .map-hint { bottom: auto; top: 64px; }
.pin-wrap .listen-pin { position: relative; }

/* "When it plays": one labelled row each for days, times and moon */
.when-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 0.6em; }
.when-label { flex: none; width: 3.6em; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding-top: 0.45em; }
.when-row .chips { margin-top: 0; }
.when-row .grow { flex: 1; min-width: 0; }
.win.clock .row { gap: 6px; font-size: 0.9rem; }
.win.clock input[type=time] { width: 7em; }

/* The map's top bar: tool labels give way to icons when the map is narrow (each keeps its tooltip). */
.map-wrap { container-type: inline-size; }
@container (max-width: 960px) {
  .map-tools .lbl { display: none; }
  .map-tools button { min-width: 38px; }
  .map-menus select { max-width: 170px; }
}

/* The top bar's visibility badge is a button that jumps to "Visible to listeners". */
.pill-button { cursor: pointer; background: none; font: inherit; font-size: 0.75rem; }
.ed-topbar .pill-button { padding: 0.15em 0.6em; }

/* Listen mode: the Map state panel */
.ms-toggle { display: flex; gap: 6px; width: 100%; margin-top: 6px; text-align: left; font-size: 0.85rem; }
.ms-toggle .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-toggle.set { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.ms-panel { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.ms-sec { margin: 0.5em 0; }
.ms-h { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.ms-panel .row { flex-wrap: wrap; gap: 4px; align-items: center; }
.ms-panel input[type=date], .ms-panel input[type=time] { width: auto; }
.ms-avail { list-style: none; margin: 0; padding: 0; }
.ms-avail li { padding: 2px 0; }
.listen-bar.ms-open { max-height: calc(100% - 90px); width: min(400px, calc(100% - 24px)); }
.ms-panel select, .ms-panel input[type=number] { width: auto; }
.ms-panel .row > * { flex: none; }
#layers-btn { white-space: nowrap; }
.listen-bar.ms-open { max-height: calc(100% - 120px); }

/* Player: the current-state widget under the title */
.state-widget {
  position: absolute; z-index: 620; left: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 50px);
  max-width: min(330px, calc(100% - 80px));
}
#state-btn {
  background: var(--panel); box-shadow: var(--shadow); border-radius: 10px; padding: 6px 10px;
  font-size: 0.88rem; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.state-sim { font-size: 0.7rem; background: #d99a1c; color: #111; border-radius: 4px; padding: 0 4px; }
.state-card {
  margin-top: 6px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 12px; font-size: 0.88rem; max-height: 45vh; overflow-y: auto;
}
.state-row { display: flex; gap: 8px; padding: 2px 0; }
.state-label { flex: none; width: 6.6em; color: var(--muted); font-size: 0.8rem; padding-top: 1px; }
.state-note { margin: 0 0 6px; font-size: 0.8rem; background: color-mix(in srgb, #d99a1c 25%, var(--panel)); border-radius: 6px; padding: 3px 6px; }
/* Swatches share the panel width evenly, however narrow it is. */
.theme-swatches { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.theme-swatch { min-width: 0; padding: 6px 0; }
.theme-swatch .chips3 { width: 100%; max-width: 44px; }
/* Daily times: room for "05:00 PM" in 12-hour locales; wraps tidily when narrow. */
.win.clock .row { flex-wrap: wrap; }
.win.clock input[type=time] { width: auto; min-width: 8.2em; flex: none; }

/* Player: the pop-up on a zone with "When it plays" conditions */
.zone-info .leaflet-popup-content { margin: 10px 12px; font-size: 0.9rem; line-height: 1.4; }
.zone-info-now { margin-top: 6px; color: #7a4a00; }
.zone-info-now.ok { color: #1f7a45; }

/* Player: which way the listener faces (a small wedge on their dot), for 3D sound */
.you-cone {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin-left: -9px; margin-top: -30px;
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 22px solid var(--accent);
  opacity: 0.55; transform-origin: 9px 30px; pointer-events: none;
}

/* Editor Listen mode: which way the visitor faces */
.visitor-arrow {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin-left: -8px; margin-top: -34px; z-index: 1;
  border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 14px solid #3a86ff;
  transform-origin: 8px 34px; pointer-events: none; filter: drop-shadow(0 0 1px #fff);
}
.listen-facing { min-width: 4.6em; text-align: center; font-variant-numeric: tabular-nums; }
#listen-3d-row { gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }

/* Editor: a sound object's list of files and its container settings */
.file-list li { gap: 0.35em; padding: 0.25em 0.4em; cursor: default; }
.file-list .num { color: var(--muted); min-width: 1.4em; font-size: 0.85rem; }
.file-list button { padding: 0.1em 0.45em; font-size: 0.85rem; }
#z-add-file { margin-top: 4px; }
.container-box { margin-top: 0.6em; padding: 0.5em 0.6em; border: 1px solid var(--line); border-radius: 8px; }
.gap-sliders, .vary-sliders { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.gap-sliders input, .vary-sliders input { width: 100%; }

.container-box .box-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 0.3em; }
#z-prewait { width: 100%; }

/* Panic: stop every sound and reset them (player and Listen mode). */
button.panic {
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}
button.panic:hover {
  background: var(--danger);
  color: #fff;
}

/* Buses in the Project panel: one row per bus. */
.bus-row {
  border: 1px solid var(--line, #ddd);
  border-radius: 8px;
  padding: 6px 8px;
  margin: 6px 0;
}
.bus-row .row { gap: 4px 10px; flex-wrap: wrap; align-items: center; margin: 3px 0; }
.bus-row label { display: inline-flex; gap: 4px; align-items: center; margin: 0; font-size: 0.85rem; white-space: nowrap; }
.bus-row input[type="text"] { flex: 1; min-width: 7em; width: auto; }
.bus-row input[type="number"] { width: 4.2em; padding: 2px 4px; margin: 0; }
.bus-ducks { margin: 2px 0 4px; display: grid; gap: 2px; }
.bus-row label.duck-row { display: grid; grid-template-columns: 5.5em 1fr 7.5em; gap: 6px; align-items: center; white-space: normal; }
.duck-name { overflow: hidden; text-overflow: ellipsis; }
.duck-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.listen-buses { margin: 0.2em 0; }

/* Popups: messages, pictures and videos shown while the listener is inside a sound object. */
.popup-stack {
  position: absolute;
  top: 58px;
  right: 10px;
  z-index: 1100;
  width: min(380px, calc(100% - 20px));
  max-height: calc(100% - 200px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.popup-stack.in-editor { top: 70px; max-height: calc(100% - 90px); }
.popup-card {
  position: relative;
  background: var(--panel, #fff);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  padding: 12px 14px;
  animation: popup-in 0.25s ease-out;
}
@keyframes popup-in { from { opacity: 0; transform: translateY(-8px); } }
.popup-card h3 { margin: 0 2em 0.4em 0; font-size: 1.05rem; text-transform: none; letter-spacing: normal; color: var(--text); }
.popup-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
}
.popup-media img, .popup-media video { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 8px; background: #000; }
.popup-media + .popup-text { margin-top: 0.6em; }
.popup-embed { position: relative; padding-top: 56.25%; margin-top: 4px; }
.popup-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }
.popup-text { margin: 0; white-space: normal; overflow-wrap: anywhere; }
.popup-link { display: inline-block; margin-top: 0.6em; }
@media (max-width: 600px) {
  .popup-stack { left: 10px; right: 10px; width: auto; }
}

/* Drag and drop (editor-dragdrop.js) */
.drop-over { outline: 3px dashed var(--accent, #5b4bd6); outline-offset: -3px; background-image: linear-gradient(color-mix(in srgb, var(--accent, #5b4bd6) 8%, transparent), color-mix(in srgb, var(--accent, #5b4bd6) 8%, transparent)); }
path.drop-zone { stroke-width: 6px; stroke-dasharray: 8 5; fill-opacity: 0.45; }
.poi-pin.drop-zone, .leaflet-marker-icon.drop-zone { transform-origin: center; filter: drop-shadow(0 0 6px var(--accent, #5b4bd6)); }
#audio-list li[draggable], #media-list li[draggable] { cursor: grab; }
#media-list .thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.drop-tip { margin: 0.6em 0 0; }
.drop-toast {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1200;
  background: var(--panel); color: var(--text); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 14px; max-width: min(520px, calc(100% - 24px)); font-size: 0.9rem;
}
.drop-toast.bad { color: var(--danger); }

/* Project panel tabs: Walk and Media */
.side-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 5; }
.side-tabs button {
  flex: 1; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; background: none;
  padding: 7px 10px; font-weight: 600; color: var(--muted); margin-bottom: -1px;
}
.side-tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); border-color: var(--line); border-bottom: 1px solid var(--panel); }
.tab-count { display: inline-block; min-width: 1.4em; padding: 0 0.4em; border-radius: 99px; background: var(--line); color: var(--text); font-size: 0.75rem; font-weight: 600; }
.tab-count:empty { display: none; }

/* Media tab: thumbnails of pictures and videos */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.media-tile { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); cursor: grab; }
.media-tile .tile-thumb { position: relative; aspect-ratio: 4 / 3; background: #000; display: flex; align-items: center; justify-content: center; }
.media-tile .tile-thumb a { display: block; width: 100%; height: 100%; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .tile-play { position: absolute; inset: 0; margin: auto; width: 38px; height: 38px; border-radius: 50%; padding: 0; background: rgba(0, 0, 0, 0.55); color: #fff; border: 2px solid #fff; }
.media-tile figcaption { padding: 4px 6px 5px; display: flex; flex-direction: column; min-width: 0; }
.media-tile figcaption .name { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-tile .tile-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity 0.15s; }
.media-tile:hover .tile-actions, .media-tile:focus-within .tile-actions { opacity: 1; }
.media-tile .tile-actions button { width: 26px; height: 26px; padding: 0; border-radius: 6px; background: var(--panel); font-size: 0.8rem; }
@media (hover: none) { .media-tile .tile-actions { opacity: 1; } }
#upload-error:empty { display: none; }
#audio-list li { gap: 6px; }
#audio-list .name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
#audio-list .name-wrap .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#audio-list li { gap: 4px; }
#audio-list li button { width: 26px; height: 28px; padding: 0; flex: none; font-size: 0.8rem; }
/* While files are dragged over the Project panel (either tab): say what dropping does. */
#ed-sidebar.drop-over::before {
  content: '⬇ Drop to upload to Media';
  position: sticky; top: 0; z-index: 10; display: block;
  padding: 10px 12px; text-align: center; font-weight: 600;
  background: var(--accent); color: var(--accent-text);
}

/* Guidance along paths (guide.js): the compass bar and the 🧭 button */
.compass-bar {
  position: absolute; z-index: 1050; left: 50%; transform: translateX(-50%);
  top: calc(max(10px, env(safe-area-inset-top)) + 110px);
  width: min(460px, calc(100% - 24px));
  display: flex; align-items: stretch; gap: 4px;
  background: var(--panel); color: var(--text); border-radius: 12px; box-shadow: var(--shadow, 0 6px 24px rgba(0,0,0,.25));
  padding: 4px 4px 4px 0;
}
.compass-bar.in-editor { top: 70px; width: min(420px, calc(100% - 330px)); }
/* On narrow screens, leave the right-hand column for the map's buttons (layers, compass). */
@media (max-width: 600px) {
  .compass-bar:not(.in-editor) { left: 12px; transform: none; width: calc(100% - 80px); }
}
.cbar-track {
  position: relative; flex: 1; height: 58px; overflow: hidden;
  /* the ends fade out, like a strip curving away */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}
.cbar-scale { position: absolute; left: 0; top: 0; height: 100%; transition: transform 0.25s ease-out; }
.cbar-tick { position: absolute; top: 5px; width: 1px; height: 7px; background: var(--muted); }
.cbar-word { position: absolute; top: 1px; transform: translateX(-50%); font-size: 0.78rem; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.cbar-word.north { color: #d33a2c; }
.cbar-mid { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 0; height: 0; border: 6px solid transparent; border-top-color: var(--text); }
.cbar-dots { position: absolute; inset: 0; }
.cbar-dot { position: absolute; top: 20px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 1px; transition: left 0.25s ease-out; }
.cbar-dot i { width: 14px; height: 14px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--dot); }
.cbar-dot.main i { width: 18px; height: 18px; }
.cbar-dot b { font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A node off to the side or behind: at the edge, pointing the way to turn. */
.cbar-dot.edge i { border-radius: 3px; clip-path: polygon(0 50%, 100% 0, 100% 100%); box-shadow: none; }
.cbar-dot.edge.right i { clip-path: polygon(100% 50%, 0 0, 0 100%); }
.cbar-close { flex: none; align-self: center; width: 30px; height: 30px; padding: 0; border-radius: 50%; }
#guide-btn.off { opacity: 0.55; }
#guide-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }


/* The compass button (maprotate.js): north up, or the map turns with the listener */
.map-compass {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.map-compass svg { width: 28px; height: 28px; transition: rotate 0.3s ease; }
.map-compass .n { fill: #d33a2c; }
.map-compass .s { fill: var(--muted); }
.map-compass.active { background: var(--accent); border-color: var(--accent); }
.map-compass.active .s { fill: var(--accent-text); }
/* The map's content turns smoothly; labels and pins are turned back upright. */
.leaflet-map-pane { transition: rotate 0.3s linear; }
.leaflet-dragging .leaflet-map-pane, .leaflet-zoom-anim .leaflet-map-pane { transition: none; }
.map-rotated .route-end, .map-rotated .flag-pin, .map-rotated .poi-pin, .map-rotated .pin-wrap,
.map-rotated .leaflet-popup-content-wrapper { rotate: var(--unrotate); }
.map-rotated .poi-pin { transform-origin: 50% 118%; }
.map-rotated .flag-pin { transform-origin: 14% 94%; }
.map-rotated .pin-wrap { transform-origin: 50% 95%; }

/* The waveform editor (editor-wave.js) */
.wave-dlg {
  width: min(900px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
  border: none; border-radius: 14px; padding: 14px 16px; background: var(--panel); color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.wave-dlg::backdrop { background: rgba(0, 0, 0, 0.45); }
.wv-wrap { position: relative; }
#wv-canvas { width: 100%; height: 160px; display: block; border-radius: 8px; border: 1px solid var(--line); touch-action: none; }
.wv-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; }
.wv-play { margin: 8px 0; gap: 10px; align-items: center; }
#wv-time { font-variant-numeric: tabular-nums; }
.wv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.wv-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.wv-box h3 { margin: 0 0 6px; font-size: 0.95rem; }
.wv-box .row { gap: 6px; flex-wrap: wrap; align-items: center; }
.wv-box label { margin: 0; }
.wv-box input[type="number"] { width: 5.5em; }
.wv-box p { margin: 0.4em 0 0; }
.cover-thumb { width: 44px; height: 33px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); flex: none; }

/* The list of sound walks (player-walks.js): a panel on the left */
.walks-panel {
  position: absolute; z-index: 1300; top: 0; left: 0; bottom: 0; width: min(360px, 88%);
  background: var(--panel); color: var(--text); box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
  animation: walks-in 0.2s ease-out;
}
@keyframes walks-in { from { transform: translateX(-100%); } }
.walks-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 16px; }
.walks-head h2 { margin: 0; font-size: 1.15rem; }
.walks-tabs { display: flex; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.walks-tabs button { flex: 1; border-radius: 99px; padding: 6px 8px; font-weight: 600; background: none; border: 1px solid var(--line); color: var(--muted); }
.walks-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.walks-list { list-style: none; margin: 0; padding: 6px 8px; overflow-y: auto; flex: 1; }
.walk-item { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: 10px; border: 1px solid transparent; background: none; color: inherit; }
.walk-item:hover { background: var(--bg); }
.walk-item.current { border-color: var(--accent); }
.walk-item img, .walk-thumb { width: 56px; height: 42px; border-radius: 6px; object-fit: cover; flex: none; }
.walk-thumb { display: inline-flex; align-items: center; justify-content: center; background: var(--bg); font-size: 1.3rem; color: var(--muted); }
.walk-words { display: flex; flex-direction: column; min-width: 0; }
.walk-words strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.walks-empty { padding: 0 16px; }
.player .topbar .title { cursor: pointer; }

/* The intro screen: the walk's title picture and caption */
.intro-screen {
  position: absolute; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); padding: 16px;
}
.intro-card {
  position: relative; width: min(480px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--panel); color: var(--text); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: popup-in 0.25s ease-out;
}
.intro-card img { display: block; width: 100%; max-height: 55vh; object-fit: cover; }
.intro-text { padding: 14px 18px 18px; }
.intro-text h2 { margin: 0 0 2px; }
.intro-text p { margin: 0.4em 0; white-space: pre-line; }
.intro-text .primary { margin-top: 0.6em; }
.intro-close {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff; border: none; font-size: 1rem; z-index: 1;
}

/* The map of all sound walks (/walks, player-walks.js) */
.player.overview #state-widget, .player.overview #debug-btn, .player.overview #guide-btn,
.player.overview #shade-btn, .player.overview #recenter, .player.overview #guide-bar { display: none !important; }
.player.overview .sheet > :not(#overview-sheet) { display: none !important; }
.player.overview .topbar .title { cursor: default; }
.walk-label {
  display: inline-block; white-space: nowrap; transform: translate(-50%, -130%);
  background: var(--panel); color: var(--text); font-weight: 600; font-size: 0.85rem;
  padding: 3px 9px; border-radius: 99px; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); cursor: pointer;
}
.walk-pop img { display: block; width: 100%; max-height: 120px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.walk-pop .btn { display: inline-block; margin-top: 8px; color: var(--accent-text); }
.walks-back { display: flex; flex-direction: column; gap: 2px; padding: 4px 16px 8px; }
.walks-back .btn { align-self: flex-start; }
/* "Near me": the distance slider, and its circle on the map */
.walks-radius { padding: 8px 16px 4px; border-bottom: 1px solid var(--line); }
.walks-radius label { display: block; margin: 0 0 2px; color: var(--text); }
.walks-radius input[type="range"] { width: 100%; }
.walks-radius p { margin: 2px 0 0; }
.walks-radius p:empty { display: none; }
path.walks-radius-circle { stroke: var(--accent); }

/* Undo / redo (editor-history.js) */
.ed-topbar .icon-btn { width: 34px; padding: 4px 0; font-size: 1.1rem; }
.ed-topbar .icon-btn:disabled { opacity: 0.35; }

/* Duplicate, copy and paste settings (editor-copy.js) */
.z-actions { gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.paste-dlg { width: min(460px, calc(100vw - 24px)); border: none; border-radius: 14px; padding: 16px 18px; background: var(--panel); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.paste-dlg::backdrop { background: rgba(0, 0, 0, 0.45); }
.paste-dlg label.check { margin: 0.35em 0; }

/* Stem sets (stems.js): the Project panel's list, the sound object's "Plays", Listen mode's faders */
.stemset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 6px 0; }
.stemset .row { gap: 6px 10px; flex-wrap: wrap; align-items: center; margin: 3px 0; }
.stemset label { display: inline-flex; gap: 4px; align-items: center; margin: 0; font-size: 0.85rem; white-space: nowrap; }
.stemset input[type="text"] { flex: 1; min-width: 7em; width: auto; }
.stemset input[type="number"] { width: 4.5em; padding: 2px 4px; margin: 0; }
.stemset select { width: auto; }
.stem-list { list-style: none; padding: 0; margin: 4px 0; }
.stem-list li { display: flex; gap: 4px; align-items: center; margin: 3px 0; }
.stem-list li input[type="text"] { width: 6.5em; flex: none; }
.stem-list li select { flex: 1; min-width: 0; }
#zone-panel.is-stem .not-stem { display: none !important; }
.listen-stems { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.stem-faders { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.stem-fader { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; }
.stem-track { position: relative; width: 10px; height: 44px; border-radius: 5px; background: var(--line); overflow: hidden; }
.stem-track i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ok, #2f9e44); transition: height 0.3s; }
.stem-name { font-size: 0.7rem; max-width: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }


/* Cue sounds (entry / exit) in the sound object panel */
.cue-row { display: flex; align-items: center; gap: 8px; margin-top: 0.4em; }
.cue-row label { margin: 0; min-width: 4.5em; }
.cue-row select { flex: 1; min-width: 0; }
.cue-opts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0.2em 0 0 0.5em; }
.cue-opts label { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.cue-opts input[type="range"] { width: 90px; }
.cue-opts input[type="number"] { width: 4.5em; padding: 2px 4px; margin: 0; }
.cue-opts select { width: auto; padding: 2px 4px; margin: 0; }
.cue-opts label { flex-wrap: wrap; }

/* Saving (editor-save.js): Save, Save as…, Revert and the status beside them */
.save-status { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.save-status.unsaved { color: #b25e00; font-weight: 600; }

/* Access codes, QR code and statistics (editor-access.js) */
.acc-make { gap: 6px; flex-wrap: wrap; align-items: center; }
.acc-make input[type="number"], .acc-make input[type="date"] { padding: 2px 4px; margin: 0; }
.acc-table-wrap { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-input); }
.acc-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.acc-table th, .acc-table td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.acc-table th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 600; }
.acc-actions { text-align: right; }
.acc-actions button { padding: 1px 6px; margin-left: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; }
.qr-img { width: 104px; height: 104px; background: #fff; padding: 4px; border-radius: var(--r-input); flex: none; }
.st-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0.6em 0; }
.st-tile { border: 1px solid var(--line); border-radius: var(--r-input); padding: 6px; text-align: center; }
.st-num { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.st-label { font-size: 0.72rem; color: var(--muted); }
.st-chart { position: relative; }
.st-chart svg { display: block; width: 100%; height: auto; }
.st-legend { display: flex; gap: 12px; font-size: 0.75rem; color: var(--muted); margin-bottom: 2px; }
.st-legend i, .st-tip i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.st-grid { stroke: var(--line); stroke-width: 1; }
.st-axis { fill: var(--muted); font-size: 10px; }
.st-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.st-tip { position: absolute; top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-input); padding: 5px 8px; font-size: 0.75rem; box-shadow: var(--shadow); pointer-events: none; min-width: 110px; }
.st-tip div { display: flex; align-items: center; gap: 2px; }
.st-tip b { margin-left: auto; padding-left: 10px; font-variant-numeric: tabular-nums; }
.st-chart svg .hidden { display: none; }

/* The listener's page: the code screen, and the coordinates at the bottom edge of the map */
.lock-form { margin-top: 0.8em; }
.lock-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.lock-form input { text-transform: uppercase; letter-spacing: 0.08em; }
.gps-widget {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 590; bottom: 40vh;
  display: flex; align-items: center; gap: 2px; max-width: calc(100% - 20px);
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line);
  border-radius: 99px; box-shadow: var(--shadow); padding: 2px 4px 2px 10px;
}
.gps-copy { border: 0; background: none; padding: 3px 4px; font-size: 0.78rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.gps-copy .muted { margin-left: 6px; }
.gps-x { border: 0; background: none; padding: 2px 6px; color: var(--muted); font-size: 0.8rem; }
.gps-widget.stale .gps-copy { color: var(--muted); }
/* The fade perimeter's handle (editor.js bandHandles): a diamond on the dashed inner line */
.band-handle { background: none; border: 0; cursor: move; }
.band-handle::after { content: ''; position: absolute; inset: 2px; background: #fff; border: 2px solid #222; border-radius: 2px; transform: rotate(45deg); }

/* Discovery (player.js): the list in the top margin, the pop-up, and the look of the areas */
.disc-widget { position: absolute; z-index: 615; left: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 92px); max-width: min(300px, calc(100% - 80px)); }
#disc-btn { background: var(--panel); box-shadow: var(--shadow); border-radius: 10px; padding: 5px 10px; font-size: 0.85rem; white-space: nowrap; }
.disc-list { list-style: none; margin: 6px 0 0; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow-y: auto; min-width: 220px; }
.disc-list li { margin: 0; }
.disc-list button, .disc-list .disc-unknown { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; background: none; color: var(--text); font-size: 0.88rem; text-align: left; border-radius: 6px; }
.disc-list button:hover { background: var(--bg); }
.disc-list .disc-unknown { color: var(--muted); font-style: italic; }
.disc-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px dashed var(--muted); }
.disc-list button .disc-dot { border: 0; }
.disc-ok { margin-left: auto; color: var(--ok); font-weight: 700; }
.disc-toast {
  position: absolute; z-index: 1250; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 130px);
  transform: translateX(-50%); display: flex; align-items: center; gap: 10px; pointer-events: none;
  background: var(--panel); color: var(--text); border: 1px solid var(--accent); border-radius: 99px;
  padding: 8px 18px 8px 10px; box-shadow: var(--shadow); font-weight: 600; width: max-content; max-width: calc(100vw - 32px); opacity: 0;
}
.disc-toast.show { animation: disc-toast 2.85s ease-in-out forwards; }
.disc-toast.show .disc-star { animation: disc-star 1.2s ease-out; }
.disc-star { color: #f5b301; font-size: 1.5rem; line-height: 1; display: inline-block; text-shadow: 0 0 8px rgba(245, 179, 1, 0.6); }
@keyframes disc-toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 14% { opacity: 1; transform: translate(-50%, 0); } 84% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }
@keyframes disc-star { 0% { transform: scale(0.2) rotate(-180deg); } 60% { transform: scale(1.35) rotate(15deg); } 100% { transform: scale(1) rotate(0); } }
.disc-check { width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
path.zone-playing { animation: zone-playing 1.6s ease-in-out infinite; }
@keyframes zone-playing { 50% { fill-opacity: 0.5; stroke-width: 4; } }
.player.overview .disc-widget { display: none !important; }
@media (prefers-reduced-motion: reduce) { .disc-toast.show, .disc-toast.show .disc-star, path.zone-playing { animation: none; } .disc-toast.show { opacity: 1; } }

/* The sound walks drawer (player-walks.js): level 1 (the walks) and level 2 (one walk) */
.walks-scrim { position: absolute; inset: 0; z-index: 1290; background: rgba(0, 0, 0, 0.45); animation: scrim-in 0.2s ease-out; }
@keyframes scrim-in { from { opacity: 0; } }
.wp-level { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.walks-sort { display: flex; align-items: center; gap: 6px; padding: 4px 16px 8px; }
.walks-sort button { border-radius: 99px; padding: 4px 12px; font-size: 0.85rem; background: none; border: 1px solid var(--line); color: var(--muted); }
.walks-sort button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.walks-group { padding: 10px 8px 2px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.walk-go { margin-left: auto; color: var(--muted); font-size: 1.4rem; line-height: 1; padding-left: 6px; }
.walks-foot { padding: 8px 16px 12px; border-top: 1px solid var(--line); }
.walks-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.wp-back { background: none; border: 0; padding: 6px 4px; color: var(--accent); font-weight: 600; }
.wp-scroll { flex: 1; overflow-y: auto; padding: 0 16px 12px; min-height: 0; }
.wp-img { display: block; width: calc(100% + 32px); margin: 0 -16px 12px; max-height: 38vh; object-fit: cover; }
.wp-scroll h2 { margin: 0 0 2px; font-size: 1.3rem; }
.wp-scroll p { margin: 0.3em 0; }
.wp-scroll p:empty { display: none; }
.wp-caption { font-style: italic; white-space: pre-line; }
.wp-desc { white-space: pre-line; line-height: 1.5; margin-top: 0.6em; }
.wp-actions { display: flex; gap: 8px; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.wp-actions .primary { flex: 1; justify-content: center; }
path.walk-outline { cursor: pointer; }

/* The editor's Inbox (editor-inbox.js) */
.ib-filters { gap: 8px; flex-wrap: wrap; margin: 0.6em 0 1em; }
.ib-filters select { width: auto; }
.ib-list { display: flex; flex-direction: column; gap: 10px; }
.ib-list .card.ib-item { display: block; padding: 10px 12px; margin: 0; }
.ib-item.ib-new { border-left: 3px solid var(--accent); }
.ib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ib-head .pill { margin-left: 4px; }
.ib-del { margin-left: auto; }
.ib-stars { color: #f5b301; letter-spacing: 1px; }
.ib-off { color: var(--line); }
.ib-text { white-space: pre-line; margin: 0.5em 0; }
.ib-show { gap: 8px; align-items: center; margin-top: 4px; }
.ib-show .seg button { padding: 3px 10px; font-size: 0.82rem; }

/* Ratings, reviews, feedback and sharing on the listener's page (player-social.js) */
.rate-btn {
  position: absolute; left: 12px; bottom: 40vh; z-index: 595; border-radius: 99px; padding: 5px 12px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 0.85rem; color: var(--text); white-space: nowrap;
}
.rate-btn::first-letter { color: #f5b301; }
@media (max-width: 560px) {
  /* Narrow: the coordinates move to the right so the Rate button keeps the left */
  .gps-widget { left: auto; right: 10px; transform: none; max-width: calc(100% - 170px); }
}
.rate-offer {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 1240; top: calc(max(10px, env(safe-area-inset-top)) + 130px);
  display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--accent);
  border-radius: 99px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); width: max-content; max-width: calc(100vw - 32px);
  animation: rate-offer-in 0.4s ease-out;
}
.rate-offer { top: calc(max(10px, env(safe-area-inset-top)) + 190px); } /* below the discovery pop-up */
.wp-actions .primary { white-space: nowrap; padding-inline: 10px; }
.rate-offer .icon { border: 0; background: none; color: var(--muted); padding: 4px 8px; }
@keyframes rate-offer-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.dlg { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.45); }
.dlg-card {
  position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--panel); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.dlg-card h2 { margin: 0 2em 0 0; font-size: 1.15rem; }
.dlg-card textarea, .dlg-card input { width: 100%; box-sizing: border-box; }
.dlg-card label { margin-top: 6px; font-weight: 600; }
.dlg-card p { margin: 2px 0; }
.dlg-x { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--muted); font-size: 1.1rem; padding: 4px 8px; }
.dlg-count { text-align: right; }
.stars-pick { display: flex; gap: 4px; margin-top: 6px; }
.stars-pick button { border: 0; background: none; font-size: 2.2rem; line-height: 1; padding: 0 2px; color: var(--line); cursor: pointer; transition: transform 0.1s; }
.stars-pick button.on { color: #f5b301; }
.stars-pick button:hover { transform: scale(1.12); }
.reviews-sum { font-size: 1rem; }
.reviews-sum .ib-stars { font-size: 1.2rem; }
.reviews-list { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reviews-list li { border-top: 1px solid var(--line); padding-top: 8px; }
.reviews-list .rv-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.reviews-list .rv-text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.share-link { display: flex; gap: 6px; }
.share-link input { flex: 1; min-width: 0; }
.share-ways { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.share-ways .btn, .share-ways button { flex: 1; text-align: center; text-decoration: none; }
.share-qr { width: 180px; height: 180px; align-self: center; background: #fff; padding: 8px; border-radius: 6px; }
.wp-rating { border: 0; background: none; padding: 2px 0; color: var(--text); text-align: left; font-size: 0.92rem; cursor: pointer; }
.wp-rating .ib-stars { margin-right: 4px; }
.wp-rating u { color: var(--accent); text-decoration: none; margin-left: 6px; }
.wp-you { margin-top: 14px; }
.wp-you label { display: block; margin-bottom: 3px; }
.wp-you input { width: 100%; box-sizing: border-box; }
.linkish { border: 0; background: none; color: var(--accent); padding: 6px 0; text-align: left; cursor: pointer; }
.wp-icon { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 52px; padding: 4px 6px; font-size: 0.7rem; border-radius: var(--r-btn); }
.wp-icon span { font-size: 1.05rem; line-height: 1.1; }
.walk-stars { color: #f5b301; }
/* A focus area's badge on the editor's map (editor.js renderFocusLayer) */
.focus-badge { display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; color: #fff; background: rgba(20, 20, 24, 0.85); border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); pointer-events: none; }

/* The listening log (editor-log.js) */
.lg-table td { vertical-align: top; }
.lg-sounds summary { cursor: pointer; }
.lg-sounds[open] { max-width: 28em; }

/* Live: listeners now, and replay (editor-live.js; administrator) */
.live-badge { background: var(--ok); }
.live-view { display: flex; flex-direction: column; height: calc(100vh - 54px); height: calc(100dvh - 54px); }
.live-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.live-replay { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.live-replay input[type="range"] { width: min(360px, 40vw); }
.lv-clock { font-variant-numeric: tabular-nums; min-width: 6.5em; }
.live-body { flex: 1; display: grid; grid-template-columns: 1fr minmax(260px, 340px); min-height: 0; }
.live-map { min-height: 300px; }
.live-panel { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 10px; }
.lv-tiles { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.lv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lv-card { border: 1px solid var(--line); border-radius: var(--r-input); padding: 8px 10px; cursor: pointer; }
.lv-card.on { border-color: var(--accent); }
.lv-card.dim { opacity: 0.55; }
.lv-head { display: flex; align-items: center; gap: 6px; }
.lv-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lv-now { margin-top: 4px; }
.lv-heard summary { cursor: pointer; color: var(--muted); }
.lv-tip { font-weight: 600; font-size: 0.8rem; padding: 1px 6px; }
.lv-walk-label { font-size: 0.75rem; color: #333; font-weight: 600; white-space: nowrap; text-shadow: 0 0 3px #fff, 0 0 3px #fff; pointer-events: none; }
@media (max-width: 800px) {
  .live-body { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
  .live-panel { border-left: 0; border-top: 1px solid var(--line); }
}
.live-notice { border-left: 3px solid var(--line); padding-left: 8px; }
/* Overview tab: the title image's preview */
.cover-preview { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--r-input); border: 1px solid var(--line); margin-top: 6px; }
/* "☰ Go to ▾" in the editor's top bar (editor-nav.js) */
.ed-menu-wrap { position: relative; }
.ed-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 1200; min-width: 260px; max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; }
.ed-menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: var(--r-btn); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-menu button:hover, .ed-menu button:focus-visible { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.ed-menu-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 10px 3px; }
.ed-menu-note { padding: 4px 10px 8px; display: block; }
/* Satellite imagery (maplayers.js): its opacity slider and the Mapbox logo */
.sat-slider { background: var(--panel); padding: 4px 8px; border-radius: 8px; }
.sat-slider label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 0.9rem; }
.sat-slider input { width: 110px; }
.mapbox-logo { display: inline-flex; align-items: center; height: 20px; padding: 0 4px; font: 700 12px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 0 2px #000, 0 0 3px #000; text-decoration: none; }
.mapbox-logo img { height: 20px; display: block; }
.sat-opacity { display: flex; align-items: center; gap: 6px; margin: 2px 0 0 1.6em; }
.sat-opacity input { flex: 1; min-width: 0; }
.space-badge { font-size: 13px; background: rgba(20, 20, 24, 0.7); }
/* Schedule rows (editor.js renderSchedule) */
.sched-box { margin: 0 0 0.3em 1em; font-size: 0.85rem; }
.sched-box input, .sched-box select { width: auto; }
/* Terms for creators (dialog in the editor, and the /terms page) */
.terms-points { margin: 0.3em 0 0.5em 1.1em; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.upload-rights { margin: 0.4em 0 0; }
.terms h2 { font-size: 1.05rem; margin-top: 1.4em; }
.terms li { margin: 0.2em 0; }
/* A stem area's tick boxes (editor.js renderZoneStem) */
.stem-pick { margin: 0.3em 0 0; }
.stem-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.stem-table th { font-weight: 600; color: var(--muted); text-align: center; padding: 2px 4px; font-size: 0.75rem; }
.stem-table th:first-child, .stem-table td:first-child { text-align: left; }
.stem-table td { padding: 2px 4px; border-top: 1px solid var(--line); text-align: center; }
.stem-table input { margin: 0; }
