/* Styled after the WSDS control panel (itself styled after the game's menus): dark purple, gold edges,
   corner diamonds. WSDS uses the game's own fonts; the site uses open-licensed look-alikes it can host. */
@font-face { font-family: "Cinzel Decorative"; src: url(/vendor/fonts/cinzel-decorative-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel Decorative"; src: url(/vendor/fonts/cinzel-decorative-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Lato"; src: url(/vendor/fonts/lato-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lato"; src: url(/vendor/fonts/lato-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg-0: #0d0913;
  --bg-1: #160f20;
  --panel: rgba(24, 16, 34, 0.9);
  --panel-solid: #1a1226;
  --gold: #e8c478;
  --gold-2: #c9a15a;
  --gold-dim: #8e6d36;
  --cream: #f3e9d2;
  --text: #e9e1d2;
  --muted: #a99db4;
  --purple: #4b2a6e;
  --purple-2: #321a4c;
  --purple-hi: #6b3f99;
  --red: #d24b4b;
  --green: #7fd38a;
  --amber: #f0b45a;
  --orb: #7fd8f0;
  --done: #7d7288;
  --title-font: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --body-font: "Lato", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--text);
  font: 14px/1.45 var(--body-font);
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(232, 196, 120, 0.35); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

h2, h3, .title { font-family: var(--title-font); font-weight: normal; letter-spacing: 0.3px; margin: 0; }
h2 { color: var(--cream); font-size: 22px; }
h3 { color: var(--gold); font-size: 17px; }

#map { position: fixed; inset: 0; background: #0e3a42; }
.leaflet-container { background: #0e3a42; font: inherit; }
.leaflet-bottom.leaflet-right { margin-bottom: 26px; }
.leaflet-touch .leaflet-bar, .leaflet-bar { border: 1px solid var(--gold-2); border-radius: 2px; box-shadow: var(--shadow); }
.leaflet-bar a, .leaflet-bar a:hover {
  width: 34px; height: 34px; line-height: 32px; color: var(--cream); border-bottom-color: var(--gold-dim);
  background: linear-gradient(180deg, rgba(40, 26, 58, 0.97), rgba(22, 14, 32, 0.97));
}
.leaflet-bar a:hover { color: var(--gold); filter: brightness(1.2); }

/* ---------- title bar (as in WSDS) ---------- */
.titlebar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: calc(46px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0 14px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(40, 26, 58, 0.96), rgba(22, 14, 32, 0.96));
  border-bottom: 1px solid var(--gold-dim);
  box-shadow: 0 1px 0 rgba(232, 196, 120, 0.15), 0 4px 18px rgba(0, 0, 0, 0.45);
}
.titlebar .logo { width: 28px; height: 28px; }
.titlebar .name { font-family: var(--title-font); color: var(--gold); font-size: 22px; letter-spacing: 0.5px; }
.titlebar .sub { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.status {
  display: inline-flex; align-items: center; gap: 9px; min-width: 0; max-width: 52vw;
  padding: 4px 6px; border: 0; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status:hover { color: var(--cream); }

/* status gem (rotated square), as in WSDS */
.gem { flex: none; display: inline-block; width: 10px; height: 10px; transform: rotate(45deg); background: var(--muted); }
.gem.on, [data-state="live"] .gem { background: var(--green); box-shadow: 0 0 8px var(--green); }
.gem.wait, [data-state="connecting"] .gem { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
[data-state="error"] .gem { background: var(--red); box-shadow: 0 0 8px var(--red); }
.gem.off { background: #5a4f63; }

/* ---------- framed panel: gold border + corner diamonds ---------- */
.frame {
  position: relative; background: var(--panel); border: 1px solid var(--gold-2); border-radius: 2px;
  box-shadow: inset 0 0 0 3px rgba(13, 9, 19, 0.6), inset 0 0 0 4px rgba(201, 161, 90, 0.35), var(--shadow);
}
.frame::before, .frame::after, .frame > .c3, .frame > .c4 {
  content: ""; position: absolute; z-index: 1; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(232, 196, 120, 0.6); pointer-events: none;
}
.frame::before { top: -5px; left: -5px; }
.frame::after { top: -5px; right: -5px; }
.frame > .c3 { bottom: -5px; left: -5px; }
.frame > .c4 { bottom: -5px; right: -5px; }

.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--gold-2); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
.divider span { width: 7px; height: 7px; background: var(--gold-2); transform: rotate(45deg); }

/* ---------- buttons: purple pill with gold edge and side diamonds ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 110px; height: 36px; padding: 0 24px; cursor: pointer;
  font-family: var(--title-font); font-size: 16px; color: var(--cream);
  background: linear-gradient(180deg, var(--purple-hi), var(--purple) 45%, var(--purple-2));
  border: 1px solid var(--gold); border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(20, 10, 30, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: filter 0.12s, transform 0.05s;
}
.btn::before, .btn::after { content: ""; position: absolute; top: 50%; width: 7px; height: 7px; background: var(--gold); transform: translateY(-50%) rotate(45deg); }
.btn::before { left: -4px; }
.btn::after { right: -4px; }
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { filter: grayscale(0.8) brightness(0.6); cursor: default; }
.btn.dark { background: linear-gradient(180deg, #2b2034, #1a1322); }
.btn.small { height: 28px; min-width: 0; padding: 0 14px; font-size: 14px; border-radius: 14px; }
.btn.small::before, .btn.small::after { width: 5px; height: 5px; }
.btn.on { background: linear-gradient(180deg, #8a6a2e, #5e4519); color: #fff6e0; }
.btn svg { width: 15px; height: 15px; fill: currentColor; }

/* square icon button (settings, collapse, close) */
.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; cursor: pointer;
  color: var(--cream); background: linear-gradient(180deg, #2b2034, #1a1322);
  border: 1px solid var(--gold-dim); border-radius: 2px;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn.bare { width: 26px; height: 26px; background: transparent; border-color: transparent; color: var(--muted); }
.icon-btn.bare:hover { color: var(--gold); border-color: transparent; }

/* ---------- side panel: players and flight pillars ---------- */
.side, .panel { position: fixed; z-index: 900; display: flex; flex-direction: column; }
.side { top: 62px; left: 16px; width: 260px; max-height: calc(100% - 110px); }
.panel { top: 62px; right: 16px; width: 330px; max-height: calc(100% - 110px); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 8px 16px; }
.box-body { overflow: auto; padding: 0 16px 16px; }
.collapsed .box-body { display: none; }
.collapsed .collapse-btn svg { transform: rotate(180deg); }

.plist { list-style: none; margin: 0; padding: 0; }
.plist li {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; cursor: pointer; border-radius: 2px;
  border-bottom: 1px solid rgba(201, 161, 90, 0.12);
}
.plist li:hover { background: rgba(107, 63, 153, 0.25); }
.plist li.sel { background: rgba(201, 161, 90, 0.22); }
.plist .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--title-font); font-size: 16px; color: var(--cream); }
.plist .pstate { color: var(--muted); font-size: 11px; white-space: nowrap; }
.hint { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.stat { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; }
.stat .ico { grid-row: span 2; width: 24px; height: 24px; background: center / contain no-repeat; }
.stat .v { font-family: var(--title-font); color: var(--cream); font-size: 20px; line-height: 1.1; }
.stat .k { grid-column: 2; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.ico.chest { background-image: url(/icons/chest.svg); }
.ico.satchel { background-image: url(/icons/satchel.svg); }
.ico.orb { background-image: url(/icons/orb.svg); }
.ico.pillar { background-image: url(/icons/pillar.svg); }

/* ---------- player progress panel ---------- */
.panel h2 { overflow-wrap: anywhere; }
.panel .actions { display: flex; align-items: center; gap: 6px; }
.panel .follow-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.quests { display: grid; gap: 8px; margin-top: 10px; }
.quest { padding: 9px 11px; background: rgba(10, 7, 14, 0.55); border: 1px solid rgba(201, 161, 90, 0.25); border-radius: 2px; }
.quest-cat { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.quest-name { font-family: var(--title-font); color: var(--cream); font-size: 16px; margin: 1px 0 4px; }
.quest.complete .quest-name::after { content: " \2713"; color: var(--gold); }
.objective { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 2px 0; }
.objective.complete { color: var(--done); text-decoration: line-through; }
.objective .amt { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- settings dialog ---------- */
.dialog {
  width: min(480px, calc(100% - 32px)); max-height: calc(100% - 40px); padding: 0; overflow: visible; color: var(--text);
}
.dialog.frame { background: var(--panel-solid); }
.dialog::backdrop { background: rgba(5, 3, 8, 0.72); }
.dialog form { padding: 18px 22px 20px; max-height: calc(100vh - 40px); overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dialog h3 { margin: 16px 0 10px; }
label.field { display: block; margin: 0 0 14px; }
label.field > .lbl { display: block; color: var(--gold); font-family: var(--title-font); font-size: 15px; margin-bottom: 5px; }
label.field > .help, .toggle .help { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; font-family: var(--body-font); }
input[type=text], input[type=password] {
  width: 100%; height: 36px; padding: 0 12px; color: var(--cream); font-size: 15px;
  background: rgba(10, 7, 14, 0.75); border: 1px solid var(--gold-dim); border-radius: 2px; outline: none;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}
input:focus { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(232, 196, 120, 0.35), inset 0 1px 4px rgba(0, 0, 0, 0.6); }
.row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }

/* toggle switch, as in WSDS */
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; margin: 0 0 12px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .knob { width: 40px; height: 20px; margin-top: 1px; border-radius: 10px; background: #2a2033; border: 1px solid var(--gold-dim); position: relative; transition: 0.15s; flex: none; }
.toggle .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: 0.15s; }
.toggle input:checked + .knob { background: var(--purple); border-color: var(--gold); }
.toggle input:checked + .knob::after { left: 22px; background: var(--gold); }
.toggle input:focus-visible + .knob { outline: 2px solid var(--gold); outline-offset: 2px; }
.toggle .lbl { font-family: var(--title-font); color: var(--cream); font-size: 15px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.disclaimer {
  position: fixed; left: 0; bottom: 0; z-index: 800; max-width: 100%;
  padding: 3px 10px calc(3px + env(safe-area-inset-bottom)); font-size: 11px; color: var(--muted);
  background: rgba(13, 9, 19, 0.75); border-top: 1px solid rgba(201, 161, 90, 0.25); border-right: 1px solid rgba(201, 161, 90, 0.25);
}

/* ---------- map markers ---------- */
.mk { width: 22px !important; height: 22px !important; margin: -11px 0 0 -11px !important; background: center / contain no-repeat; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75)); }
.mk.chest { background-image: url(/icons/chest.svg); }
.mk.satchel { background-image: url(/icons/satchel.svg); width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; }
.mk.landmark { background-image: url(/icons/landmark.svg?v=2); width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; }
.mk.landmark.undiscovered { opacity: 0.45; }
.mk.pillar { background-image: url(/icons/pillar.svg); width: 26px !important; height: 26px !important; margin: -22px 0 0 -13px !important; }
.mk.pillar.active { filter: drop-shadow(0 0 6px rgba(127, 216, 240, 0.95)); }
.mk.orb { background-image: url(/icons/orb.svg); width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; filter: drop-shadow(0 0 5px rgba(127, 216, 240, 0.8)); }
.mk.orb.dormant { opacity: 0.45; }
.mk.enemy { background-image: url(/icons/enemy.svg); width: 15px !important; height: 15px !important; margin: -7px 0 0 -7px !important; }
.mk.familiar { background-image: url(/icons/familiar.svg); width: 14px !important; height: 14px !important; margin: -7px 0 0 -7px !important; }
.mk.dungeon { background-image: url(/icons/dungeon.svg); width: 24px !important; height: 24px !important; margin: -12px 0 0 -12px !important; }
.mk.underground { border-radius: 50%; box-shadow: 0 0 0 2px rgba(180, 140, 255, 0.85), 0 0 8px rgba(180, 140, 255, 0.6); background-color: rgba(27, 13, 51, 0.6); }
.mk.done { opacity: 0.4; filter: grayscale(1); }
.mk.done::after { content: ""; position: absolute; right: -4px; bottom: -4px; width: 12px; height: 12px; background: url(/icons/check.svg?v=2) center / contain no-repeat; }
.mk.cooldown::after { background-image: url(/icons/clock.svg); }
.hide-done .mk.done { display: none; }
/* zoomed out: smaller markers so islands stay readable */
.zoom-far .mk.chest { width: 12px !important; height: 12px !important; margin: -6px 0 0 -6px !important; }
.zoom-far .mk.satchel, .zoom-far .mk.landmark, .zoom-far .mk.orb { width: 11px !important; height: 11px !important; margin: -5px 0 0 -5px !important; }
.zoom-far .mk.pillar { width: 18px !important; height: 18px !important; margin: -15px 0 0 -9px !important; }
.zoom-far .mk.enemy, .zoom-far .mk.familiar { width: 9px !important; height: 9px !important; margin: -4px 0 0 -4px !important; }
.zoom-far .mk.dungeon { width: 16px !important; height: 16px !important; margin: -8px 0 0 -8px !important; }
.zoom-far .mk.done::after { width: 7px; height: 7px; right: -2px; bottom: -2px; }

.player-mk { width: 0 !important; height: 0 !important; }
.player-mk .arrow {
  position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; cursor: pointer;
  background: url(/icons/player.svg?v=2) center / contain no-repeat;
  filter: drop-shadow(0 0 5px rgba(232, 196, 120, 0.8));
}
.player-mk .selected .arrow { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(232, 196, 120, 1)); }
.player-mk .label {
  position: absolute; left: 0; top: 14px; transform: translateX(-50%); cursor: pointer;
  padding: 1px 9px; white-space: nowrap; font-family: var(--title-font); font-size: 13px; color: var(--cream);
  background: linear-gradient(180deg, rgba(75, 42, 110, 0.95), rgba(50, 26, 76, 0.95)); border: 1px solid var(--gold-2); border-radius: 10px;
}
.player-mk .selected .label { border-color: var(--gold); color: #fff6e0; box-shadow: 0 0 8px rgba(232, 196, 120, 0.6); }
.leaflet-tooltip { background: var(--panel-solid); color: var(--text); border: 1px solid var(--gold-2); border-radius: 2px; box-shadow: var(--shadow); font-size: 13px; }
.leaflet-tooltip-top::before { border-top-color: var(--gold-2); }

/* loot popups (chests, satchels, creatures, dungeons) */
.loot-popup .leaflet-popup-content-wrapper { background: var(--panel-solid); color: var(--text); border: 1px solid var(--gold-2); border-radius: 2px; box-shadow: var(--shadow); }
.loot-popup .leaflet-popup-tip { background: var(--panel-solid); border: 1px solid var(--gold-2); }
.loot-popup .leaflet-popup-content { margin: 12px 14px; width: min(320px, calc(100vw - 80px)) !important; max-height: min(60vh, 520px); overflow: auto; font-size: 13px; line-height: 1.35; }
.loot-popup a.leaflet-popup-close-button { color: var(--muted); }
.loot-popup h4 { margin: 8px 0 1px; font: normal 17px var(--title-font); color: var(--cream); }
.loot-popup h4:first-child { margin-top: 0; }
.loot-popup h5 { margin: 12px 0 4px; font: normal 14px var(--title-font); color: var(--gold); }
.loot-sub { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.loot-desc { margin: 6px 0; color: var(--text); font-size: 12px; }
.loot-note { margin: 4px 0 2px; color: var(--muted); font-size: 11px; }
ul.loot { list-style: none; margin: 2px 0 4px; padding: 0; }
ul.loot li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
ul.loot img, ul.loot .noimg { flex: none; width: 28px; height: 28px; }
ul.loot .noimg { border: 1px dashed var(--gold-dim); border-radius: 2px; opacity: 0.5; }
ul.loot .nm { flex: 1; min-width: 0; color: var(--cream); }
ul.loot .amt { color: var(--muted); }
ul.loot .lim { color: var(--amber); }
ul.loot .ch { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
ul.loot .ch b { color: var(--amber); font-weight: normal; }
ul.loot .ch.sure b { color: var(--green); }
ul.loot .arrow { color: var(--gold-dim); }
ul.inside { margin: 0; padding-left: 16px; }
ul.inside li { margin: 1px 0; }
.luck-field input { width: 110px; }

/* inside the WSDS app (Map tab): WSDS has its own title bar */
.embed .titlebar .logo, .embed .titlebar .name, .embed .titlebar .sub, .embed .titlebar .nav-link { display: none; }

/* ---------- title bar links (server list <-> map) ---------- */
.titlebar .brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 32px; padding: 0 10px;
  color: var(--muted); font-size: 13px; text-decoration: none; border: 1px solid transparent; border-radius: 2px;
}
.nav-link:hover { color: var(--gold); border-color: var(--gold-dim); }
.nav-link svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- public server list page ---------- */
body.page { height: auto; min-height: 100%; overflow: auto; background: linear-gradient(180deg, var(--bg-1), var(--bg-0) 420px); }
.servers-page { max-width: 880px; margin: 0 auto; padding: calc(46px + env(safe-area-inset-top) + 26px) 16px 28px; }
.servers-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.servers-head h2 { font-size: 26px; }
.servers-head p { margin: 6px 0 0; max-width: 60ch; }
.servers-meta { display: flex; align-items: center; gap: 10px; flex: none; }
.servers-meta .icon-btn:disabled { opacity: 0.5; cursor: default; }
.server-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.server { padding: 14px 18px 16px; }
.server-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.server-name { min-width: 0; color: var(--cream); font-size: 20px; overflow-wrap: anywhere; }
.server-players {
  display: inline-flex; align-items: center; gap: 9px; flex: none; white-space: nowrap;
  font-family: var(--title-font); color: var(--cream); font-size: 17px; font-variant-numeric: tabular-nums;
}
.server-players.offline { color: var(--muted); }
.server-desc { margin: 6px 0 0; overflow-wrap: anywhere; }
.server-tags { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; }
.tag:empty { display: none; }
.tag svg { width: 13px; height: 13px; fill: currentColor; }
.tag.lock { color: var(--amber); }
.server-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(201, 161, 90, 0.18);
}
.join { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.join .lbl { color: var(--gold); font-family: var(--title-font); font-size: 15px; }
.addr {
  padding: 5px 9px; color: var(--cream); font: 14px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere;
  background: rgba(10, 7, 14, 0.75); border: 1px solid var(--gold-dim); border-radius: 2px; user-select: all;
}
a.btn { text-decoration: none; }
.server-actions .live { margin-left: auto; }
.empty { padding: 26px 22px; text-align: center; color: var(--muted); }
.empty p { margin: 0; }
.page .disclaimer { position: static; max-width: none; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); text-align: center; background: none; border: 0; }

/* gatherables picker */
.gather-tools { margin: 4px 0 10px; }
.gather-tools input { flex: 1; }
.gather-kinds { max-height: 300px; overflow: auto; padding-right: 4px; }
.gather-head { color: var(--gold); font-family: var(--title-font); font-size: 14px; margin: 10px 0 4px; }
.gather-kind { display: flex; align-items: center; gap: 9px; padding: 3px 4px; cursor: pointer; border-radius: 2px; }
.gather-kind:hover { background: rgba(232, 196, 120, 0.08); }
.gather-kind input { accent-color: var(--gold); margin: 0; }
.gather-dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #120b18; flex: none; }
.gather-name { flex: 1; color: var(--cream); font-size: 14px; }
.gather-count { font-size: 12px; }
.gather-dot.off { opacity: 0.35; }
.gather-legend { padding: 8px 12px; background: var(--panel); border: 1px solid var(--gold-2); border-radius: 2px; color: var(--cream); font-size: 13px; max-width: 260px; margin-bottom: 34px !important; }
.gather-legend[hidden] { display: none; }
.gather-legend-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; }

@media (max-width: 700px) {
  .titlebar .sub { display: none; }
  .status { max-width: calc(100vw - 190px); }
  .titlebar .nav-link { padding: 0 7px; }
  .titlebar .nav-link span { display: none; }
  .page .titlebar .nav-link span { display: inline; }
  .servers-head { flex-direction: column; align-items: flex-start; }
  .server { padding: 12px 14px 14px; }
  .side { top: 56px; left: 8px; right: 8px; width: auto; max-height: 40%; }
  .panel { top: auto; bottom: 30px; left: 8px; right: 8px; width: auto; max-height: 45%; }
  .leaflet-control-zoom { display: none; }
  .disclaimer { font-size: 10px; right: 0; text-align: center; border-right: 0; }
  .toggles { grid-template-columns: 1fr; }
}

/* ---------- wiki ---------- */
.nav-link.active { color: var(--gold); }
.wiki { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; max-width: 1180px; margin: 0 auto; padding: calc(46px + env(safe-area-inset-top) + 22px) 16px 28px; align-items: start; }
.wiki-nav { position: sticky; top: calc(46px + env(safe-area-inset-top) + 16px); padding: 14px 14px 12px; }
.wiki-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; background: rgba(10, 7, 14, 0.75); border: 1px solid var(--gold-dim); border-radius: 2px; }
.wiki-search:focus-within { border-color: var(--gold); }
.wiki-search svg { width: 17px; height: 17px; fill: var(--muted); flex: none; }
.wiki-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; }
.wiki-sections { list-style: none; margin: 12px 0; padding: 0; }
.wiki-sections a { display: block; padding: 5px 8px; color: var(--text); text-decoration: none; border-left: 2px solid transparent; }
.wiki-sections a:hover { color: var(--gold); background: rgba(232, 196, 120, 0.06); }
.wiki-sections li.sel a { color: var(--gold); border-left-color: var(--gold); background: rgba(232, 196, 120, 0.08); }
.wiki-luck { margin: 6px 0 10px; }
.wiki-luck input { width: 100%; }
.wiki-main { min-width: 0; outline: none; }
.wiki-main h2 { font-size: 26px; margin: 2px 0 8px; }
.wiki-main h3 { font-size: 18px; margin: 0 0 8px; }
.wiki-main h3.gap { margin-top: 22px; }
.wiki-main h4 { margin: 16px 0 6px; font: normal 15px var(--title-font); color: var(--cream); }
.wiki-main a { color: var(--gold); }
.wiki-main a:hover { color: var(--cream); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold); }
.crumbs .sep { opacity: 0.6; }
.whead { display: flex; align-items: center; gap: 16px; margin: 4px 0 10px; }
.whead h2 { margin: 0; }
.whead p { margin: 2px 0 0; }
.wdesc { max-width: 75ch; color: var(--cream); margin: 8px 0 12px; }
.wactions { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 10px 0 6px; }
.btn.track svg { width: 15px; height: 15px; }
.wsec { margin: 22px 0 0; padding: 16px 18px; background: var(--panel); border: 1px solid rgba(201, 161, 90, 0.35); border-radius: 2px; }
.wicon { border-radius: 3px; background: rgba(10, 7, 14, 0.6); flex: none; object-fit: contain; }
.wicon.none { display: inline-block; }
.wicon.s22 { width: 22px; height: 22px; }
.wicon.s32 { width: 32px; height: 32px; }
.wicon.s40 { width: 40px; height: 40px; }
.wicon.s64 { width: 64px; height: 64px; }
.whead .wicon { border: 1px solid var(--gold-dim); padding: 3px; }
.ilink { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; vertical-align: middle; margin: 1px 6px 1px 0; }
.ilink span { text-decoration: underline; text-decoration-color: rgba(232, 196, 120, 0.35); text-underline-offset: 2px; }
.ilink .muted { text-decoration: none; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 6px 16px; padding: 6px 2px; border-bottom: 1px solid rgba(201, 161, 90, 0.12); }
.rows li:last-child { border-bottom: 0; }
.rows li.wrap { flex-wrap: wrap; }
.rows li > span:last-child { text-align: right; }
.rows.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 22px; }
.stat-good { color: var(--green); }
.luck { color: var(--gold); }
.grid { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.grid.big { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 18px; }
.grid a { display: flex; align-items: center; gap: 10px; height: 100%; padding: 8px 10px; color: var(--text); text-decoration: none; background: var(--panel); border: 1px solid rgba(201, 161, 90, 0.25); border-radius: 2px; }
.grid a:hover { border-color: var(--gold); color: var(--cream); }
.grid a b { display: block; font-weight: 700; color: var(--cream); }
.grid.big a { padding: 14px 16px; }
.grid.big a b { font: normal 17px var(--title-font); color: var(--gold); margin-bottom: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip { padding: 3px 10px; font-size: 13px; color: var(--text); text-decoration: none; border: 1px solid var(--gold-dim); border-radius: 12px; background: rgba(10, 7, 14, 0.5); }
.wiki-main .chip { color: var(--text); }
.chip:hover { border-color: var(--gold); color: var(--gold); }
.dot { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold-2); border: 1px solid #120b18; }
.dot.enemy { background: var(--red); }
.dot.familiar { background: var(--orb); }
.dot.dungeon { background: #b58cf0; transform: rotate(45deg); border-radius: 2px; }
.dot.big { width: 34px; height: 34px; }
.minimap { height: 340px; margin-top: 12px; border: 1px solid var(--gold-dim); border-radius: 2px; }
.minimap .leaflet-control-zoom { display: block; }
.tablewrap { overflow-x: auto; }
.wtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.wtable th { text-align: left; font: normal 13px var(--title-font); color: var(--gold); padding: 6px 8px; border-bottom: 1px solid var(--gold-dim); }
.wtable td { padding: 7px 8px; border-bottom: 1px solid rgba(201, 161, 90, 0.12); vertical-align: top; }
.wtable td.ins { min-width: 180px; }
.lore { padding: 14px 18px; margin: 14px 0; }
.lore p { margin: 0; max-width: 75ch; }
.wiki-body .disclaimer { padding-top: 8px; }
@media (max-width: 860px) {
  .wiki { grid-template-columns: 1fr; padding-top: calc(46px + env(safe-area-inset-top) + 14px); }
  .wiki-nav { position: static; max-height: none; }
  .wiki-sections { display: flex; flex-wrap: wrap; gap: 4px; }
  .wiki-sections a { border-left: 0; border: 1px solid rgba(201, 161, 90, 0.25); border-radius: 12px; padding: 3px 10px; font-size: 13px; }
  .wsec { padding: 12px; }
  .rows.cols { grid-template-columns: 1fr; }
  .minimap { height: 260px; }
}
.mk.focus { width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; background: var(--gold); border: 2px solid #120b18; transform: rotate(45deg); box-shadow: 0 0 0 3px rgba(232, 196, 120, 0.35); }
