/* Valanar map viewer and editor */
:root {
  --ink: #1d1a16;
  --ink-soft: #5a5246;
  --parch: #f3ecdc;
  --parch-2: #e7dcc4;
  --line: #cbbd9e;
  --chrome: rgba(16, 19, 24, 0.9);
  --chrome-line: rgba(232, 226, 208, 0.16);
  --chrome-text: #e8e2d0;
  --gold: #c9a45c;
  --danger: #b4483a;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --k: 0.2;            /* icon scale, set from the zoom level */
  --bar: 48px;         /* height of the top bar */
  --hot: 48px;         /* width of the tool bar on the left */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
#map { position: absolute; left: var(--hot); right: 0; top: var(--bar); bottom: 0; }
body { background: #000; color: var(--chrome-text); font: 13px/1.4 var(--sans); overflow: hidden; }
#map { background: #000; }
body.editing #map { cursor: default; }
body.placing #map, body.placing .leaflet-interactive { cursor: crosshair !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; }

/* ---------- map icons ---------- */
.mk-wrap { background: none; border: 0; }
.mk { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.leaflet-container .mk img {   /* beats Leaflet's own ".leaflet-marker-pane img { width: auto }" */
  position: absolute; left: 0; top: 0;
  width: calc(var(--s) * var(--k) * var(--icon-scale, 1) * 1px);
  transform: translate(-50%, -63.7%);
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.5));
  user-select: none; -webkit-user-drag: none;
}
.mk .lbl {
  position: absolute; left: 0;
  top: calc(var(--s) * var(--k) * var(--icon-scale, 1) * 0.28px + 1px);
  transform: translateX(-50%);
  white-space: nowrap; pointer-events: none;
  font: 600 calc(13px * var(--label-scale, 1))/1.1 var(--label-font, var(--serif)); color: var(--label-ink, var(--ink));
  text-shadow: 0 0 2px var(--parch), 0 0 3px var(--parch), 0 0 5px var(--parch);
}
.leaflet-container .mk img.flip { transform: translate(-50%, -63.7%) scaleX(-1); }
.hero.flip, .iconpick img.flip, .urow img.flip { transform: scaleX(-1); }
.mk.txt .tl {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: auto; cursor: pointer;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  font: italic 600 max(11px, calc(var(--s) * var(--k) * var(--label-scale, 1) * 1px))/1 var(--label-font, var(--serif)); color: var(--label-ink, var(--ink)); letter-spacing: 0.04em;
  text-shadow: 0 0 2px var(--parch), 0 0 4px var(--parch), 0 0 7px var(--parch);
}
.mk-wrap.sel .tl { color: #6b3f0a; }
/* name-only places: the name sits on the spot; in Edit mode a small diamond marks the exact point */
.mk.noic .lbl { top: 0; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; font-size: calc(14px * var(--label-scale, 1)); }
.mk.noic .pin { display: none; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; transform: rotate(45deg);
  background: var(--gold); border: 1px solid var(--ink); box-shadow: 0 0 0 1px var(--parch); }
body.editing .mk.noic .pin { display: block; }
body.editing .mk.noic .lbl { top: 9px; transform: translateX(-50%); }
.mk-wrap.sel .mk.noic .lbl { color: #6b3f0a; }
.noicon {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 28px;
  border: 1px dashed var(--line); border-radius: 3px; color: var(--ink-soft); font: italic 11px/1 var(--serif); text-align: center;
}
.noicon.sm { width: 34px; height: 26px; min-height: 0; flex: none; }
#palette .noicon { border-color: #b9a985; font-size: 10px; }
.aa { font: italic 700 15px var(--serif); color: var(--ink); }
#palette button .aa { display: block; line-height: 32px; }
.mk-wrap.hid { display: none; }
.mk-wrap.nolbl .lbl { display: none; }
.mk-wrap.sel img { filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 10px var(--gold)); }
.mk-wrap.sel { z-index: 100000 !important; }
body.editing .mk-wrap { cursor: grab; }
body.editing .mk-wrap.leaflet-drag-target { cursor: grabbing; }

/* ---------- top bar: views, search, map tools ---------- */
#topbar {
  position: absolute; z-index: 2050; left: 0; right: 0; top: 0; height: var(--bar);
  display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: #101318; border-bottom: 1px solid var(--chrome-line); box-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.brand { font: 600 21px/1 var(--serif); letter-spacing: 0.08em; color: var(--gold); text-decoration: none; padding-right: 4px; }
#views { display: flex; gap: 2px; height: 100%; }
#views button {
  height: 100%; padding: 0 12px; border: 0; background: none; cursor: pointer; color: rgba(232, 226, 208, 0.72);
  font: 600 13px/1 var(--sans); letter-spacing: 0.04em; border-bottom: 2px solid transparent; border-top: 2px solid transparent;
}
#views a { display: flex; align-items: center; height: 100%; padding: 0 12px; color: rgba(232, 226, 208, 0.72); text-decoration: none;
  font: 600 13px/1 var(--sans); letter-spacing: 0.04em; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
#views button:hover, #views a:hover { color: #fff; }
#views button.on { color: #fff; border-bottom-color: var(--gold); }
#views button[hidden] { display: none; }
#maptools { margin-left: auto; display: flex; gap: 8px; }
body.view-wiki #maptools { visibility: hidden; }
.search { position: relative; }
#search {
  width: 300px; height: 32px; padding: 0 12px; color: var(--chrome-text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--chrome-line); border-radius: 4px; outline: none;
}
#search:focus { border-color: var(--gold); }
#results {
  position: absolute; top: 38px; left: 0; width: 380px; max-height: 70vh; z-index: 5; overflow: auto;
  background: var(--chrome); border: 1px solid var(--chrome-line); border-radius: 4px; padding: 4px 0;
}
#results button {
  display: flex; gap: 8px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; padding: 5px 10px; cursor: pointer;
}
#results button:hover, #results button.on { background: rgba(201, 164, 92, 0.18); }
#results img { width: 34px; flex: none; filter: invert(1); opacity: 0.9; }
#results .ri { width: 34px; flex: none; text-align: center; font: italic 600 15px var(--serif); opacity: 0.8; }
#results .meta { opacity: 0.6; font-size: 12px; }
#results .tag { margin-left: auto; font-size: 11px; color: var(--gold); }
#results .empty { padding: 6px 10px; opacity: 0.6; }

/* ---------- buttons ---------- */
.chip, .tool {
  height: 32px; padding: 0 12px; cursor: pointer; border-radius: 4px;
  background: var(--chrome); border: 1px solid var(--chrome-line);
}
.chip:hover, .tool:hover:not(:disabled) { border-color: var(--gold); }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool.icon { width: 32px; padding: 0; font-size: 17px; }
.tool b { color: var(--gold); font-weight: 600; }
.tool.on, .chip.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.tool.on b { color: var(--ink); }
#maptools .chip { font-weight: 600; letter-spacing: 0.04em; }

/* ---------- edit toolbar ---------- */
#editbar {
  position: absolute; z-index: 1000; left: calc(var(--hot) + 12px); top: calc(var(--bar) + 12px); display: flex; gap: 6px; align-items: center;
  padding: 6px; background: var(--chrome); border: 1px solid var(--chrome-line); border-radius: 4px;
  max-width: calc(100vw - 24px); flex-wrap: wrap;
}
body.panel-open #editbar { max-width: calc(100vw - 424px); }
#editbar[hidden] { display: none; }
#editbar .tool { background: rgba(255, 255, 255, 0.04); }
#editbar .tool.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }
#editbar .sep { width: 1px; align-self: stretch; background: var(--chrome-line); margin: 0 2px; }
#palette { display: flex; gap: 3px; }
#palette button {
  width: 46px; height: 40px; padding: 2px; cursor: pointer; border-radius: 4px;
  background: var(--parch); border: 2px solid transparent;
}
#palette button img { width: 100%; height: 100%; object-fit: contain; }
#palette button:hover { border-color: var(--gold); }
#palette button.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
#status { display: flex; gap: 6px; align-items: center; padding: 0 4px; white-space: nowrap; }
#status .dot { width: 8px; height: 8px; border-radius: 50%; background: #888; flex: none; }
#status .dot.ok { background: #7fb069; }
#status .dot.warn { background: var(--gold); }
#status .dot.bad { background: var(--danger); }
#status .tool { height: 28px; }

/* ---------- banner (placing / restore) ---------- */
#banner {
  position: absolute; z-index: 1001; left: 50%; top: calc(var(--bar) + 12px); transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; padding: 7px 8px 7px 14px; max-width: 70vw;
  background: var(--gold); color: var(--ink); border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
#banner[hidden] { display: none; }
#banner b { font-weight: 700; }
#banner button { height: 26px; padding: 0 10px; cursor: pointer; border-radius: 3px; border: 1px solid rgba(0,0,0,0.35); background: rgba(255,255,255,0.35); }
#banner button:hover { background: rgba(255,255,255,0.6); }
#banner .k { font-size: 12px; opacity: 0.75; }

/* ---------- side panel ---------- */
#panel {
  position: absolute; z-index: 1002; right: 0; top: var(--bar); bottom: 0; width: 400px; overflow-y: auto;
  background: var(--parch); color: var(--ink); border-left: 1px solid var(--line);
  box-shadow: -4px 0 18px rgba(0, 0, 0, 0.45);
}
#panel[hidden] { display: none; }
#panel .head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; background: var(--parch-2); border-bottom: 1px solid var(--line); }
#panel .head .ttl { font: 600 12px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
#panel .head .x { margin-left: auto; width: 28px; height: 28px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--ink-soft); border-radius: 3px; }
#panel .head .x:hover { background: rgba(0,0,0,0.08); color: var(--ink); }
#panel .body { padding: 16px 18px 28px; }
#panel h1 { font: 600 28px/1.15 var(--serif); margin: 4px 0 2px; }
#panel h2 { font: 600 13px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
#panel .sub { color: var(--ink-soft); margin: 0 0 12px; font-style: italic; font-family: var(--serif); font-size: 15px; }
#panel .hero { display: block; width: 150px; margin: 4px auto 10px; }
#panel p { margin: 8px 0; }
#panel a { color: #7a4b16; }
.infobox { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.infobox th { text-align: left; vertical-align: top; width: 40%; padding: 5px 8px 5px 0; color: var(--ink-soft); font-weight: 600; }
.infobox td { padding: 5px 0; vertical-align: top; }
.infobox tr + tr th, .infobox tr + tr td { border-top: 1px solid rgba(0,0,0,0.08); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.chips span { padding: 2px 8px; border-radius: 10px; background: var(--parch-2); border: 1px solid var(--line); font-size: 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }

/* panel forms */
.form label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 10px 0 3px; }
.form input[type=text], .form input[type=number], .form input:not([type]), .form select, .form textarea {
  width: 100%; padding: 6px 8px; color: var(--ink); background: #fffaf0; border: 1px solid var(--line); border-radius: 3px; outline: none;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: #9b7a3a; box-shadow: 0 0 0 2px rgba(201,164,92,0.35); }
.form textarea { min-height: 70px; resize: vertical; }
.form .row { display: flex; gap: 10px; }
.form .row > div { flex: 1; min-width: 0; }
.form .name { font: 600 22px var(--serif); }
.form label.inline { display: inline-flex; gap: 5px; align-items: center; margin-top: 6px; font-weight: 400; color: inherit; }
.form .detail.rm { position: relative; }
.form .detail.rm input { padding-right: 30px; }
.form .detail .del { position: absolute; right: 2px; bottom: 3px; width: 26px; height: 24px; border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-size: 16px; border-radius: 3px; }
.form .detail .del:hover { background: rgba(0,0,0,0.08); color: var(--danger); }
.adddetail { display: flex; gap: 6px; margin-top: 10px; }
.adddetail input:first-child { flex: 0 0 38%; }
.adddetail .btn { flex: none; }
#panel p.notes { white-space: pre-wrap; }
.iconpick { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.iconpick .prev { width: 96px; height: 74px; padding: 4px; background: #fffaf0; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.iconpick .prev img { width: 100%; height: 100%; object-fit: contain; }
.iconpick .prev:hover { border-color: #9b7a3a; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin-top: 4px; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; color: var(--ink); font-size: 13px; }
.btn {
  height: 30px; padding: 0 12px; cursor: pointer; border-radius: 3px;
  background: #fffaf0; border: 1px solid var(--line); color: var(--ink);
}
.btn:hover { border-color: #9b7a3a; }
.btn.primary { background: var(--ink); color: var(--parch); border-color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.coords { font-variant-numeric: tabular-nums; }

/* unplaced list */
.ulist { margin-top: 8px; }
.ulist h3 { font: 600 14px var(--serif); margin: 14px 0 4px; }
.urow { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 3px; cursor: pointer; }
.urow:hover { background: rgba(0,0,0,0.06); }
.urow.on { background: var(--gold); }
.urow img { width: 34px; flex: none; }
.urow .t { color: var(--ink-soft); font-size: 12px; }
.urow .del { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-size: 16px; width: 24px; height: 24px; border-radius: 3px; }
.urow .del:hover { background: rgba(0,0,0,0.1); color: var(--danger); }

/* types table */
.ttable { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; table-layout: fixed; }
.ttable th:nth-child(1) { width: 56px; }
.ttable th:nth-child(n+3):nth-child(-n+6) { width: 46px; }
.ttable th:nth-child(7) { width: 24px; }
.form .ttable input { width: 100%; padding: 3px 4px; }
.ttable input[type=number] { -moz-appearance: textfield; appearance: textfield; text-align: center; }
.ttable input[type=number]::-webkit-inner-spin-button, .ttable input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ttable th { text-align: left; font-weight: 600; color: var(--ink-soft); padding: 4px 4px; }
.ttable td { padding: 3px 2px; border-top: 1px solid rgba(0,0,0,0.08); vertical-align: middle; }
.ttable input { width: 100%; padding: 3px 5px; background: #fffaf0; border: 1px solid var(--line); border-radius: 3px; }
.ttable .ic { width: 52px; height: 40px; padding: 2px; background: #fffaf0; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.ttable .ic img { width: 100%; height: 100%; object-fit: contain; }
.ttable .del { border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-size: 16px; }
.ttable .del:disabled { opacity: 0.25; cursor: default; }
.ttable tr.sub td { border-top: 0; padding-top: 0; padding-bottom: 6px; }
.ttable .ic .noicon { min-height: 0; font-size: 10px; }
.fieldsrow { display: flex; gap: 6px; }
.fieldsrow select { flex: 0 0 auto; width: auto !important; padding: 3px 5px !important; font-size: 12px; }
.fieldsrow input { flex: 1; min-width: 0; font-size: 12px; }

/* nations and borders panel */
.segs { display: flex; margin: 2px 0 6px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.segs button { flex: 1; height: 32px; border: 0; background: #fffaf0; cursor: pointer; font-weight: 600; }
.segs button + button { border-left: 1px solid var(--line); }
.segs button.on { background: var(--ink); color: var(--parch); }
.pwarn[hidden] { display: none; }
.pwarn { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; padding: 8px 10px; border-radius: 4px;
  background: rgba(201, 164, 92, 0.25); border: 1px solid rgba(155, 122, 58, 0.5); font-size: 12px; }
.pwarn > div { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.pwarn .btn { flex: none; height: 26px; }
.nlist { display: flex; flex-direction: column; gap: 2px; }
.nrow { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.nrow:hover { background: rgba(0,0,0,0.04); }
.nrow.on { background: rgba(201, 164, 92, 0.22); border-color: rgba(155, 122, 58, 0.6); }
.nrow input[type=color] { flex: none; width: 30px; height: 26px; padding: 1px; border: 1px solid var(--line); border-radius: 3px; background: #fffaf0; cursor: pointer; }
.nrow input[type=text] { flex: 1; min-width: 0; padding: 4px 6px !important; }
.nrow .cnt { flex: none; width: 48px; font-size: 11px; color: var(--ink-soft); text-align: right; }
.nrow .del { flex: none; border: 0; background: none; cursor: pointer; color: var(--ink-soft); font-size: 16px; width: 24px; height: 24px; border-radius: 3px; }
.nrow .del:hover { background: rgba(0,0,0,0.1); color: var(--danger); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; flex: none; }
.form input[type=range] { width: 100%; accent-color: #9b7a3a; }

/* ---------- modal: icon picker ---------- */
#modal { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; }
#modal[hidden] { display: none; }
.dialog { width: min(980px, 94vw); max-height: 88vh; display: flex; flex-direction: column; background: var(--parch); color: var(--ink); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.dialog .dh { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dialog .dh h3 { margin: 0; font: 600 18px var(--serif); }
.dialog .tabs { display: flex; gap: 4px; margin-left: 12px; }
.dialog .tabs button { height: 28px; padding: 0 10px; border-radius: 3px; border: 1px solid var(--line); background: #fffaf0; cursor: pointer; }
.dialog .tabs button.on { background: var(--ink); color: var(--parch); border-color: var(--ink); }
.dialog .dh .sp { margin-left: auto; }
.dialog .grid { overflow: auto; padding: 12px 16px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.dialog .grid button { height: 70px; padding: 4px; background: #fffaf0; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.dialog .grid button:hover { border-color: #9b7a3a; }
.dialog .grid button.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.dialog .grid img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- toasts, readout, notice ---------- */
#toasts { position: absolute; z-index: 2100; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 8px 14px; border-radius: 4px; background: var(--chrome); border: 1px solid var(--chrome-line); max-width: 70vw; box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.toast.bad { border-color: var(--danger); }
.hud {
  background: rgba(12, 16, 22, 0.82); color: var(--chrome-text);
  border: 1px solid var(--chrome-line); border-radius: 4px;
  padding: 5px 10px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hud b { font-weight: 600; color: #fff; }
.hud .dim { opacity: 0.6; }
.hud .nat { font-weight: 600; color: #fff; }
.hud .nat::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 2px; background: var(--c); vertical-align: -1px; box-shadow: 0 0 0 1px rgba(255,255,255,0.5); }

/* ---------- political layer ---------- */
.polfill { image-rendering: auto; }
body.pol-edit .leaflet-marker-pane { pointer-events: none; opacity: 0.35; }
body.pol-edit .leaflet-marker-pane * { pointer-events: none !important; }
body.pol-edit[data-poltool=draw] #map, body.pol-edit[data-poltool=draw] .leaflet-interactive { cursor: crosshair; }
body.pol-edit[data-poltool=claim] #map { cursor: cell; }
.border-hit { cursor: pointer; }
.seed { position: relative; }
.seed i { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.seed b { position: absolute; left: 12px; top: -9px; white-space: nowrap; font: 600 11px/1 var(--sans); color: #fff; padding: 3px 5px; border-radius: 3px;
  background: rgba(16, 19, 24, 0.75); display: none; }
.seed:hover b, .seed.on b { display: block; }
.seed.on i { box-shadow: 0 0 0 3px var(--gold), 0 1px 4px rgba(0,0,0,0.6); }
.vh { width: 12px !important; height: 12px !important; margin: -6px 0 0 -6px !important; border-radius: 50%; background: #fff; border: 2px solid #8a6a2a; box-shadow: 0 1px 3px rgba(0,0,0,0.5); cursor: move; }
.vh:hover { background: var(--gold); }

/* ---------- animated sea ---------- */
.ocean { pointer-events: none; }
body.has-ocean #map { background: #23484f; }
#notice {
  position: absolute; z-index: 1000; left: 50%; top: 50%; transform: translate(-50%, -50%);
  max-width: 420px; padding: 18px 22px; text-align: center; font-size: 15px;
  background: rgba(12, 16, 22, 0.95); border: 1px solid rgba(232, 226, 208, 0.3); border-radius: 6px;
}
#notice[hidden] { display: none; }
#notice code { color: #fff; }
.leaflet-container { font-family: var(--sans); }
.leaflet-bar a { background: var(--chrome); color: var(--chrome-text); border-color: var(--chrome-line); }
.leaflet-bar a:hover { background: #20252d; color: #fff; }
body.panel-open .leaflet-right { right: 400px; }
#palette button .pal { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 700px) {
  #panel { width: 100vw; }
  body.panel-open .leaflet-right { right: 0; }
  .search { flex: 1 1 auto; min-width: 0; }
  #search { width: 100%; }
  #views button[data-page] { display: none; }
  #maptools { margin-left: 0; }
  #results { width: calc(100vw - 24px); }
  .brand { display: none; }
  #views button { padding: 0 7px; }
  #topbar { gap: 6px; padding: 0 6px; }
  #maptools .chip { padding: 0 8px; }
}

/* ---------- ruler ---------- */
body.ruling #map, body.ruling .leaflet-interactive, body.ruling .mk-wrap { cursor: crosshair !important; }
#ruler { position: absolute; z-index: 1001; right: 12px; top: calc(var(--bar) + 12px); width: 290px; padding: 10px 12px 12px;
  background: var(--parch); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.45); }
#ruler[hidden] { display: none; }
body.panel-open #ruler { right: 412px; }
#ruler .rh { display: flex; align-items: center; gap: 10px; }
#ruler .rh b { font: 600 12px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
#ruler .rh label { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-left: auto; cursor: pointer; }
#ruler .x { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--ink-soft); width: 24px; height: 24px; border-radius: 3px; }
#ruler .x:hover { background: rgba(0,0,0,0.08); }
#ruler .rdist { font: 600 26px/1.2 var(--serif); margin: 6px 0 4px; }
#ruler .rhint { font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; }
#ruler .rtimes { width: 100%; border-collapse: collapse; font-size: 13px; }
#ruler .rtimes th { text-align: left; font-weight: 400; color: var(--ink-soft); padding: 3px 0; }
#ruler .rtimes td { text-align: right; font-weight: 600; padding: 3px 0 3px 8px; white-space: nowrap; }
#ruler .rtimes td.pace { font-weight: 400; font-size: 11px; color: var(--ink-soft); }
#ruler .rtimes input { width: 40px; padding: 2px 4px; background: #fffaf0; border: 1px solid var(--line); border-radius: 3px; text-align: right; }
#ruler .rscale { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px; }
#ruler .rscale button { height: 28px; border: 1px solid var(--line); background: #fffaf0; border-radius: 3px; cursor: pointer; }
#ruler .rscale button:disabled { opacity: 0.45; cursor: default; }
.rtag span { position: absolute; left: 10px; top: -24px; white-space: nowrap; font: 600 12px var(--sans); color: var(--ink);
  background: #f3d48a; padding: 2px 6px; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
#ruler .rnote { margin: 8px 0 0; font-size: 11px; color: var(--ink-soft); line-height: 1.35; }
body.editing #ruler { width: 360px; }

/* ---------- wiki ---------- */
body.view-wiki #editbar, body.view-wiki #panel, body.view-wiki #banner, body.view-wiki #ruler, body.view-wiki #notice { display: none !important; }
#wiki {
  position: absolute; z-index: 2000; left: 0; right: 0; top: var(--bar); bottom: 0;
  display: grid; grid-template-columns: 270px minmax(0, 1fr) 230px; background: var(--parch); color: var(--ink);
}
#wiki[hidden] { display: none; }
#wikiNav { display: flex; flex-direction: column; min-height: 0; background: var(--parch-2); border-right: 1px solid var(--line); }
#wikiFilter { margin: 12px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--parch); color: var(--ink); outline: none; }
#wikiFilter:focus { border-color: #9b7a3a; }
#wikiTree { flex: 1; overflow-y: auto; padding: 0 8px 24px; font-size: 13.5px; }
#wikiTree a { display: block; padding: 3px 8px; border-radius: 3px; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wikiTree a:hover { background: rgba(0, 0, 0, 0.06); }
#wikiTree a.on { background: var(--ink); color: var(--parch); }
#wikiTree a.index { font-weight: 600; margin-bottom: 4px; }
#wikiTree .hint { display: block; font-size: 11px; opacity: 0.6; }
#wikiTree summary { padding: 3px 4px; cursor: pointer; font-weight: 600; color: var(--ink-soft); border-radius: 3px; user-select: none; }
#wikiTree summary:hover { background: rgba(0, 0, 0, 0.05); }
#wikiTree .kids { padding-left: 12px; border-left: 1px solid var(--line); margin-left: 8px; }
#wikiTree .empty { padding: 4px 8px; color: var(--ink-soft); }
#wikiMain { overflow-y: auto; min-height: 0; scroll-padding-top: 16px; }
#wikiArticle { max-width: 800px; margin: 0 auto; padding: 18px 40px 60px; font: 16.5px/1.6 var(--serif); }
#wikiArticle .crumbs { display: flex; align-items: center; gap: 6px; font: 12px var(--sans); color: var(--ink-soft); margin-bottom: 8px; }
#wikiArticle .crumbs a { color: inherit; }
#wikiArticle .crumbs .sep { opacity: 0.5; }
#wikiArticle .navbtn { display: none; width: 30px; height: 28px; border: 1px solid var(--line); border-radius: 3px; background: var(--parch-2); cursor: pointer; }
#wikiArticle h1 { font: 600 34px/1.15 var(--serif); margin: 0.2em 0 0.5em; padding-bottom: 0.25em; border-bottom: 1px solid var(--line); }
#wikiArticle h2 { font: 600 25px/1.2 var(--serif); margin: 1.5em 0 0.4em; padding-bottom: 0.15em; border-bottom: 1px solid var(--line); }
#wikiArticle h3 { font: 600 20px/1.25 var(--serif); margin: 1.3em 0 0.3em; }
#wikiArticle h4, #wikiArticle h5, #wikiArticle h6 { font: 600 17px/1.3 var(--serif); margin: 1.2em 0 0.2em; color: var(--ink-soft); }
#wikiArticle p { margin: 0.5em 0 0.8em; }
#wikiArticle a { color: #7a4a12; }
#wikiArticle a.wl { text-decoration: none; border-bottom: 1px solid rgba(122, 74, 18, 0.35); }
#wikiArticle a.wl:hover { border-bottom-color: #7a4a12; }
#wikiArticle a.missing { color: var(--danger); border-bottom: 1px dotted var(--danger); cursor: help; }
#wikiArticle hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
#wikiArticle blockquote { margin: 1em 0; padding: 0.3em 1em; border-left: 3px solid var(--gold); background: rgba(201, 164, 92, 0.1); }
#wikiArticle img { max-width: 100%; height: auto; border-radius: 3px; }
#wikiArticle code { font: 0.88em Consolas, monospace; background: rgba(0, 0, 0, 0.06); padding: 0.1em 0.3em; border-radius: 3px; }
#wikiArticle pre { overflow-x: auto; background: rgba(0, 0, 0, 0.06); padding: 10px 12px; border-radius: 4px; }
#wikiArticle pre code { background: none; padding: 0; }
#wikiArticle ul, #wikiArticle ol { padding-left: 1.5em; }
#wikiArticle li { margin: 0.15em 0; }
#wikiArticle .tablewrap { overflow-x: auto; margin: 1em 0; }
#wikiArticle table { border-collapse: collapse; font: 13.5px/1.4 var(--sans); min-width: 50%; }
#wikiArticle th, #wikiArticle td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
#wikiArticle th { background: var(--parch-2); font-weight: 600; }
#wikiArticle tr:nth-child(even) td { background: rgba(0, 0, 0, 0.025); }
#wikiArticle .foot { margin-top: 3em; font: 12px var(--sans); color: var(--ink-soft); opacity: 0.8; }
#wikiArticle .muted { color: var(--ink-soft); }
.onmap { margin-top: 2.5em; padding: 2px 18px 16px; background: var(--parch-2); border: 1px solid var(--line); border-radius: 6px; font-family: var(--sans); font-size: 14px; }
#wikiArticle .onmap h2 { font-size: 19px; border: 0; margin-top: 0.8em; }
.onmap .btnrow { margin-top: 12px; }
.placechips { display: flex; flex-wrap: wrap; gap: 6px; }
.placechips button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px 0 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--parch); cursor: pointer; font-size: 13px; color: var(--ink); }
.placechips button:hover { border-color: #9b7a3a; }
.placechips img { height: 20px; }
#wikiToc { overflow-y: auto; padding: 22px 16px 24px 4px; font: 12.5px/1.35 var(--sans); }
#wikiToc .tt { font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; color: var(--ink-soft); margin-bottom: 8px; }
#wikiToc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--ink); text-decoration: none; }
#wikiToc a.sub { padding-left: 22px; color: var(--ink-soft); }
#wikiToc a:hover { border-left-color: var(--gold); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.wikilinks { margin-top: 14px; }
@media (max-width: 1200px) {
  #wiki { grid-template-columns: 250px minmax(0, 1fr); }
  #wikiToc { display: none; }
}
@media (max-width: 800px) {
  #wiki { grid-template-columns: minmax(0, 1fr); }
  #wikiNav { display: none; position: absolute; z-index: 3; left: 0; top: 0; bottom: 0; width: min(300px, 85vw); box-shadow: 4px 0 18px rgba(0, 0, 0, 0.3); }
  body.wiki-nav-open #wikiNav { display: flex; }
  #wikiArticle { padding: 12px 16px 48px; font-size: 16px; }
  #wikiArticle .navbtn { display: inline-block; }
  #wikiArticle h1 { font-size: 28px; }
}
#wikiArticle .placechips img { height: 20px; width: auto; }
#results { background: #14181e; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }

/* inside the table: the table's own bar has Map / Wiki / Table, so drop the duplicates here */
html.embed #tableLink, html.embed #views button[data-view], html.embed .brand { display: none !important; }

/* ---------- tool bar on the left (like the table's) ---------- */
#hotbar { position: absolute; z-index: 1500; left: 0; top: var(--bar); bottom: 0; width: var(--hot); display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 8px 0; background: #101318; border-right: 1px solid var(--chrome-line); }
#hotbar button { width: 36px; height: 36px; border-radius: 6px; border: 1px solid transparent; background: none; color: rgba(232, 226, 208, 0.72); cursor: pointer; display: flex; align-items: center; justify-content: center; }
#hotbar button svg { width: 20px; height: 20px; }
#hotbar button:hover { color: #fff; background: rgba(255,255,255,0.06); }
#hotbar button.on { color: #1d1a16; background: var(--gold); }
#hotbar .sep { width: 24px; height: 1px; background: var(--chrome-line); margin: 4px 0; }
body.view-wiki #hotbar { display: none; }
body.view-wiki #map { left: 0; }

/* ---------- a switch (edit mode) ---------- */
.switch { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 10px; border: 0; background: none; cursor: pointer; color: rgba(232, 226, 208, 0.8); font: 600 12px var(--sans); letter-spacing: 0.04em; }
.switch[hidden] { display: none; }
.switch .track { width: 34px; height: 18px; border-radius: 9px; background: rgba(255,255,255,0.14); position: relative; transition: background 0.15s; }
.switch .knob { position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #e8e2d0; transition: left 0.15s; }
.switch.on .track { background: var(--gold); }
.switch.on .knob { left: 18px; background: #1d1a16; }
.switch.on .lbl { color: #fff; }

/* ---------- inside the table: its own bar has the links, the search floats over the map ---------- */
html.embed { --bar: 0px; }
html.embed #topbar { background: none; border: 0; box-shadow: none; height: 0; padding: 0; pointer-events: none; }
html.embed #topbar > * { pointer-events: auto; }
html.embed #views, html.embed #maptools { display: none !important; }
html.embed .search { position: absolute; top: 10px; left: calc(var(--hot) + 12px); }
html.embed body.view-wiki .search { display: none; }
html.embed body.editing .search { display: none; }
html.embed #search { background: rgba(16, 19, 24, 0.88); width: 260px; }
html.embed #wiki { top: 0; }

/* ───────── who's here (top bar) ───────── */
#me { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 12.5px; }
#me .who { color: var(--chrome-text); }
#me .role { margin-left: 6px; padding: 1px 6px; border-radius: 8px; background: rgba(201,164,92,.18); color: var(--gold); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
#me .tool { height: 26px; padding: 0 10px; border: 1px solid var(--chrome-line); border-radius: 4px; background: none; color: var(--chrome-text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
#me .tool:hover { border-color: var(--gold); }
#me + #maptools { margin-left: 8px; }
body.view-wiki #hotbar { display: none; }

/* ───────── the wiki, Wikipedia-style ───────── */
#wiki { grid-template-columns: 250px minmax(0, 1fr); background: #fff; color: #202122; }
#wikiToc { display: none !important; }
#wikiNav { background: #f8f9fa; border-right: 1px solid #eaecf0; font-family: var(--sans); overflow: hidden; }
#wikiNav .wtabs { display: flex; border-bottom: 1px solid #c8ccd1; padding: 10px 12px 0; gap: 4px; }
#wikiNav .wtabs button { flex: 1; height: 30px; border: 0; border-bottom: 2px solid transparent; background: none; color: #54595d; font-size: 13px; cursor: pointer; }
#wikiNav .wtabs button.on { color: #202122; border-bottom-color: #36c; font-weight: 600; }
#wikiNav .wtabs button:disabled { opacity: .4; cursor: default; }
#wikiNav .wtoc { flex: 1; overflow-y: auto; padding: 10px 10px 16px 14px; font-size: 13.5px; }
#wikiNav .wtoc a { display: block; padding: 3px 6px; color: #202122; text-decoration: none; border-left: 2px solid transparent; line-height: 1.35; }
#wikiNav .wtoc a.l3 { padding-left: 18px; font-size: 13px; }
#wikiNav .wtoc a.l4 { padding-left: 30px; font-size: 12.5px; color: #54595d; }
#wikiNav .wtoc a:hover { color: #36c; }
#wikiNav .wtoc a.on { border-left-color: #36c; color: #36c; font-weight: 600; }
#wikiNav .wtoc a.top { color: #54595d; }
#wikiNav .wpages { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#wikiNav #wikiFilter { margin: 10px 12px 6px; height: 30px; border: 1px solid #a2a9b1; border-radius: 2px; background: #fff; color: #202122; }
#wikiNav #wikiTree { flex: 1; overflow-y: auto; padding: 0 8px 16px; font-size: 13.5px; }
#wikiNav #wikiTree a { color: #36c; padding: 2px 8px; }
#wikiNav #wikiTree a.on { background: #eaf3ff; color: #202122; font-weight: 600; }
#wikiNav #wikiTree a.gm::after { content: 'GM'; margin-left: 6px; font-size: 9.5px; color: #b32424; border: 1px solid #b32424; border-radius: 3px; padding: 0 3px; vertical-align: 1px; }
#wikiNav #wikiTree summary { color: #202122; font-weight: 600; }
#wikiNav #wikiTree .kids { border-left-color: #c8ccd1; }
#wikiNav .wsitelinks { border-top: 1px solid #c8ccd1; padding: 10px 14px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12.5px; }
#wikiNav .wsitelinks a { color: #36c; text-decoration: none; }
#wikiNav .wsitelinks a:hover { text-decoration: underline; }
#wikiMain { background: #fff; }
#wikiArticle { max-width: 1000px; padding: 16px 48px 64px; font: 15px/1.6 var(--sans); color: #202122; }
#wikiArticle a { color: #36c; text-decoration: none; }
#wikiArticle a:hover { text-decoration: underline; }
#wikiArticle a.wl { border: 0; }
#wikiArticle a:visited { color: #6b4ba1; }
#wikiArticle .missing, #wikiArticle a.missing, #wikiArticle a.missing:visited { color: #d73333; border: 0; }
#wikiArticle a.ext::after { content: '↗'; font-size: .75em; margin-left: 2px; vertical-align: super; opacity: .7; }
#wikiArticle .crumbs { font-size: 12.5px; color: #54595d; margin: 2px 0 2px; min-height: 18px; }
#wikiArticle .crumbs a { color: #54595d; }
#wikiArticle h1.ptitle { font: 400 1.95em/1.3 "Linux Libertine", "Georgia", "Times", serif; margin: 0 0 4px; padding: 0 0 4px; border-bottom: 1px solid #a2a9b1; }
#wikiArticle .gmbadge { margin-left: 10px; font: 600 11px var(--sans); color: #b32424; border: 1px solid #b32424; border-radius: 3px; padding: 1px 6px; vertical-align: middle; }
#wikiArticle .fromwiki { font-size: 12.5px; color: #54595d; margin: 4px 0 2px; }
#wikiArticle .shortdesc { font-style: italic; color: #54595d; margin-bottom: 10px; }
#wikiArticle .wikitext { margin-top: 12px; }
#wikiArticle .wikitext::after { content: ''; display: block; clear: both; }
#wikiArticle .wikitext h1, #wikiArticle .wikitext h2 { font: 400 1.5em/1.3 "Linux Libertine", "Georgia", "Times", serif; margin: 1.1em 0 .4em; padding: 0 0 3px; border-bottom: 1px solid #a2a9b1; overflow: hidden; }
#wikiArticle .wikitext h3 { font: 700 1.2em/1.4 var(--sans); margin: .9em 0 .3em; border: 0; }
#wikiArticle .wikitext h4, #wikiArticle .wikitext h5, #wikiArticle .wikitext h6 { font: 700 1.05em/1.4 var(--sans); color: #202122; margin: .8em 0 .2em; }
#wikiArticle .wikitext p { margin: .45em 0 .6em; }
#wikiArticle .wikitext blockquote { border-left: 4px solid #eaecf0; background: none; margin: 1em 0; padding: 2px 16px; color: #202122; font-style: italic; }
#wikiArticle .wquote { border: 0 !important; font-style: normal !important; padding: 0 40px !important; position: relative; }
#wikiArticle .wquote::before { content: '“'; position: absolute; left: 4px; top: -18px; font: 64px/1 Georgia, serif; color: #c8ccd1; }
#wikiArticle .wquote cite { display: block; text-align: right; font-style: normal; color: #54595d; margin-top: 4px; }
#wikiArticle .hatnote { font-style: italic; padding-left: 1.6em; margin: .2em 0 .7em; color: #202122; font-size: 14px; }
#wikiArticle table.infobox { float: right; clear: right; width: 290px; margin: .4em 0 1em 1.4em; border: 1px solid #a2a9b1; background: #f8f9fa; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
#wikiArticle table.infobox caption { font: 700 1.2em/1.3 var(--sans); padding: 6px 8px 8px; caption-side: top; text-align: center; }
#wikiArticle table.infobox th, #wikiArticle table.infobox td { border: 0; padding: 3px 8px; text-align: left; vertical-align: top; background: none; }
#wikiArticle table.infobox th { width: 36%; font-weight: 700; }
#wikiArticle table.infobox tr:nth-child(even) td { background: none; }
#wikiArticle table.infobox .ibsec { text-align: center; background: #eaecf0; }
#wikiArticle table.infobox .ibimg { text-align: center; padding: 4px 8px 8px; }
#wikiArticle table.infobox .ibimg img { max-width: 100%; border-radius: 0; }
#wikiArticle table.infobox .ibcap { font-size: 12px; color: #54595d; margin-top: 4px; }
#wikiArticle figure.thumb { float: right; clear: right; margin: .5em 0 1em 1.4em; padding: 3px; width: 262px; border: 1px solid #c8ccd1; background: #f8f9fa; }
#wikiArticle figure.thumb.left { float: left; clear: left; margin: .5em 1.4em 1em 0; }
#wikiArticle figure.thumb.center { float: none; margin: 1em auto; width: auto; max-width: 600px; }
#wikiArticle figure.thumb img { display: block; width: 100%; border: 1px solid #eaecf0; border-radius: 0; cursor: zoom-in; }
#wikiArticle figure.thumb figcaption { font-size: 12.5px; line-height: 1.4; padding: 4px 3px 2px; color: #202122; }
#wikiArticle .tablewrap { margin: 1em 0; }
#wikiArticle table.wikitable { border: 1px solid #a2a9b1; background: #f8f9fa; font-size: 14px; }
#wikiArticle table.wikitable th { background: #eaecf0; border-color: #a2a9b1; }
#wikiArticle table.wikitable td { border-color: #a2a9b1; background: #f8f9fa; }
#wikiArticle table.wikitable tr:nth-child(even) td { background: #f8f9fa; }
#wikiArticle sup.ref { line-height: 1; font-size: .78em; }
#wikiArticle ol.references { font-size: 13.5px; padding-left: 2em; }
#wikiArticle ol.references .up { margin-right: 4px; }
#wikiArticle .gmonly { border: 1px dashed #b32424; background: #fff5f5; padding: 2px 12px; margin: .8em 0; position: relative; }
#wikiArticle .gmonly::before { content: 'GM only'; position: absolute; top: -9px; right: 10px; background: #fff; color: #b32424; font: 600 10.5px var(--sans); padding: 0 5px; }
#wikiArticle .tbd { color: #a66200; font-style: italic; background: #fef6e7; padding: 0 4px; border-radius: 2px; }
#wikiArticle .wfoot { clear: both; margin-top: 2.5em; }
#wikiArticle .catlinks { border: 1px solid #a2a9b1; background: #f8f9fa; padding: 6px 10px; font-size: 13px; margin-bottom: 10px; }
#wikiArticle .linkshere { font-size: 13px; margin-bottom: 10px; }
#wikiArticle .linkshere summary { cursor: pointer; color: #54595d; }
#wikiArticle .linkshere ul { columns: 3 180px; margin: 6px 0; }
#wikiArticle .lastmod { font-size: 12px; color: #54595d; border-top: 1px solid #eaecf0; padding-top: 10px; }
#wikiArticle .onmap { background: #f8f9fa; border-color: #c8ccd1; clear: both; }
#wikiArticle .wptabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid #a2a9b1; margin: 0 0 6px; font-size: 13px; }
#wikiArticle .wptabs a { padding: 6px 10px 5px; color: #36c; border-bottom: 2px solid transparent; margin-bottom: -1px; }
#wikiArticle .wptabs a.on { color: #202122; border-bottom-color: #202122; font-weight: 600; }
#wikiArticle .wptabs .grow { flex: 1; }
#wikiArticle .wptabs button { margin: 0 0 4px 6px; height: 26px; padding: 0 10px; border: 1px solid #a2a9b1; border-radius: 2px; background: #f8f9fa; color: #202122; font-size: 12.5px; cursor: pointer; }
#wikiArticle .wptabs button.gmtoggle.on { background: #fff5f5; border-color: #b32424; color: #b32424; }
#wikiArticle .speclist { padding-left: 1.4em; }
#wikiArticle .speclist.cols { columns: 3 200px; }
#wikiArticle .speclist .when { color: #54595d; font-size: 13px; }
#wikiArticle .catgroups { columns: 3 200px; }
#wikiArticle .catgroups h3 { margin: .3em 0; font-size: 1em; }
#wikiArticle .catgroups ul { margin: 0 0 .8em; padding-left: 1.2em; }
#wikiArticle .btn { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border: 1px solid #a2a9b1; border-radius: 2px; background: #f8f9fa; color: #202122; cursor: pointer; font: 14px var(--sans); }
#wikiArticle .btn.primary { background: #36c; border-color: #36c; color: #fff; }
#wikiArticle .btn.primary:hover { background: #447ff5; text-decoration: none; }
#wikiArticle .btn.sm { height: 26px; padding: 0 10px; font-size: 12.5px; margin-left: 6px; }
#wikiArticle .row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
#wikiArticle .impurl { flex: 1; height: 32px; padding: 0 8px; border: 1px solid #a2a9b1; border-radius: 2px; }
#wikiArticle textarea { width: 100%; border: 1px solid #a2a9b1; border-radius: 2px; padding: 8px; font: 13px/1.5 Consolas, monospace; }
#wikiArticle .err { color: #d73333; }
#wikiArticle .histtable { width: 100%; font-size: 13.5px; }
#wikiArticle .oldbanner { background: #fef6e7; border: 1px solid #fc3; padding: 8px 12px; margin: 16px 0; font-size: 13.5px; }
#wikiArticle .diff { font: 12.5px/1.5 Consolas, monospace; border: 1px solid #c8ccd1; margin-top: 10px; }
#wikiArticle .diff .d { white-space: pre-wrap; padding: 0 8px; }
#wikiArticle .diff .d span { display: inline-block; width: 14px; color: #72777d; }
#wikiArticle .diff .add { background: #d8ecff; }
#wikiArticle .diff .del { background: #feeec8; text-decoration: line-through; text-decoration-color: rgba(0,0,0,.3); }
#wikiArticle .diff .gap { color: #72777d; text-align: center; background: #f8f9fa; }
.wlightbox { position: fixed; inset: 0; z-index: 6000; background: rgba(0,0,0,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out; }
.wlightbox img { max-width: 92vw; max-height: 85vh; }
.wlightbox .cap { color: #eee; margin-top: 10px; font-size: 14px; }
/* the editor */
body.wiki-editing #wikiArticle { max-width: none; padding: 12px 20px 20px; }
#wikiArticle .editor { display: flex; flex-direction: column; height: calc(100vh - var(--bar) - 70px); min-height: 480px; }
#wikiArticle .ehead { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
#wikiArticle .etitle { flex: 2; height: 36px; padding: 0 10px; border: 1px solid #a2a9b1; border-radius: 2px; font: 20px "Linux Libertine", Georgia, serif; }
#wikiArticle .efolder { flex: 1; height: 36px; padding: 0 10px; border: 1px solid #a2a9b1; border-radius: 2px; }
#wikiArticle .egm { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #b32424; white-space: nowrap; }
#wikiArticle .etools { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; padding: 4px; border: 1px solid #a2a9b1; border-bottom: 0; background: #f8f9fa; }
#wikiArticle .etools button { height: 28px; min-width: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 2px; background: none; color: #202122; cursor: pointer; font-size: 13px; }
#wikiArticle .etools button:hover { border-color: #a2a9b1; background: #fff; }
#wikiArticle .etools .sep { width: 1px; height: 20px; background: #c8ccd1; margin: 0 4px; }
#wikiArticle .etools .grow { flex: 1; }
#wikiArticle .ehelp { font-size: 12.5px; margin-right: 6px; }
#wikiArticle .ehelpbox { font-size: 12.5px; padding: 8px 10px; border: 1px solid #a2a9b1; border-bottom: 0; background: #eaf3ff; line-height: 1.8; }
#wikiArticle .ehelpbox code { background: #fff; padding: 1px 4px; border-radius: 2px; }
#wikiArticle .esplit { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #a2a9b1; }
#wikiArticle .esrc { height: 100%; resize: none; border: 0 !important; border-right: 1px solid #a2a9b1 !important; border-radius: 0; padding: 12px 14px; font: 13.5px/1.6 Consolas, "Courier New", monospace; outline: none; }
#wikiArticle .epreview { overflow-y: auto; padding: 8px 22px 30px; }
#wikiArticle .epreview h1.ptitle { margin-top: 6px; }
#wikiArticle .efoot { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
#wikiArticle .esum { flex: 1; height: 32px; padding: 0 10px; border: 1px solid #a2a9b1; border-radius: 2px; }
#wikiArticle .estatus { font-size: 13px; color: #54595d; }
@media (max-width: 900px) { #wikiArticle .esplit { grid-template-columns: 1fr; } #wikiArticle .epreview { display: none; } #wikiArticle table.infobox, #wikiArticle figure.thumb { float: none; width: auto; margin: 1em 0; } }
@media (max-width: 800px) { #wiki { grid-template-columns: minmax(0, 1fr); } }

/* ───────── Files ───────── */
#drive { position: absolute; z-index: 2000; left: 0; right: 0; top: var(--bar); bottom: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); background: #fff; color: #1f1f1f; font-family: var(--sans); }
#drive[hidden], #admin[hidden] { display: none; }
#drive.dropping::after { content: 'Drop to upload here'; position: absolute; inset: 10px 10px 10px 250px; border: 3px dashed #1a73e8; border-radius: 12px; background: rgba(26,115,232,.06); display: grid; place-items: center; font-size: 20px; color: #1a73e8; pointer-events: none; }
#drive .dic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#drive .dic.sm { width: 17px; height: 17px; }
#drive .dic.big { width: 54px; height: 54px; stroke-width: 1.2; }
#drive .k-folder { color: #5f6368; } #drive .dic.k-folder { fill: #5f6368; stroke: #5f6368; }
#drive .dfolders .dic.k-folder { fill: #8f8a7f; stroke: #8f8a7f; }
#drive .k-page { color: #1a73e8; } #drive .k-image { color: #d93025; } #drive .k-pdf { color: #ea4335; } #drive .k-audio { color: #9334e6; } #drive .k-video { color: #c5221f; } #drive .k-sheet { color: #188038; } #drive .k-zip { color: #5f6368; }
#drive .lk { color: #b32424; }
#drive .dnav { border-right: 1px solid #e0e0e0; padding: 12px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; background: #f8fafd; }
#drive .dnew { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; height: 48px; padding: 0 22px 0 16px; margin: 0 0 12px 4px; border: 0; border-radius: 16px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); font-size: 14px; font-weight: 500; cursor: pointer; }
#drive .dnew:hover { box-shadow: 0 2px 6px rgba(0,0,0,.3); background: #f0f4f9; }
#drive .dnav > a, #drive .dtn > a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; border-radius: 16px; color: #1f1f1f; text-decoration: none; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#drive .dnav > a:hover, #drive .dtn > a:hover { background: #e9eef6; }
#drive .dnav a.on { background: #c2e7ff; font-weight: 600; }
#drive .dnav a.over { background: #d3e3fd; outline: 2px solid #1a73e8; }
#drive .dtn .tw { width: 10px; font-size: 10px; color: #5f6368; }
#drive .dtn > a { gap: 6px; height: 28px; }
#drive .dstat { margin-top: auto; padding: 12px; font-size: 12px; color: #5f6368; }
#drive .dmain { display: flex; flex-direction: column; min-height: 0; }
#drive .dtop { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #e0e0e0; }
#drive .dcrumbs { flex: 1; display: flex; align-items: center; gap: 4px; font-size: 18px; min-width: 0; overflow: hidden; white-space: nowrap; }
#drive .dcrumbs a { color: #1f1f1f; text-decoration: none; padding: 4px 8px; border-radius: 6px; }
#drive .dcrumbs a:hover { background: #e9eef6; }
#drive .dcrumbs a.over { background: #d3e3fd; }
#drive .dcrumbs .sep { color: #5f6368; }
#drive .dcrumbs .muted { font-size: 13px; color: #5f6368; white-space: normal; }
#drive .dsearch { width: min(340px, 30vw); height: 40px; padding: 0 16px; border: 0; border-radius: 20px; background: #e9eef6; font-size: 14px; outline: none; }
#drive .dsearch:focus { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
#drive .dview { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; color: #444; }
#drive .dview:hover { background: #e9eef6; }
#drive .dbody { flex: 1; overflow-y: auto; padding: 8px 20px 40px; outline: none; }
#drive .dhero { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding: 8px 0 18px; margin-bottom: 4px; border-bottom: 1px solid #e0e0e0; }
#drive .dht { flex: 1; min-width: 220px; }
#drive .dht h1 { font: 400 30px/1.2 'Linux Libertine', Georgia, 'Times New Roman', serif; margin: 0; color: #202122; }
#drive .dht p { margin: 4px 0 0; color: #54595d; }
#drive .dhl { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; }
#drive .dhl a { color: #3366cc; text-decoration: none; }
#drive .dhl a:hover { text-decoration: underline; }
#drive .dhl a.dmain-page { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid #c8ccd1; border-radius: 10px; background: #f8f9fa; color: #202122; }
#drive .dhl a.dmain-page:hover { background: #eaf3ff; text-decoration: none; }
#drive .dhl a.dmain-page span { display: flex; flex-direction: column; line-height: 1.2; }
#drive .dhl a.dmain-page small { color: #54595d; font-size: 12px; }
#drive .dsec { font-size: 13.5px; font-weight: 500; color: #1f1f1f; margin: 16px 0 10px; }
#drive .dfolders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
#drive .dfolders .ditem { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 18px; border-radius: 14px; background: #f0f4f9; cursor: default; user-select: none; font-size: 15px; font-weight: 500; }
#drive .dfolders .ditem .dn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#drive .dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
#drive .dgrid .ditem { border-radius: 12px; background: #f0f4f9; padding: 0 0 2px; cursor: default; user-select: none; overflow: hidden; }
#drive .dgrid .dthumb { height: 210px; margin: 8px 8px 0; border-radius: 6px; background: #fff; display: grid; place-items: center; overflow: hidden; }
#drive .dgrid .dthumb img { width: 100%; height: 100%; object-fit: cover; }
#drive .dgrid .dcap { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-size: 14.5px; font-weight: 500; }
#drive .dgrid .dcap .dn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#drive .ditem:hover { background: #e1e5ea; }
#drive .ditem.sel { background: #c2e7ff !important; }
#drive .ditem.over { outline: 2px solid #1a73e8; background: #d3e3fd; }
#drive .gmtag { font-size: 9.5px; font-weight: 700; color: #b32424; border: 1px solid #b32424; border-radius: 3px; padding: 0 3px; }
#drive .dlist { width: 100%; border-collapse: collapse; font-size: 13.5px; }
#drive .dlist th { text-align: left; font-weight: 500; color: #444; padding: 10px 8px; border-bottom: 1px solid #e0e0e0; }
#drive .dlist td { padding: 8px; border-bottom: 1px solid #f0f0f0; color: #444; }
#drive .dlist tr.ditem { background: none; }
#drive .dlist tr.ditem:hover td { background: #f0f4f9; }
#drive .dlist tr.ditem.sel td { background: #c2e7ff; }
#drive .dlist .dname { display: flex; align-items: center; gap: 10px; color: #1f1f1f; font-weight: 500; }
#drive .dempty { text-align: center; color: #5f6368; padding: 80px 20px; }
#drive .dempty .dic { color: #c4c7c5; }
.dmenu { position: fixed; z-index: 7000; min-width: 220px; padding: 6px 0; background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.25); font: 14px var(--sans); }
.dmenu button { display: block; width: 100%; text-align: left; padding: 8px 18px; border: 0; background: none; color: #1f1f1f; cursor: pointer; }
.dmenu button:hover { background: #f1f3f4; }
.dmenu button.danger { color: #d93025; }
.dmenu .dsepx { height: 1px; background: #e0e0e0; margin: 6px 0; }
.dpreview { position: fixed; inset: 0; z-index: 6500; background: rgba(32,33,36,.92); display: flex; flex-direction: column; }
.dpreview .dpbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: #fff; font: 14px var(--sans); }
.dpreview .dpbar .dic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.dpreview .dpbar .muted { color: #bbb; }
.dpreview .dpbar .grow { flex: 1; }
.dpreview .btn { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 4px; border: 1px solid rgba(255,255,255,.3); background: none; color: #fff; text-decoration: none; cursor: pointer; font-size: 13px; }
.dpreview .dpbody { flex: 1; min-height: 0; display: grid; place-items: center; padding: 10px 20px 30px; }
.dpreview .dpbody img, .dpreview .dpbody video { max-width: 100%; max-height: 100%; }
.dpreview .dpbody iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; }
.dpreview .dtext { width: min(900px, 100%); height: 100%; overflow: auto; background: #fff; color: #202122; padding: 24px 32px; white-space: pre-wrap; font: 14px/1.6 var(--sans); }
.dpreview .dtext .wikitext { white-space: normal; }
.dpreview .dnoprev { color: #ddd; text-align: center; }
.dpreview .dnoprev .dic { width: 64px; height: 64px; fill: none; stroke: currentColor; }
.dialog.wide { width: min(900px, 94vw); }
.dpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; max-height: 55vh; overflow-y: auto; margin-top: 10px; }
.dpitem { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--parch); cursor: pointer; color: var(--ink); font-size: 12px; text-align: left; }
.dpitem:hover { border-color: #9b7a3a; }
.dpitem img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; }
.dpitem span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpitem .dic { width: 48px; height: 48px; margin: 21px auto; fill: none; stroke: currentColor; stroke-width: 1.3; }
.dmovesel { width: 100%; font-size: 14px; }
.dmovenew { width: 100%; margin-top: 8px; height: 32px; padding: 0 8px; }

/* ───────── Admin ───────── */
#admin { position: absolute; z-index: 2000; left: 0; right: 0; top: var(--bar); bottom: 0; overflow-y: auto; background: #f8f9fa; color: #202122; font-family: var(--sans); }
#admin .adwrap { max-width: 900px; margin: 0 auto; padding: 24px 32px 60px; }
#admin h1 { font: 400 28px "Linux Libertine", Georgia, serif; margin: 0 0 16px; }
#admin section { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 6px 22px 20px; margin-bottom: 18px; }
#admin h2 { font: 600 17px var(--sans); margin: 16px 0 10px; }
#admin .adgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-bottom: 14px; }
#admin .adgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #54595d; }
#admin .adgrid label.inline { grid-column: 1 / -1; flex-direction: row; align-items: flex-start; gap: 10px; color: #202122; }
#admin .adgrid label.inline input { margin-top: 3px; }
#admin input:not([type=checkbox]), #admin select { height: 34px; padding: 0 10px; border: 1px solid #a2a9b1; border-radius: 4px; font-size: 14px; background: #fff; color: #202122; }
#admin .muted { color: #54595d; }
#admin .warn { color: #a66200; }
#admin .btn { display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border: 1px solid #a2a9b1; border-radius: 4px; background: #f8f9fa; color: #202122; cursor: pointer; text-decoration: none; font-size: 14px; }
#admin .btn.primary { background: #36c; border-color: #36c; color: #fff; }
#admin .btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; margin-right: 6px; }
#admin .btn.danger { color: #d33; border-color: #d33; }
#admin .row { display: flex; gap: 10px; flex-wrap: wrap; }
#admin .adtable { width: 100%; border-collapse: collapse; font-size: 14px; }
#admin .adtable th { text-align: left; font-weight: 600; padding: 8px; border-bottom: 1px solid #c8ccd1; }
#admin .adtable td { padding: 8px; border-bottom: 1px solid #eaecf0; }
#admin .adtable select { height: 30px; }
#admin .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
#wikiArticle table.infobox th.ibtitle { text-align: center; font-size: 1.2em; padding: 8px 8px 6px; width: auto; }
#drive .dgrid .dpage { width: 100%; height: 100%; padding: 14px 16px; font: 11.5px/1.5 var(--sans); color: #5f6368; overflow: hidden; text-align: left; align-self: start; }
#drive .dgrid .dpage b { display: block; font: 600 15px/1.3 Georgia, serif; color: #202122; margin-bottom: 4px; border-bottom: 1px solid #e0e0e0; padding-bottom: 3px; }
html.embed #me { display: none !important; }

/* ───────── the sky over the map: night, dawn and dusk, weather ───────── */
.leaflet-sky-pane { pointer-events: none; }
.skybox { position: absolute; left: 0; top: 0; pointer-events: none; }
.skybox > * { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.skynight, .skyglow { transition: background 1.2s; }
.skyfx { transition: opacity .2s; }
body.sky-night:not(.no-nightglow) .mk-wrap img, body.sky-night:not(.no-nightglow) .mk-wrap svg { filter: drop-shadow(0 0 3px rgba(255, 196, 92, .95)) drop-shadow(0 0 9px rgba(255, 160, 60, .55)); }
#hotbar .skybtn { height: auto; min-height: 36px; flex-direction: column; gap: 1px; padding: 4px 0; margin-top: 2px; }
#hotbar .skybtn .skyt { font: 600 10px/1 var(--sans); letter-spacing: .02em; }
.skypanel { position: fixed; z-index: 2600; width: 330px; padding: 12px 14px; border-radius: 10px; background: rgba(20, 22, 27, .97); color: #e8e2d0;
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 16px 40px rgba(0,0,0,.55); font: 13px var(--sans); }
.skypanel .skyhead { display: flex; align-items: center; gap: 12px; }
.skypanel .skytime { font: 600 28px/1 var(--serif, Georgia); color: var(--gold, #c9a45c); }
.skypanel .muted { color: rgba(232,226,208,.6); }
.skypanel .skyrow { margin: 8px 0 4px; font-size: 12px; }
.skypanel .skyadv { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 8px; }
.skypanel .skyset { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.skypanel input, .skypanel select { color-scheme: dark; height: 28px; border-radius: 5px; border: 1px solid rgba(255,255,255,.18); background: #101216; color: #e8e2d0; padding: 0 6px; font-size: 12.5px; }
.skypanel input[type=range] { width: 100%; padding: 0; border: 0; background: none; }
.skypanel input[type=checkbox] { height: auto; }
.skypanel .btn { height: 28px; padding: 0 9px; border-radius: 5px; border: 1px solid rgba(255,255,255,.16); background: #23262d; color: #e8e2d0; cursor: pointer; font-size: 12px; }
.skypanel .btn:hover { background: #2e323a; }
.skypanel .btn.primary { background: var(--gold, #c9a45c); border-color: var(--gold, #c9a45c); color: #1d1a16; font-weight: 600; }
.skypanel .skylabel { margin: 10px 0 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgba(232,226,208,.55); }
.skypanel .skyweather { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.skypanel .wbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; border-radius: 6px; border: 1px solid transparent; background: #1b1e23; color: #cfc6b0; cursor: pointer; font-size: 10.5px; }
.skypanel .wbtn:hover { background: #262a31; }
.skypanel .wbtn.on { border-color: var(--gold, #c9a45c); color: #fff; background: #2a2516; }
.skypanel .wbtn .wi svg { width: 20px; height: 20px; display: block; }
.skypanel .skywind { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.skypanel .skywind label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: rgba(232,226,208,.65); }
.skypanel .skyfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.skypanel .skyfoot a { color: var(--gold, #c9a45c); text-decoration: none; white-space: nowrap; }
.skypanel label.inline { display: flex; align-items: center; gap: 6px; }

/* ───────── the Calendar view ───────── */
#calendar { position: absolute; z-index: 2000; left: 0; right: 0; top: var(--bar); bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; background: #f6f1e6; color: #2b2418; font-family: var(--sans); overflow: hidden; }
#calendar[hidden] { display: none; }
#calendar .calempty { padding: 40px; color: #6b5c44; }
#calendar .cmain { padding: 20px 26px; overflow-y: auto; }
#calendar .chead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
#calendar .ctitle { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
#calendar .ctitle h1 { margin: 0; font: 400 30px/1.15 'Linux Libertine', Georgia, serif; }
#calendar .ctitle span { color: #7a6748; font-style: italic; font-family: Georgia, serif; }
#calendar .grow { flex: 1; }
#calendar .btn { height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid #c9b994; background: #fffaf0; color: #2b2418; cursor: pointer; font-size: 13px; }
#calendar .btn:hover { background: #fff; }
#calendar .btn.sm { height: 30px; }
#calendar .btn.primary { background: #7a4f1d; border-color: #7a4f1d; color: #fff; }
#calendar .cgrid { display: grid; gap: 6px; }
#calendar .cwk { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: #8a7a5c; padding: 0 4px 2px; }
#calendar .cday { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-height: 84px; padding: 6px 7px; border-radius: 8px; border: 1px solid #e3d7bd; background: #fffcf5; color: inherit; text-align: left; cursor: pointer; font: inherit; overflow: hidden; }
#calendar .cday:hover { border-color: #c9a45c; }
#calendar .cday.blank { background: none; border-color: transparent; cursor: default; }
#calendar .cday .cn { font: 600 14px Georgia, serif; color: #5a4a30; }
#calendar .cday.today { background: #fff3d6; border-color: #c9a45c; box-shadow: 0 0 0 2px rgba(201,164,92,.45); }
#calendar .cday.today .cn { color: #7a4f1d; }
#calendar .cday.sel { border-color: #7a4f1d; box-shadow: 0 0 0 2px rgba(122,79,29,.35); }
#calendar .cday .cnow { position: absolute; top: 6px; right: 7px; font-size: 10.5px; font-weight: 600; color: #7a4f1d; }
#calendar .cday .cev { font-size: 11px; line-height: 1.25; padding: 2px 5px; border-radius: 4px; background: #efe2c4; color: #4a3b26; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#calendar .cday .cev.gm { background: #e8d9f2; color: #4a2a5e; }
#calendar .cday .cmore { font-size: 10.5px; color: #8a7a5c; }
#calendar .cside { border-left: 1px solid #e3d7bd; background: #fbf7ee; padding: 20px 18px; overflow-y: auto; }
#calendar .cnowbox { padding: 14px; border-radius: 10px; background: #2b2418; color: #f3e6c4; margin-bottom: 16px; }
#calendar .cnowbox .big { font: 600 32px/1 Georgia, serif; color: #e8c37a; margin-bottom: 6px; }
#calendar .cnowbox .muted { color: rgba(243,230,196,.65); }
#calendar .cnowbox .btn { background: #3a3226; border-color: #5a4c36; color: #f3e6c4; }
#calendar .cdaybox h2 { font: 400 20px/1.25 'Linux Libertine', Georgia, serif; margin: 0 0 10px; }
#calendar .cevent { padding: 9px 10px; border-radius: 8px; background: #fff; border: 1px solid #e3d7bd; margin-bottom: 8px; }
#calendar .cevent.gm { border-color: #d7c3e6; background: #faf5fd; }
#calendar .cet { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#calendar .cetext { margin-top: 4px; font-size: 13px; white-space: pre-wrap; color: #4a3b26; }
#calendar .ceacts { margin-top: 6px; display: flex; gap: 12px; }
#calendar .linkbtn { background: none; border: 0; padding: 0; color: #7a4f1d; cursor: pointer; font-size: 12.5px; }
#calendar .linkbtn.danger { color: #b3261e; }
#calendar .gmtag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: #6c3d8a; color: #fff; }
#calendar .muted { color: #8a7a5c; }
#calendar .row { display: flex; align-items: center; }
#calendar .cup { margin-top: 20px; }
#calendar .cup h3 { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: #8a7a5c; margin: 0 0 6px; }
#calendar .cupi { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left; font: 13px var(--sans); color: #2b2418; }
#calendar .cupi:hover { background: #f1e7d2; }
.dialog .calset h3 { margin: 14px 0 6px; font-size: 14px; }
.dialog .cmonths { display: flex; flex-direction: column; gap: 5px; max-height: 260px; overflow-y: auto; }
.dialog .cmonths .row { display: flex; align-items: center; gap: 6px; }
@media (max-width: 800px) { #calendar { grid-template-columns: 1fr; overflow-y: auto; } #calendar .cside { border-left: 0; border-top: 1px solid #e3d7bd; } #calendar .cday { min-height: 54px; } }

/* ───────── the wiki's front page ───────── */
#drive .dbody.isportal { padding: 0 0 60px; }
#drive .isportal > :not(.phero) { margin-left: clamp(20px, 4vw, 56px); margin-right: clamp(20px, 4vw, 56px); }
#drive .phero { position: relative; overflow: hidden; padding: clamp(36px, 7vh, 72px) clamp(20px, 4vw, 56px) 34px; color: #fff; background: #1d3b40; }
#drive .phero .pbg { position: absolute; inset: -20px; background: radial-gradient(ellipse at 70% 40%, #3f6f72, #22474c 70%); filter: blur(1.5px) saturate(1.1); }
#drive .phero .pbg canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 45%; opacity: .95; }
#drive .phero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14,24,28,.86) 0%, rgba(14,24,28,.55) 55%, rgba(14,24,28,.2) 100%); }
#drive .phero .pin { position: relative; z-index: 1; max-width: 860px; }
#drive .phero h1 { margin: 0; font: 400 clamp(34px, 4.4vw, 56px)/1.08 'Linux Libertine', Georgia, 'Times New Roman', serif; letter-spacing: .01em; text-shadow: 0 2px 18px rgba(0,0,0,.5); }
#drive .phero .ptag { margin: 10px 0 22px; font: italic 400 19px/1.4 Georgia, serif; color: #e9e1cc; }
#drive .phero .pq { width: min(620px, 100%); height: 52px; padding: 0 22px; border-radius: 26px; border: 0; font-size: 17px; background: rgba(255,255,255,.96); color: #202122; box-shadow: 0 8px 30px rgba(0,0,0,.35); outline: none; }
#drive .phero .pq:focus { box-shadow: 0 0 0 3px rgba(201,164,92,.8), 0 8px 30px rgba(0,0,0,.35); }
#drive .phero .plinks { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
#drive .phero .pbtn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 20px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: #fff; text-decoration: none; font-size: 14.5px; font-weight: 500; backdrop-filter: blur(6px); }
#drive .phero .pbtn:hover { background: rgba(255,255,255,.26); }
#drive .phero .pbtn .dic { stroke: #fff; fill: none; }
#drive .phero .pstats { margin-top: 18px; font-size: 13px; color: rgba(255,255,255,.7); }
#drive .ptwo { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 22px; margin-top: 28px; align-items: start; }
@media (max-width: 900px) { #drive .ptwo { grid-template-columns: 1fr; } }
#drive .pfeature { display: block; position: relative; padding: 26px 30px 24px; border-radius: 16px; background: #faf7ef; border: 1px solid #e8e0cc; color: #202122; text-decoration: none; overflow: hidden; min-height: 220px; }
#drive .pfeature:hover { border-color: #c9a45c; box-shadow: 0 8px 26px rgba(80,60,20,.12); }
#drive .pfeature img { float: right; width: 38%; max-height: 260px; object-fit: cover; border-radius: 10px; margin: 0 0 12px 22px; }
#drive .pfeature .pfk { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #9a7a3a; font-weight: 600; }
#drive .pfeature h2 { margin: 6px 0 12px; font: 400 32px/1.15 'Linux Libertine', Georgia, serif; border: 0; }
#drive .pfeature p { margin: 0; font: 16px/1.65 Georgia, serif; color: #3d3b36; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
#drive .pmore { display: inline-block; margin-top: 12px; color: #3366cc; font-size: 14px; font-weight: 500; text-decoration: none; }
#drive .precent { padding: 20px 22px; border-radius: 16px; background: #f0f4f9; display: flex; flex-direction: column; }
#drive .precent h3, #drive .psec { margin: 0 0 12px; font: 400 22px/1.2 'Linux Libertine', Georgia, serif; color: #202122; }
#drive .psec { margin-top: 38px; margin-bottom: 16px; }
#drive .precent > a:not(.pmore) { display: flex; flex-direction: column; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; text-decoration: none; color: #202122; }
#drive .precent > a:not(.pmore):hover { background: #e1e8f2; }
#drive .precent > a b { font-weight: 500; font-size: 15px; }
#drive .precent > a span { font-size: 12.5px; color: #5f6368; }
#drive .pfolders { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; align-items: start; }
#drive .pfolder { border-radius: 16px; background: #fff; border: 1px solid #e3e6ea; box-shadow: 0 1px 3px rgba(0,0,0,.05); overflow: hidden; display: flex; flex-direction: column; padding-bottom: 14px; }
#drive .pfolder:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); }
#drive .pfolder.over { outline: 2px solid #1a73e8; }
#drive .pfolder.gm { border-style: dashed; }
#drive .pfh { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 20px; min-height: 92px; text-decoration: none; color: #202122; background: linear-gradient(135deg, #eef2f6, #e3eaf1); overflow: hidden; }
#drive .pfh img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .32; }
#drive .pfh > :not(img) { position: relative; }
#drive .pficon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); flex: none; }
#drive .pficon .dic { width: 30px; height: 30px; fill: #c9a45c; stroke: #a8843f; }
#drive .pfn { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
#drive .pfn b { font: 400 23px/1.15 'Linux Libertine', Georgia, serif; }
#drive .pfn small { font-size: 13px; color: #5f6368; }
#drive .pfsubs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px 0; }
#drive .pfsubs a { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 14px; background: #f0f4f9; color: #202122; font-size: 13px; text-decoration: none; }
#drive .pfsubs a:hover { background: #e1e8f2; }
#drive .pfolder ul { list-style: none; margin: 10px 0 0; padding: 0 12px; }
#drive .pfolder li a { display: block; padding: 6px 8px; border-radius: 6px; color: #3366cc; text-decoration: none; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#drive .pfolder li a:hover { background: #f0f4f9; }
#drive .pfolder > .pmore { margin: 6px 20px 0; }
#drive .dgrid .dpage.haspic img { display: block; width: calc(100% + 32px); height: 92px; object-fit: cover; margin: -14px -16px 10px; }
#drive .dmain:has(.isportal) .dtop .dsearch { visibility: hidden; }
#drive .dbody.isfolder { padding: 0 clamp(20px, 4vw, 56px) 60px; }
#drive .pfhead { padding: 30px 0 22px; margin-bottom: 22px; border-bottom: 1px solid #e3e6ea; }
#drive .pfhead h1 { margin: 0 0 4px; font: 400 clamp(30px, 3.4vw, 44px)/1.1 'Linux Libertine', Georgia, 'Times New Roman', serif; color: #202122; }
#drive .pfhead .muted { color: #5f6368; font-size: 14px; }
#drive .pfolder.sel { outline: 2px solid #1a73e8; }
#drive .psec:empty { display: none; }

/* ───────── routes, water names, map settings (app/maptools.js) ───────── */
.namesvg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.namesvg .wname { pointer-events: none; user-select: none; }
body.editing .namesvg .wname.edit { pointer-events: visiblePainted; cursor: pointer; }
.namesvg .wname.sel { fill: #8a4b0a !important; fill-opacity: 1 !important; }
.namesvg .draftline { fill: none; stroke: #ffd27a; stroke-width: 2.5; stroke-dasharray: 8 6; stroke-linecap: round; }
.leaflet-marker-icon.vhandle { border-radius: 50%; background: #ffd27a; border: 2px solid #1d1a16; box-shadow: 0 0 0 2px rgba(255,255,255,.5); cursor: grab; }
.leaflet-marker-icon.vhandle.lbl { background: #a9dbe6; }
.leaflet-marker-icon.vhandle.add { background: rgba(255,255,255,.8); border-width: 1px; color: #1d1a16; font: 700 12px/12px var(--sans); text-align: center; opacity: .75; cursor: copy; }
.leaflet-marker-icon.vhandle.add:hover { opacity: 1; }
body.mt-drawing #map, body.mt-drawing .leaflet-interactive { cursor: crosshair !important; }
#mthint { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1200; padding: 9px 16px; border-radius: 20px; background: rgba(20,22,27,.92); color: #f1ead8; font: 500 13px var(--sans); box-shadow: 0 6px 20px rgba(0,0,0,.35); pointer-events: none; }
.rtip { font: italic 600 13px var(--serif); }
.routepopup .leaflet-popup-content { margin: 12px 16px; min-width: 200px; }
.routepop .rk { font: 600 10.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: #8a6a2a; }
.routepop > b { display: block; font: 600 19px/1.2 var(--serif); margin: 2px 0 4px; }
.routepop .rd { font-weight: 600; margin-bottom: 6px; }
.routepop table { border-collapse: collapse; font-size: 13px; width: 100%; }
.routepop td { padding: 2px 0; } .routepop td + td { text-align: right; padding-left: 12px; white-space: nowrap; }
.routepop p { margin: 8px 0 4px; white-space: pre-wrap; }
.nrow .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); flex: none; }
.mtset .row { align-items: flex-end; }
.mtset .sl label .val { font-weight: 400; color: var(--ink); margin-left: 4px; }
.mtset input[type=range] { width: 100%; }
.mtset input[type=color] { width: 100%; height: 32px; padding: 2px; }
#editbar .tool.icon svg { display: block; }

/* Admin › People: adding someone, campaigns, the login details to send */
#admin .adnew { padding: 14px 16px; border: 1px solid #e3e6ea; border-radius: 12px; background: #f8f9fb; margin: 6px 0 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
#admin .adnew .adgrid { width: 100%; }
#admin .adcamps { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
#admin .adcamps label.inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
#admin .adcard { margin: 0 0 18px; padding: 14px 16px; border: 2px solid #c9a45c; border-radius: 12px; background: #fffaf0; display: flex; flex-direction: column; gap: 8px; }
#admin .adcopy { width: 100%; font: 13px/1.5 ui-monospace, Consolas, monospace; padding: 8px 10px; border: 1px solid #d8cfba; border-radius: 6px; background: #fff; resize: none; }
#admin h3 { font-size: 14px; margin: 14px 0 6px; }
