:root {
  --ink: #2a1d12;
  --ink-soft: #5b4630;
  --ink-faint: rgba(42, 29, 18, 0.35);
  --parchment: #f4ead3;
  --parchment-deep: #e6d6b0;
  --parchment-edge: #cdb88a;
  --wax: #9e2b25;
  --wax-dark: #6c1a16;
  --gold: #b8923a;
  --moss: #56652b;
  --portal: #2f6fa8; /* known travel connections (teleportation circles) */
  --sea: #c9bd9f;
  --shadow: 0 6px 24px rgba(30, 18, 8, 0.35), 0 1px 3px rgba(30, 18, 8, 0.3);
  --radius: 6px;
  --font-title: "IM Fell English SC", "Palatino Linotype", Palatino, serif;
  --font-body: "EB Garamond", Garamond, "Palatino Linotype", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #3a2a1b;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#map { position: fixed; inset: 0; background: var(--sea); }
.leaflet-container { font-family: var(--font-body); background: var(--sea); }
.leaflet-control-zoom a {
  background: var(--parchment); color: var(--ink); border-color: var(--parchment-edge) !important;
  font-family: var(--font-title);
}

/* Parchment surfaces shared by the floating UI */
.cartouche, .search input, .panel, .legend, .journey, .search-results {
  background: var(--parchment);
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.45), transparent 60%),
                    radial-gradient(ellipse at 80% 90%, rgba(170, 130, 70, 0.18), transparent 55%);
  border: 1px solid var(--parchment-edge);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

/* ---------- Title cartouche + map tabs ---------- */
.cartouche {
  position: fixed; top: 12px; left: 12px; z-index: 1000;
  padding: 10px 16px 10px;
  outline: 3px double var(--ink-soft); outline-offset: -7px;
}
.cartouche h1 {
  margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 30px; line-height: 1;
  letter-spacing: 0.02em;
}
.cartouche h1 .small { display: block; font-size: 14px; color: var(--ink-soft); letter-spacing: 0.12em; margin-bottom: 2px; }
.map-tabs { display: flex; gap: 4px; margin-top: 8px; }
.map-tabs button {
  border: 1px solid var(--ink-faint); background: transparent; border-radius: 3px;
  padding: 2px 10px; font-family: var(--font-title); font-size: 15px;
}
.map-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--parchment); border-color: var(--ink); }

/* ---------- Search ---------- */
.search { position: fixed; top: 12px; right: 12px; z-index: 1001; width: min(320px, calc(100vw - 24px)); }
.search input {
  width: 100%; padding: 10px 14px; font: inherit; font-size: 17px; color: var(--ink);
}
.search input:focus { outline: 2px solid var(--gold); }
.search-results {
  list-style: none; margin: 6px 0 0; padding: 4px; max-height: 60vh; overflow: auto;
}
.search-results li {
  padding: 6px 10px; border-radius: 4px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px;
}
.search-results li small { color: var(--ink-soft); white-space: nowrap; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--parchment-deep); }

/* ---------- Pins ---------- */
.pin { background: none; border: none; }
.pin-seal {
  position: absolute; left: 0; bottom: 0; width: 30px; height: 38px;
  transform-origin: 50% 100%; transition: transform 0.15s ease;
  filter: drop-shadow(0 2px 2px rgba(30, 18, 8, 0.45));
}
.pin-seal svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pin-seal .body { fill: var(--parchment); stroke: var(--ink); stroke-width: 1.6; }
.pin-seal .glyph { fill: var(--ink); }
.pin.visited .pin-seal .body { fill: var(--wax); stroke: var(--wax-dark); }
.pin.visited .pin-seal .glyph { fill: var(--parchment); }
.pin.approx .pin-seal .body { stroke-dasharray: 3 2.2; }
.pin-seal .travel-ring { fill: var(--parchment); stroke: var(--portal); stroke-width: 2.2; }
.pin.travel-lost .pin-seal .travel-ring { stroke: var(--ink-soft); stroke-dasharray: 2 1.6; }
.pin:hover .pin-seal, .pin:focus .pin-seal, .pin.selected .pin-seal { transform: scale(1.18); }
.pin.selected .pin-seal .body { stroke: var(--gold); stroke-width: 2.4; }
.pin.dim { opacity: 0.28; }
.pin.hidden { display: none; }
.pin.current .pin-seal::after {
  content: ""; position: absolute; left: 50%; top: 42%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; border: 2px solid var(--gold); animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

.leaflet-tooltip.pin-label {
  background: var(--parchment); border: 1px solid var(--parchment-edge); color: var(--ink);
  font-family: var(--font-title); font-size: 15px; padding: 2px 8px; box-shadow: var(--shadow);
}
.leaflet-tooltip.pin-label::before { display: none; }

.signpost { background: none; border: none; }
.signpost span {
  display: inline-flex; flex-direction: column; align-items: center; white-space: nowrap;
  transform: translate(-50%, -50%); padding: 4px 12px 5px; border-radius: 3px;
  background: var(--ink); color: var(--parchment); font-family: var(--font-title); font-size: 16px;
  box-shadow: var(--shadow); cursor: pointer; border: 1px solid var(--gold);
}
.signpost small { font-family: var(--font-body); font-style: italic; font-size: 12px; opacity: 0.8; }
.signpost:hover span, .signpost:focus span { background: var(--wax-dark); }

/* ---------- Side panel ---------- */
.panel {
  position: fixed; z-index: 1002; top: 12px; right: 12px; bottom: 12px;
  width: min(400px, calc(100vw - 24px));
  display: flex; flex-direction: column; overflow: hidden;
  animation: slide-in 0.2s ease-out;
}
.search:has(+ .panel:not([hidden])) { right: 424px; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.panel-close {
  position: absolute; top: 6px; right: 8px; z-index: 1; border: none; background: none;
  font-size: 28px; line-height: 1; padding: 4px 8px; color: var(--ink-soft);
}
.panel-body { overflow-y: auto; padding: 18px 22px 22px; }
.crumbs { font-size: 14px; color: var(--ink-soft); margin: 0 28px 6px 0; }
.crumbs button, .crumbs a { border: none; background: none; padding: 0; color: inherit; text-decoration: underline; text-decoration-color: var(--ink-faint); }
.kicker { font-family: var(--font-title); font-size: 14px; letter-spacing: 0.1em; color: var(--ink-soft); margin: 0; }
.panel h2 {
  font-family: var(--font-title); font-weight: 400; font-size: 32px; line-height: 1.05; margin: 2px 28px 10px 0;
}
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
  font-size: 13px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--ink-faint);
  font-variant: small-caps; letter-spacing: 0.04em;
}
.badge.visited { background: var(--wax); border-color: var(--wax-dark); color: var(--parchment); }
.badge.approx { border-style: dashed; }
.badge.travel { border-color: var(--portal); background: rgba(47, 111, 168, 0.18); }
.badge.travel.lost { border-color: var(--ink-soft); border-style: dashed; background: none; }
.summary { margin: 0 0 12px; }
.summary a { color: var(--wax-dark); }
.where { font-style: italic; color: var(--ink-soft); margin: 0 0 14px; font-size: 16px; }
.travel-note { margin: 0 0 14px; padding-left: 10px; border-left: 3px solid var(--portal); font-size: 16px; }
.panel h3 {
  font-family: var(--font-title); font-weight: 400; font-size: 18px; margin: 18px 0 6px;
  display: flex; align-items: center; gap: 10px;
}
.panel h3::after { content: ""; flex: 1; border-top: 1px solid var(--ink-faint); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.chips li { font-size: 15px; padding: 1px 9px; border-radius: 3px; background: rgba(205, 184, 138, 0.35); }
.chips a { color: var(--ink); text-decoration: none; }
.chips li:has(a):hover { background: rgba(205, 184, 138, 0.6); }
.chips button {
  border: 1px solid var(--ink-faint); background: var(--parchment); border-radius: 3px; padding: 1px 9px; font-size: 15px;
}
.chips button:hover { border-color: var(--ink); }
.chips .session-chip { font-variant-numeric: lining-nums; }
.places-list { list-style: none; margin: 0; padding: 0; }
.places-list li + li { border-top: 1px dotted var(--ink-faint); }
.places-list button {
  width: 100%; text-align: left; border: none; background: none; padding: 6px 2px;
  display: flex; align-items: center; gap: 8px;
}
.places-list button:hover { background: rgba(205, 184, 138, 0.3); }
.places-list .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }
.places-list .dot.visited { background: var(--wax); border-color: var(--wax-dark); }
.places-list small { margin-left: auto; color: var(--ink-soft); font-style: italic; }
.more { font-size: 15px; color: var(--ink-soft); border: none; background: none; padding: 4px 0; text-decoration: underline; }
.note-link {
  display: inline-block; margin-top: 20px; padding: 8px 16px; border-radius: 3px;
  background: var(--ink); color: var(--parchment); text-decoration: none; font-family: var(--font-title); font-size: 16px;
}
.note-link:hover { background: var(--wax-dark); }
.note-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 20px; }
.note-actions .note-link { margin-top: 0; }
.panel h2 + .note-actions { margin-top: 0; margin-bottom: 12px; }
.garden-link { color: var(--ink-soft); font-size: 15px; }

/* Reader */
.panel.wide { width: min(600px, calc(100vw - 24px)); }
.search:has(+ .panel.wide:not([hidden])) { right: 624px; }
.related { margin: 4px 0 16px; padding: 8px 12px; border: 1px solid var(--parchment-edge); border-radius: 4px; background: rgba(205, 184, 138, 0.18); }
.related summary { cursor: pointer; font-family: var(--font-title); font-size: 17px; }
.related-group h4 { margin: 10px 0 4px; font-size: 13px; font-variant: small-caps; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 500; }
.related .chips a { color: var(--ink); text-decoration: none; }
.related .chips li:hover { background: rgba(205, 184, 138, 0.6); }
.note-md { border-top: 1px solid var(--ink-faint); padding-top: 6px; }
.note-md h1, .note-md h2, .note-md h3, .note-md h4 {
  font-family: var(--font-title); font-weight: 400; line-height: 1.15; margin: 18px 0 6px;
}
.note-md h1 { font-size: 26px; } .note-md h2 { font-size: 22px; } .note-md h3 { font-size: 19px; } .note-md h4 { font-size: 17px; }
.note-md h1::after, .note-md h2::after, .note-md h3::after { display: none; }
.note-md ul, .note-md ol { padding-left: 22px; margin: 6px 0; }
.note-md li { margin: 2px 0; }
.note-md a { color: var(--wax-dark); }
.note-md .heading-link { color: inherit; text-decoration: underline; text-decoration-color: var(--ink-faint); text-underline-offset: 3px; }
.note-md .heading-link:hover { color: var(--wax-dark); }
.note-md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--gold); font-style: italic; }
.note-md table { border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.note-md th, .note-md td { border: 1px solid var(--parchment-edge); padding: 3px 8px; }
.read-session { font-weight: 500; }
@media (min-width: 721px) {
  .panel.wide:not([hidden]) ~ .journey { left: calc((100vw - 624px) / 2); }
  .panel.wide:not([hidden]) ~ .journey:not(:has(.journey-body[hidden])) { width: min(760px, calc(100vw - 648px)); }
}

/* ---------- Legend ---------- */
.legend { position: fixed; left: 12px; bottom: 12px; z-index: 1000; font-size: 15px; }
.legend-toggle { border: none; background: none; padding: 8px 14px; font-family: var(--font-title); font-size: 16px; }
.legend-body { padding: 0 14px 12px; }
.legend-keys { list-style: none; margin: 0 0 8px; padding: 0; }
.legend-keys li { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.legend label { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.legend input { accent-color: var(--wax); }
.pin-sample { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid var(--ink); background: var(--parchment); }
.pin-sample.visited { background: var(--wax); border-color: var(--wax-dark); }
.pin-sample.approx { border-style: dashed; }
.pin-sample.travel { border: 2.2px solid var(--portal); }
.pin-sample.travel.lost { border: 2.2px dashed var(--ink-soft); }

/* ---------- Journey ---------- */
.journey {
  position: fixed; z-index: 1000; bottom: 12px; left: 50%; transform: translateX(-50%);
  width: min(760px, calc(100vw - 24px));
}
.journey:has(.journey-body[hidden]) { width: auto; }
.journey-toggle {
  display: flex; align-items: center; gap: 8px; margin: 0 auto; border: none; background: none;
  padding: 8px 18px; font-family: var(--font-title); font-size: 18px;
}
.journey-toggle-icon { color: var(--wax); }
.journey-body { padding: 0 14px 12px; }
.journey-card { min-height: 64px; }
.journey-card .meta { font-size: 14px; color: var(--ink-soft); margin: 0; }
.journey-card h2 { font-family: var(--font-title); font-weight: 400; font-size: 24px; margin: 0; line-height: 1.15; }
.journey-card p { margin: 2px 0 0; font-size: 15px; }
.journey-card a { color: var(--wax-dark); }
.journey-controls { display: flex; justify-content: center; gap: 8px; margin: 6px 0; }
.journey-controls button {
  width: 36px; height: 32px; border-radius: 3px; border: 1px solid var(--ink-faint); background: var(--parchment); font-size: 18px;
}
.journey-controls .journey-play { width: 48px; background: var(--ink); color: var(--parchment); }
.journey-strip {
  display: flex; gap: 3px; list-style: none; margin: 0; padding: 4px 0 6px; overflow-x: auto; scrollbar-width: thin;
}
.journey-strip button {
  min-width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--ink-faint);
  background: var(--parchment); font-size: 14px; font-variant-numeric: lining-nums; padding: 0;
}
.journey-strip button.gm-steffen { border-color: var(--moss); }
.journey-strip button.past { background: var(--parchment-deep); }
.journey-strip button[aria-current="true"] { background: var(--wax); color: var(--parchment); border-color: var(--wax-dark); }
.journey-strip button.offmap { border-style: dashed; }

.trail { stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 2 7; stroke-linecap: round; fill: none; opacity: 0.55; }
.trail.now { stroke: var(--wax); stroke-width: 4; opacity: 0.95; stroke-dasharray: 3 8; }

.region { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 6; stroke-opacity: 0.35; fill: var(--wax); fill-opacity: 0; transition: fill-opacity 0.15s; }
.region:hover { fill-opacity: 0.2; stroke: var(--wax-dark); stroke-width: 2.5; stroke-opacity: 0.9; }
.region.selected { fill-opacity: 0.28; stroke: var(--wax-dark); stroke-width: 3; stroke-opacity: 1; }
.regions-off .region { display: none; }

/* ---------- People ---------- */
:root { --ally: #56652b; --neutral: #a4822f; --enemy: #9e2b25; --unknown: #8b7a60; }
.monogram {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-family: var(--font-title); font-size: 13px; letter-spacing: 0.02em; color: var(--parchment);
  background: var(--unknown); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25), 0 1px 2px rgba(30, 18, 8, 0.35);
}
.monogram.big { width: 56px; height: 56px; font-size: 22px; }
.monogram.dead { filter: grayscale(0.7); opacity: 0.6; }
.monogram.pc { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25), 0 0 0 2px var(--gold), 0 1px 2px rgba(30, 18, 8, 0.35); }
.badge.pc { border-color: var(--gold); color: var(--ink); background: rgba(184, 146, 58, 0.25); }
.dir-chip.stance-pc::before { background: var(--gold); }
.monogram i { position: absolute; right: -3px; top: -5px; font-style: normal; font-size: 13px; color: var(--ink); }
.stance-ally.monogram { background: var(--ally); }
.stance-neutral.monogram { background: var(--neutral); }
.stance-enemy.monogram { background: var(--enemy); }
.people-list { list-style: none; margin: 0; padding: 0; }
.people-list li + li { border-top: 1px dotted var(--ink-faint); }
.person-row { display: flex; align-items: center; gap: 10px; padding: 5px 2px; color: var(--ink); text-decoration: none; }
.person-row:hover { background: rgba(205, 184, 138, 0.3); }
.person-row b { display: block; font-weight: 500; }
.person-row small { display: block; color: var(--ink-soft); font-size: 14px; line-height: 1.2; }
.dir-filter {
  width: 100%; padding: 8px 12px; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--parchment-edge); border-radius: 4px; margin: 4px 0 8px;
}
.dir-filter:focus { outline: 2px solid var(--gold); }
.dir-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.dir-chip {
  border: 1px solid var(--ink-faint); background: var(--parchment); border-radius: 999px; padding: 1px 10px; font-size: 14px;
}
.dir-chip::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--unknown); }
.dir-chip.stance-ally::before { background: var(--ally); }
.dir-chip.stance-neutral::before { background: var(--neutral); }
.dir-chip.stance-enemy::before { background: var(--enemy); }
.dir-chip.stance-dead::before { background: none; content: "†"; width: auto; height: auto; }
.dir-chip[aria-pressed="true"] { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.dir-count { font-size: 14px; color: var(--ink-soft); margin: 4px 0; }
.dir-group h3 a { color: inherit; text-decoration: none; }
.dir-group h3 a:hover { text-decoration: underline; }
.person-card {
  display: flex; gap: 14px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px;
  border: 1px solid var(--parchment-edge); border-radius: 4px; background: rgba(205, 184, 138, 0.18);
}
.person-card .badges { margin-bottom: 4px; }
.person-facts { margin: 2px 0; font-size: 15px; }
.person-facts a, .person-card .session-link { color: var(--wax-dark); }
.person-card .chips { margin-top: 6px; gap: 4px 8px; font-size: 14px; }
.session-summary { margin-top: 6px; font-size: 15px; }
.session-summary summary { cursor: pointer; }
.badge.stance-ally { background: var(--ally); border-color: var(--ally); color: var(--parchment); }
.badge.stance-neutral { background: var(--neutral); border-color: var(--neutral); color: var(--parchment); }
.badge.stance-enemy { background: var(--enemy); border-color: var(--enemy); color: var(--parchment); }

/* Faction banner: a small pennant in the faction's stance colour */
.banner {
  flex: none; display: inline-block; width: 22px; height: 30px; margin: 0 4px;
  background: var(--unknown); clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.25);
}
.banner.big { width: 40px; height: 54px; margin: 0 8px; }
.banner.stance-ally { background: var(--ally); }
.banner.stance-neutral { background: var(--neutral); }
.banner.stance-enemy { background: var(--enemy); }
.influence-btn { margin-top: 10px; border: none; cursor: pointer; }
.influence-line { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 1 6; stroke-linecap: round; fill: none; opacity: 0.7; }
.journey-strip button { position: relative; }
.journey-strip button.featured::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 6px; height: 6px; margin-left: -3px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 1px var(--parchment);
}

/* ---------- Tråde ---------- */
.segments { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.segments a {
  padding: 3px 12px; border: 1px solid var(--ink-faint); border-radius: 999px; font-size: 15px;
  color: var(--ink); text-decoration: none;
}
.segments a[aria-current="true"] { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-list li { border-top: 1px dotted var(--ink-faint); padding: 6px 2px; display: flex; flex-direction: column; gap: 2px; }
.thread-list li:first-child { border-top: none; }
.thread-list a { color: var(--ink); text-decoration: none; display: flex; flex-direction: column; }
.thread-list a:hover b { text-decoration: underline; }
.thread-list b { font-weight: 500; }
.thread-list small { color: var(--ink-soft); font-size: 14px; line-height: 1.3; }
.thread-list .session-link, .next-step .session-link, .thread-md a { color: var(--wax-dark); }
.thread-part h3 { margin-top: 14px; }
.thread-md { border-top: none; padding-top: 0; }
.thread-md p { margin: 4px 0; }
.thread-part.guess { border: 1px dashed var(--ink-faint); border-radius: 4px; padding: 2px 12px 8px; margin-top: 12px;
  background: rgba(205, 184, 138, 0.15); }
.thread-part.guess h3::after { display: none; }
.next-step { border-top: 1px dotted var(--ink-faint); padding: 6px 0; }
.next-step h4 { margin: 0 0 2px; font-weight: 500; font-size: 15px; color: var(--ink-soft); }
.next-step ul { margin: 0; padding-left: 20px; }
.next-step.latest { border: 1px solid var(--parchment-edge); border-radius: 4px; padding: 8px 12px; background: rgba(205, 184, 138, 0.25); }
.together { margin: 0 0 12px; }
.together h4 { margin: 0 0 4px; font-size: 13px; font-variant: small-caps; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 500; }
.together small { color: var(--ink-soft); }

/* ---------- Edit mode ---------- */
.editbar {
  position: fixed; z-index: 1003; top: 12px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); padding: 10px 14px;
  background: var(--ink); color: var(--parchment); border: 1px solid var(--gold);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.editbar p { margin: 0; }
.editbar-title { font-family: var(--font-title); font-size: 17px; }
.editbar-status { font-size: 15px; opacity: 0.85; margin-bottom: 8px !important; }
.editbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.editbar select, .editbar button {
  font: inherit; font-size: 15px; padding: 3px 10px; border-radius: 3px;
  border: 1px solid var(--gold); background: var(--parchment); color: var(--ink);
}
.editbar select { flex: 1; min-width: 180px; }
.unplaced { margin-top: 8px; }
.unplaced summary { cursor: pointer; font-size: 15px; }
.unplaced-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 34vh; overflow-y: auto; }
.unplaced-list button {
  width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left;
  background: none; border: none; border-top: 1px solid rgba(244, 234, 211, 0.15); color: var(--parchment);
  padding: 4px 2px; font-size: 15px;
}
.unplaced-list button:hover, .unplaced-list button[aria-pressed="true"] { background: rgba(184, 146, 58, 0.3); }
.unplaced-list small { font-style: italic; opacity: 0.75; }
.editbar-export { width: 100%; height: 120px; margin-top: 8px; font: 13px/1.3 ui-monospace, monospace; }
.editing .leaflet-marker-draggable { cursor: grab; }
.editing .leaflet-container { cursor: crosshair; }
.pin.moved .pin-seal .body { stroke: var(--gold); stroke-width: 2.6; }

/* ---------- Small screens: panel becomes a bottom sheet ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .cartouche { padding: 8px 12px; }
  .cartouche h1 { font-size: 22px; }
  .cartouche h1 .small { font-size: 12px; }
  .map-tabs { flex-wrap: wrap; }
  .map-tabs button { font-size: 14px; padding: 2px 8px; }
  /* Search sits under the title so it never collides with Rejsen at the bottom. */
  .search { top: 112px; left: 12px; right: 12px; width: auto; }
  .search input { padding: 8px 12px; }
  .search:has(+ .panel:not([hidden])) { display: none; }
  .search-results { max-height: 45vh; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 62vh; }
  .panel h2 { font-size: 26px; }
  .legend { display: none; }
  .journey { bottom: 12px; }
  .panel:not([hidden]) ~ .journey { display: none; }
}
