/* Fonts served with the site (SIL Open Font License; notices in LICENSES.txt), Latin subset, variable weights */
@font-face { font-family: "Cinzel"; font-weight: 400 900; font-display: swap; src: url(../vendor/fonts/cinzel-latin.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url(../vendor/fonts/inter-latin.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap; src: url(../vendor/fonts/jetbrains-mono-latin.woff2) format("woff2"); }

/* Layout: map-app shell. Sidebar on the left (tabs: Overlays / Maps), full-bleed Leaflet map on the right with
   breadcrumb, zoom controls and coordinate readout floating over it. Single dark look on purpose: it is a game map. */
:root {
  color-scheme: dark;
  --side: #121a26; --side-2: #18222f; --side-line: #263346; --ink: #e8e3d6; --muted: #8e9aab;
  --gold: #d9b45a; --gold-ink: #1a1408; --arcane: #9b7cff; --stage: #040706; --sea: #061b26; --chip: rgba(10,14,20,.86);
  --horde: #c8473d; --alliance: #3f7fd6; --neutral: #d9b45a; --mine: #2fae6e;
  --herb: #6fd36a; --ore: #e39a4b; --chest: #f1d36a; --pool: #4fc8f0; --catch: #7aa6ff; --sky: #b38cff;
  /* Typography tokens: the only place font families, sizes, weights and letter spacing are set.
     Every rule below uses these; never write a literal font family, px font size or numeric weight.
     Rules and reasons: docs/decisions/17-typography.md. */
  --display: "Cinzel", "Trajan Pro", Georgia, serif;   /* gold titles and map place names */
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;   /* everything else */
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;   /* coordinates, counts, IDs, code */
  --fs-xs: 10px; --fs-sm: 11px; --fs-md: 12px; --fs-base: 13px; --fs-lg: 14px; --fs-xl: 16px; --fs-2xl: 20px; --fs-3xl: 22px;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700; --fw-heavy: 800;
  --ls-none: 0; --ls-tight: .04em; --ls-wide: .06em; --ls-caps: .12em;
  /* Gold titles: one family, weight and colour everywhere (site header, sidebar section headers,
     finder groups, dungeon titles, popup titles). Only the size differs, by level. */
  --title-font: var(--display); --title-weight: var(--fw-bold); --title-color: var(--gold);
  --title-lg: var(--fs-3xl);   /* site header */
  --title-md: var(--fs-xl);    /* dungeon title, popup title */
  --title-sm: var(--fs-sm);    /* section headers: TRAVEL, SERVICES, finder groups, dungeon side panel; uppercase, caps spacing */
}
/* Gold titles share one rule so they can't drift apart. Add new gold titles to this selector. */
.brand h1, .inst .ititle h2, .pop h3, .sec h2, .finder h4, .inst .iside h3 { font-family: var(--title-font); font-weight: var(--title-weight); color: var(--title-color); line-height: 1.15; }
.sec h2, .finder h4, .inst .iside h3 { font-size: var(--title-sm); letter-spacing: var(--ls-caps); text-transform: uppercase; }
html, body { height: 100%; }
body { background: var(--stage); color: var(--ink); font: var(--fs-lg)/1.45 var(--body); overflow: hidden; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* --consent-h: the cookie bar's height while it shows (analytics.js), so the bar sits below the app, not over it */
.app { height: calc(100% - var(--consent-h, 0px)); display: grid; grid-template-columns: 300px 1fr; }

/* Sidebar */
.side { background: var(--side); border-right: 1px solid var(--side-line); display: flex; flex-direction: column; min-height: 0; padding-left: env(safe-area-inset-left, 0px); }
.brand { padding: 18px 18px 12px; text-align: center; border-bottom: 1px solid var(--side-line); }
.brand h1 { margin: 0; font-size: var(--title-lg); line-height: 1.1; letter-spacing: var(--ls-wide); text-wrap: balance; }
.brand p { margin: 6px 0 0; font-size: var(--fs-sm); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--side-line); }
.tabs button { background: none; border: 0; padding: 11px 0; cursor: pointer; color: var(--muted); font-weight: var(--fw-semibold); border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
/* minmax(0, 1fr): a wide child (pin-type grid, link box) shrinks to the sidebar instead of widening the column past it. */
.pane { overflow: auto; flex: 1; min-height: 0; padding: 12px 14px 18px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 16px; }
.search { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--side-line); border-radius: 6px; background: var(--side-2); color: var(--ink); font: inherit; }
.row-btns { display: flex; justify-content: center; gap: 18px; font-size: var(--fs-md); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--ls-wide); }
.row-btns button { background: none; border: 0; cursor: pointer; color: var(--ink); padding: 2px 0; }
.row-btns button:hover { color: var(--gold); }
.sec h2 .scope { font: var(--fw-medium) var(--fs-sm) var(--body); letter-spacing: var(--ls-none); text-transform: none; color: var(--muted); margin-left: auto; }
.sec h2 { margin: 0 0 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.cat { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 0; background: none; border-radius: 5px; cursor: pointer; text-align: left; min-width: 0; width: 100%; }
.cat:hover { background: var(--side-2); }
.cat .ico { flex: none; width: 20px; height: 20px; display: grid; place-items: center; }
.cat .ico img { width: 20px; height: 20px; object-fit: contain; }
.cat .ico i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #0008; }
.cat .ico img.gi { width: 18px; height: 18px; border-radius: 3px; border: 1px solid #000; }
.cat .ico i.gi { width: 18px; height: 18px; border-radius: 3px; border: 1px solid #000; background-repeat: no-repeat; }
.cat .ico svg { width: 14px; height: 18px; }
.cat .name { flex: 1; min-width: 0; font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .name small { color: var(--muted); font: var(--fw-medium) var(--fs-sm) var(--mono); margin-left: 4px; }
.cat .n { font: var(--fw-medium) var(--fs-sm) var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.cat[aria-pressed="false"] { opacity: .4; }
.cat[aria-pressed="false"] .name { text-decoration: line-through; }
.krow { display: flex; align-items: center; gap: 2px; }
.orow { position: relative; min-width: 0; }   /* lets a long name shrink to an ellipsis instead of pushing the count off the panel */
.only { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); display: none; border: 1px solid var(--gold); background: var(--side); color: var(--gold); border-radius: 4px; font: var(--fw-semibold) var(--fs-xs) var(--body); letter-spacing: var(--ls-wide); text-transform: uppercase; padding: 1px 6px; cursor: pointer; }
.orow:hover .only, .orow:focus-within .only { display: block; }
@media (hover: none) { .only { display: block; position: static; transform: none; margin-left: 4px; } .orow { display: flex; align-items: center; } }
.sec h2 .reset { margin-left: auto; background: none; border: 0; color: var(--muted); font: var(--fw-semibold) var(--fs-xs) var(--body); letter-spacing: var(--ls-wide); text-transform: uppercase; cursor: pointer; padding: 0; }
.sec h2 .reset:hover { color: var(--gold); }
.krow .cat { flex: 1; }
.exp { flex: none; width: 26px; height: 26px; border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--muted); }
.exp:hover { background: var(--side-2); color: var(--ink); }
.exp[aria-expanded="true"] { transform: rotate(90deg); }
.sub { padding-left: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.sub .cat { padding: 2px 6px; }
.sub .cat .name { font-size: var(--fs-md); }
.seg { display: inline-flex; border: 1px solid var(--side-line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 3px 8px; cursor: pointer; font: var(--fw-semibold) var(--fs-sm) var(--body); letter-spacing: var(--ls-tight); text-transform: none; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--side-line); }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.wide { grid-column: 1 / -1; }
.hint { margin: 0; color: var(--muted); font-size: var(--fs-md); }
.hint a { color: var(--ink); }
.btn { border: 1px solid var(--side-line); background: var(--side-2); border-radius: 6px; padding: 7px 10px; cursor: pointer; font-weight: var(--fw-medium); font-size: var(--fs-base); }
.btn:hover { border-color: var(--gold); }
a.btn { color: var(--ink); text-decoration: none; display: inline-block; }
.btn.on { background: var(--mine); border-color: var(--mine); color: #fff; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* Map stage */
.stage { position: relative; overflow: hidden; background: var(--stage); min-width: 0; }
#map { position: absolute; inset: 0; background: var(--stage); font: inherit; }
#map.hot { cursor: pointer; }
#map.adding, #map.adding.hot { cursor: crosshair; }
.leaflet-container { background: var(--stage); }
.leaflet-tile-pane { transition: opacity .3s ease; }
/* Sea: one viewport-sized layer over the terrain tiles, blended with "lighten" so the minimap's near-black deep
   water takes the sea colour and faint waves while land (always lighter) is left as it is. No image requests. */
/* The neighbouring continent's tiles overlap this one's sea: "lighten" lets the land of either show through. */
.leaflet-layer.beside { mix-blend-mode: lighten; }
.leaflet-water-pane { mix-blend-mode: lighten; pointer-events: none; }
.water { position: absolute; left: 0; top: 0; pointer-events: none; background-color: var(--sea); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='108'%3E%3Cg fill='none' stroke='%2385bedd' stroke-opacity='.09' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M10 26c7-4.5 14-4.5 21 0s14 4.5 21 0'/%3E%3Cpath d='M100 80c7-4.5 14-4.5 21 0s14 4.5 21 0'/%3E%3Cpath d='M128 34c5-3 10-3 15 0'/%3E%3Cpath d='M30 92c5-3 10-3 15 0'/%3E%3C/g%3E%3C/svg%3E"), radial-gradient(ellipse 70% 60% at 50% 45%, rgba(26, 70, 92, .5), rgba(26, 70, 92, 0) 75%); background-repeat: repeat, no-repeat; }
.leaflet-image-layer { transition: opacity .35s ease; }
.inst:not([hidden]) { animation: instIn .25s ease; }
@keyframes instIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .leaflet-tile-pane, .leaflet-image-layer { transition: none; } .inst:not([hidden]) { animation: none; } }
.leaflet-tile { image-rendering: auto; }
.zlabel span { position: absolute; transform: translate(-50%, -50%); font: var(--fw-semibold) var(--fs-base) var(--display); letter-spacing: var(--ls-wide); color: #fff; text-shadow: 0 0 3px #000, 0 0 6px #000, 0 1px 2px #000; white-space: nowrap; pointer-events: none; }
.zlabel.continent span { font-size: var(--fs-2xl); color: #fff4d0; }
.poi { display: grid; place-items: center; }
/* Leaflet's ".leaflet-container .leaflet-marker-pane img { width: auto }" outranks a plain ".poi img", which drew each
   icon at its file size from the marker's corner: off its true spot, and mostly outside the clickable box. */
.leaflet-container .poi img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.8)); pointer-events: none; }
.poi:hover img { filter: drop-shadow(0 0 4px var(--gold)) drop-shadow(0 1px 2px #000); }
.place span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 1px; font: var(--fw-bold) var(--fs-sm) var(--display); letter-spacing: var(--ls-tight); color: #fff4d0; text-shadow: 0 0 3px #000, 0 0 6px #000; white-space: nowrap; pointer-events: none; }
.place.town span { font: var(--fw-semibold) var(--fs-xs) var(--body); letter-spacing: var(--ls-none); color: #f3ead2; }
.place.transport span { font: var(--fw-bold) var(--fs-xs) var(--body); letter-spacing: var(--ls-wide); text-transform: uppercase; color: #dbe9ff; }
#map.zl-0 .place.transport span { display: none; }
.place.transport.side-w span { left: auto; right: 100%; top: 50%; transform: translateY(-50%); margin: 0 4px 0 0; }
.place.transport.side-e span { left: 100%; top: 50%; transform: translateY(-50%); margin: 0 0 0 4px; }
.tlegend { display: flex; flex-wrap: wrap; gap: 3px 12px; padding: 2px 6px 6px 36px; font-size: var(--fs-xs); color: var(--muted); }
.tlegend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tlegend svg { width: 26px; height: 8px; }
.tlegend i { width: 9px; height: 9px; border-radius: 50%; }
.lbl-off { visibility: hidden !important; }   /* covered by a more important label (app/declutter.js) */
.edge-label span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: var(--fw-bold) var(--fs-xs) var(--body); letter-spacing: var(--ls-wide); text-transform: uppercase; color: #dbe9ff; background: rgba(10,14,20,.8); border: 1px solid #cfe3ff66; border-radius: 4px; padding: 2px 6px; line-height: 1.5; text-align: center; }
.place.village span { font: var(--fw-medium) var(--fs-xs) var(--body); color: #d8d2c2; }
.place.village i { display: block; width: 6px; height: 6px; border-radius: 50%; background: #e9dfc4; border: 1px solid #000; }
#map.zl-0 .place.town, #map.zl-0 .place.village, #map.zl-1 .place.village, #map.zl-2 .place.village { display: none; }
#map.zl-0 .place.city span { display: none; }
.place.cave span { font: var(--fw-medium) var(--fs-xs) var(--body); color: #cfc6b4; }
#map.zl-0 .place.cave, #map.zl-1 .place.cave, #map.zl-2 .place.cave span { display: none; }
/* the city you are in: no icon, only its name, larger and in the display face (services use the body face) */
#map .place.city.here { pointer-events: none; }
#map .place.city.here img { display: none; }
#map .place.city.here span { display: block; top: 50%; transform: translate(-50%, -50%); margin: 0; font: var(--fw-bold) var(--fs-3xl) var(--display); letter-spacing: var(--ls-wide); text-transform: uppercase; color: #ffd98a; text-shadow: 0 0 4px #000, 0 0 8px #000, 0 2px 3px #000; }
#map.zl-0 .poi img, #map.zl-1 .poi img { transform: scale(.72); }
#map.zl-0 .pin svg, #map.zl-1 .pin svg { transform: scale(.8); transform-origin: 50% 100%; }
#map.zl-0 .zlabel.zone span { font-size: var(--fs-sm); }
.pin svg { width: 26px; height: 32px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.pin.pimg img, .pin.pimg .spr { display: block; width: 24px; height: 24px; filter: drop-shadow(0 1px 2px #000) drop-shadow(0 0 1px #000); }
#map.zl-0 .pin.pimg > *, #map.zl-1 .pin.pimg > * { transform: scale(.8); }
.spr { display: inline-block; background-repeat: no-repeat; border-radius: 3px; }
.cat .ico .spr { width: 18px; height: 18px; }
.cat .ico svg[viewBox="0 0 26 32"] { width: 15px; height: 18px; }
.pinform .irow { display: flex; }
.ichoose { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; border: 1px solid var(--side-line); border-radius: 6px; background: var(--side-2); color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.ichoose:hover, .ichoose[aria-expanded="true"] { border-color: var(--gold); }
.ichoose .iprev { flex: none; width: 26px; height: 26px; display: grid; place-items: center; }
.ichoose .iprev svg { width: 21px; height: 26px; }
.ichoose .iname { flex: 1; min-width: 0; font-size: var(--fs-base); font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ichoose .ichg { flex: none; font-size: var(--fs-sm); color: var(--muted); }
.ipick { display: grid; gap: 6px; border: 1px solid var(--side-line); border-radius: 8px; background: var(--side-2); padding: 6px; }
.ipick .iq { padding: 5px 7px; font-size: var(--fs-base); background: var(--side); }
.ipick .ibody { max-height: 210px; overflow: auto; display: grid; gap: 6px; overscroll-behavior: contain; }
.ipick h4 { margin: 0 0 3px; font: var(--fw-semibold) var(--fs-xs) var(--body); letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--muted); }
.ipick .igrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.icell { aspect-ratio: 1; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 5px; background: none; cursor: pointer; }
.icell:hover, .icell:focus-visible { background: var(--side); border-color: var(--side-line); outline: none; }
.icell[aria-pressed="true"] { border-color: var(--gold); background: var(--side); }
.icell svg { width: 18px; height: 22px; }
.igrid.colors { grid-template-columns: repeat(10, 1fr); gap: 1px; }
.igrid.colors .icell svg { width: 15px; height: 19px; }
.icell img, .icell .spr { width: 22px; height: 22px; }
.ipick .hint { margin: 2px 0; }

.leaflet-tooltip.tip { background: var(--chip); color: var(--ink); border: 1px solid var(--gold); border-radius: 6px; font: var(--fw-semibold) var(--fs-md) var(--body); padding: 3px 8px; box-shadow: none; }
.leaflet-tooltip.tip::before { display: none; }
.leaflet-popup.pop .leaflet-popup-content-wrapper { background: var(--side); color: var(--ink); border: 1px solid var(--side-line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.55); }
.leaflet-popup.pop .leaflet-popup-tip { background: var(--side); }
.leaflet-popup.pop .leaflet-popup-content { margin: 12px; width: 236px !important; display: grid; gap: 8px; font: var(--fs-lg)/1.4 var(--body); }
.leaflet-popup.pop a.leaflet-popup-close-button { color: var(--muted); }
.pop h3 { margin: 0 14px 0 0; font-size: var(--title-md); letter-spacing: var(--ls-tight); overflow-wrap: anywhere; }
.leaflet-container a.leaflet-popup-close-button { font-family: var(--body); }   /* Leaflet's own CSS asks for Tahoma */
.pop .meta { font: var(--fw-medium) var(--fs-sm) var(--mono); color: var(--muted); }
.pop form { display: grid; gap: 6px; }
.pop label { font-size: var(--fs-sm); color: var(--muted); display: grid; gap: 3px; }
.pop input { padding: 6px 8px; border: 1px solid var(--side-line); border-radius: 6px; background: var(--side-2); color: var(--ink); font: inherit; }
.pop .tag { display: inline-block; font: var(--fw-semibold) var(--fs-xs) var(--body); letter-spacing: var(--ls-wide); text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--side-2); border: 1px solid var(--side-line); }
.pop .tag.horde { color: #ffb4ad; border-color: var(--horde); }
.pop .tag.alliance { color: #b9d3ff; border-color: var(--alliance); }

.float { position: absolute; z-index: 1000; }
.poi.book.got img { opacity: .5; filter: grayscale(.8) drop-shadow(0 1px 2px rgba(0,0,0,.8)); }
.poi.book.got::after { content: "✓"; position: absolute; right: -4px; bottom: -4px; width: 12px; height: 12px; border-radius: 50%; background: #2fae6e; color: #fff; font: var(--fw-bold) var(--fs-xs)/12px var(--body); text-align: center; box-shadow: 0 0 0 1px #0009; pointer-events: none; }
.pop .brow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-base); }
.pop .brow + .brow, .pop .where.under + .brow { border-top: 1px solid var(--side-line); padding-top: 6px; }
.pop .brow .btn { flex: none; white-space: nowrap; }
.pop .where { margin: 0; font-size: var(--fs-base); line-height: 1.45; color: var(--ink); opacity: .85; }
.pop .where.under { margin-top: -4px; font-size: var(--fs-sm); color: var(--muted); opacity: 1; }
.pop .btn.got { border-color: #2fae6e; color: #8fe0b4; }
.chk { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--muted); margin-top: 8px; cursor: pointer; }
.lbl { display: block; font-size: var(--fs-sm); color: var(--muted); margin: 10px 0 3px; }
textarea.search { resize: vertical; font: var(--fs-md)/1.4 var(--mono); }
.ptypes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.ptypes button { display: flex; align-items: center; gap: 6px; min-width: 0; border: 1px solid var(--side-line); background: var(--side-2); border-radius: 6px; padding: 5px 7px; cursor: pointer; font-size: var(--fs-md); text-align: left; color: var(--ink); }
.ptypes button span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptypes button[aria-checked="true"] { border-color: var(--gold); background: #2a2516; }
.pt { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: var(--fw-heavy) var(--fs-md)/1 var(--body); border: 1.5px solid #1a1408; }
.wrow select { flex: none; background: var(--side); color: var(--ink); border: 1px solid var(--side-line); border-radius: 4px; font-size: var(--fs-sm); padding: 1px 2px; }
.wlist { display: grid; gap: 2px; margin-top: 6px; }
.wrow { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 6px; background: var(--side-2); }
.wrow b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #f2c94c; color: #1a1408; font: var(--fw-bold) var(--fs-md) var(--body); cursor: pointer; }
/* a route pin's row: a small unnumbered dot, as on the map */
.wrow b.via { background: none; }
.wrow b.via::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #f2c94c; border: 2px solid #1a1408; box-sizing: border-box; }
.wrow span { flex: 1; min-width: 0; display: grid; }
.wrow input { min-width: 0; border: 0; background: none; color: var(--ink); font: var(--fw-semibold) var(--fs-base) var(--body); padding: 0; }
.wrow input:focus { outline: 1px solid var(--gold); }
.wrow small { color: var(--muted); font: var(--fw-medium) var(--fs-sm) var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow button { flex: none; width: 22px; height: 22px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; }
.wrow button:hover:not(:disabled) { background: var(--side-line); color: var(--ink); }
.wrow button:disabled { opacity: .3; cursor: default; }
.wrow button.legm { font-size: var(--fs-md); }
.wrow button.legm.on { color: var(--gold); }
.wp.typed { background: none; border: 0; box-shadow: none; }
.wp.typed b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: var(--fw-heavy) var(--fs-lg)/1 var(--body); border: 2px solid #1a1408; box-shadow: 0 0 0 2px rgba(255,255,255,.55), 0 2px 5px #000; }
.wp.typed small { position: absolute; right: -8px; bottom: -6px; min-width: 15px; height: 15px; border-radius: 8px; background: #111; color: #fff; font: var(--fw-bold) var(--fs-xs)/15px var(--body); text-align: center; border: 1px solid #f2c94c; padding: 0 2px; }
.wp.via { background: none; border: 0; box-shadow: none; }
/* a pin spread apart from others at the same spot (spreadPins): a tether runs from the bubble's middle back to its true point */
.wp .tether { position: absolute; left: 50%; top: 50%; height: 2px; margin-top: -1px; transform-origin: 0 50%; background: #1a1408; box-shadow: 0 0 0 1px rgba(242,201,76,.8); pointer-events: none; z-index: -1; }
.wp .tether::after { content: ""; position: absolute; right: -3px; top: -2px; width: 6px; height: 6px; border-radius: 50%; background: #f2c94c; border: 1px solid #1a1408; }
.wp.via b { width: 10px; height: 10px; border-radius: 50%; background: #f2c94c; border: 2px solid #1a1408; box-shadow: 0 0 0 1.5px rgba(255,255,255,.6), 0 1px 3px #000; }
.wp { display: grid; place-items: center; border-radius: 50%; background: #f2c94c; border: 2px solid #1a1408; box-shadow: 0 0 0 2px #f2c94c88, 0 2px 4px #000; cursor: grab; }
.wp b { font: var(--fw-bold) var(--fs-md) var(--body); color: #1a1408; }
.agents summary { cursor: pointer; list-style: none; }
.agents summary::-webkit-details-marker { display: none; }
.agents summary h2::before { content: "▸ "; }
.agents[open] summary h2::before { content: "▾ "; }
.doc { font-size: var(--fs-md); display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 6px; overflow-wrap: anywhere; }
.doc p { margin: 0; }
.doc pre { margin: 0; white-space: pre-wrap; word-break: break-all; background: var(--side-2); border: 1px solid var(--side-line); border-radius: 6px; padding: 6px 8px; font: var(--fs-sm)/1.4 var(--mono); }
.doc code { font: var(--fs-sm) var(--mono); background: var(--side-2); padding: 0 3px; border-radius: 3px; }
.sidetoggle { display: none; flex: none; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 8px 0; background: var(--side-2); border: 0; border-bottom: 1px solid var(--side-line); color: var(--muted); font: var(--fw-semibold) var(--fs-sm) var(--body); cursor: pointer; }
.sidetoggle:hover, .sidetoggle:focus-visible { color: var(--gold); }
.sidetoggle svg { width: 18px; height: 18px; transition: transform .15s; }
.topsearch { position: relative; padding: 10px 14px; border-bottom: 1px solid var(--side-line); }
/* Ko-fi tip link: a small, quiet line under the agent button so it never competes with it. */
a.btn.tip { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 6px; text-decoration: none; color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); padding: 2px 6px; background: none; border-color: transparent; }
a.btn.tip:hover { color: var(--gold); border-color: transparent; }
a.btn.tip svg { width: 13px; height: 13px; flex: none; color: var(--gold); }
/* "Gold coin": the game's own currency as the tip icon; on hover the coin spins on its edge, rests, spins again. */
a.btn.tip svg * { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a.btn.tip svg circle + circle { stroke-width: 1.3; }
a.btn.tip:hover svg, a.btn.tip:focus-visible svg { animation: tip-coin 1.6s ease-in-out infinite; }
@keyframes tip-coin { 0% { transform: rotateY(0); } 45%, 100% { transform: rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { a.btn.tip:hover svg, a.btn.tip:focus-visible svg { animation: none; } }
/* "Arcane current": a dark button with gold and violet light running round its edge. The light is a conic
   gradient (its start angle animated through @property) behind a 1.5px-inset dark face; the text sits above both (isolation keeps the layers inside). */
.agentprompt { position: relative; isolation: isolate; width: 100%; margin-top: 8px; font-size: var(--fs-md); font-weight: var(--fw-semibold); padding: 6px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #0d141e; border: 0; color: #f0d998; }
@property --arcane-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.agentprompt::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: conic-gradient(from var(--arcane-a), var(--gold) 0deg, transparent 70deg, transparent 150deg, var(--arcane) 200deg, transparent 260deg, var(--gold) 360deg); animation: arcane-spin 5s linear infinite; z-index: -2; }
.agentprompt::after { content: ""; position: absolute; inset: 1.5px; border-radius: 5px; background: linear-gradient(180deg, #131c2a, #0b111a); z-index: -1; }
.agentprompt:hover { box-shadow: 0 0 14px rgba(155,124,255,.35); color: #fff1c8; }
@keyframes arcane-spin { to { --arcane-a: 1turn; } }
.qres { position: absolute; left: 14px; right: 14px; top: calc(100% - 6px); z-index: 2000; background: var(--side-2); border: 1px solid var(--side-line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.55); max-height: 60vh; overflow: auto; padding: 4px; }
.qres button { display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 5px; cursor: pointer; }
.qres button:hover, .qres button.kcur { background: var(--side-line); }
.qres img, .qres .mi { width: 18px; height: 18px; flex: none; object-fit: contain; margin-top: 1px; }
.qres .mi { display: grid; place-items: center; color: var(--muted); font-size: var(--fs-md); }
/* Name on its own line at full width (wraps, never clipped); type, zone and level below it. */
.qres .t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.qres .nm { overflow-wrap: anywhere; line-height: 1.3; }
.qres small { color: var(--muted); font: var(--fw-medium) var(--fs-sm)/1.3 var(--body); overflow-wrap: anywhere; }
.qres .empty { padding: 8px; color: var(--muted); font-size: var(--fs-md); }
.zoom .round { border-radius: 50%; margin-top: 6px; display: grid; place-items: center; color: var(--gold); border-color: var(--gold); }
.zoom .round[aria-expanded="true"] { background: var(--gold); color: var(--gold-ink); }
/* The NPC finder: a floating action button at the bottom right; its panel opens upward from it. */
.fab { right: max(28px, calc(env(safe-area-inset-right, 0px) + 24px)); bottom: calc(28px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--gold); background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.55), 0 0 0 4px rgba(217,180,90,.15); }
.fab:hover { filter: brightness(1.15); }
/* "Ripple rings": two gold rings ripple outward from the closed button, staggered, like a spell being cast. */
.fab { isolation: isolate; }
.fab::before, .fab::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0; animation: fab-ripple 3.6s ease-out infinite; z-index: -1; pointer-events: none; }
.fab::after { animation-delay: 1.2s; }
.fab[aria-expanded="true"]::before, .fab[aria-expanded="true"]::after { animation: none; }
@keyframes fab-ripple { 0% { transform: scale(1); opacity: .7; } 55%, 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .agentprompt::before, .fab::before, .fab::after { animation: none; } }
.fab[aria-expanded="true"] { background: var(--side); color: var(--gold); }
.finder { right: max(28px, calc(env(safe-area-inset-right, 0px) + 24px)); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); width: 300px; max-width: calc(100% - 32px); max-height: calc(100% - 224px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; background: var(--side); border: 1px solid var(--side-line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.55); }
.finder .frow { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--side-line); }
.finder input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--side-line); border-radius: 6px; background: var(--side-2); color: var(--ink); font: inherit; }
.finder .x { background: none; border: 0; color: var(--muted); font-size: var(--fs-2xl); cursor: pointer; padding: 0 6px; }
.finder .fstat { padding: 6px 10px; font-size: var(--fs-md); color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.finder .fstat:empty { display: none; }
.finder .fstat b { color: var(--gold); }
.finder .fstat button { background: none; border: 1px solid var(--side-line); border-radius: 5px; color: var(--ink); font-size: var(--fs-sm); padding: 2px 7px; cursor: pointer; }
.finder .flist { overflow: auto; padding: 4px 6px 8px; }
.finder h4 { margin: 8px 4px 3px; }
.finder .opt, .finder .hit { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; background: none; border: 0; padding: 3px 6px; border-radius: 5px; cursor: pointer; font-size: var(--fs-base); }
.finder .opt:hover, .finder .hit:hover { background: var(--side-2); }
.finder .opt.kcur, .finder .hit.kcur { background: var(--side-line); outline: 1px solid var(--gold); outline-offset: -1px; }
.finder .opt img, .finder .hit img { width: 16px; height: 16px; flex: none; }
.finder .opt small, .finder .hit small { margin-left: auto; color: var(--muted); font: var(--fw-medium) var(--fs-sm) var(--mono); }
.finder .hit { align-items: flex-start; }
.finder .hit img { margin-top: 2px; }
.finder .hit .t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.finder .hit .nm { overflow-wrap: anywhere; line-height: 1.3; }
/* "Show all N …": the first row of a result list, selected while the whole group is on the map. */
.finder .hit.all { border-bottom: 1px solid var(--side-line); border-radius: 5px 5px 0 0; margin-bottom: 3px; padding-bottom: 6px; }
.finder .hit.all .nm { color: var(--gold); font-weight: var(--fw-medium); }
.finder .hit[aria-pressed="true"] { background: var(--side-2); box-shadow: inset 2px 0 0 var(--gold); }
.finder .opt.all span { font-style: italic; }
.finder .hit small { margin-left: 0; font: var(--fw-medium) var(--fs-sm)/1.3 var(--body); overflow-wrap: anywhere; }
.found { display: grid; place-items: center; background: rgba(10,14,20,.85); border: 2px solid var(--gold); border-radius: 50%; box-shadow: 0 0 10px rgba(217,180,90,.8); }
.leaflet-container .found img { width: 20px; height: 20px; position: relative; filter: drop-shadow(0 1px 2px #000); }
/* While the finder shows results, everything else steps back. */
#map.finding .leaflet-gather-pane { opacity: .3; }
#map.finding .leaflet-marker-icon:not(.found) { opacity: .35; }
.found::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--gold); box-shadow: 0 0 8px var(--gold); animation: ping 1.6s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .found::before { animation: none; } }
/* One named NPC from the finder: the service layers are hidden until "Show all" (decision 09). */
.focuschip { left: 50%; transform: translateX(-50%); top: calc(64px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 150px); background: var(--chip); border: 1px solid var(--gold); border-radius: 999px; padding: 4px 4px 4px 12px; font-size: var(--fs-md); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.focuschip[hidden] { display: none; }
.focuschip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.focuschip b { color: var(--gold); font-weight: var(--fw-semibold); }
.focuschip i { font-style: normal; }
.focuschip button { flex: none; border: 1px solid var(--gold); background: var(--side); color: var(--gold); border-radius: 999px; padding: 3px 10px; cursor: pointer; font: var(--fw-semibold) var(--fs-sm) var(--body); }
.focuschip button:hover { background: var(--gold); color: var(--gold-ink); }
@media (max-width: 760px) { .focuschip { left: 12px; transform: none; max-width: calc(100% - 80px); } .focuschip i { display: none; } }
.crumbs { left: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 2px; background: var(--chip); border: 1px solid var(--side-line); border-radius: 8px; padding: 4px; max-width: calc(100% - 90px); overflow-x: auto; }
.inst { position: absolute; inset: 0; z-index: 1500; background: #0d0b08; display: flex; }
#instMap { position: absolute; inset: 0; background: #17120b; }
.inst .iempty { position: absolute; inset: 0; z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 80px 24px; text-align: center; background: #17120b; overflow: auto; }
.inst .iempty[hidden] { display: none; }
.inst .icredit { position: absolute; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 1000; background: var(--chip); border: 1px solid var(--side-line); border-radius: 6px; padding: 4px 8px; font-size: var(--fs-sm); color: var(--muted); }
.inst .iempty h3 { margin: 0; font: var(--fw-bold) var(--fs-3xl) var(--display); color: var(--gold); letter-spacing: var(--ls-tight); }
.inst .iempty p { margin: 4px 0 0; font: var(--fw-semibold) var(--fs-xl) var(--body); color: var(--ink); }
.inst .iempty small { color: var(--muted); }
.inst .iempty ol { margin: 10px 0; padding-left: 1.4em; text-align: left; color: var(--ink); font-size: var(--fs-base); line-height: 1.6; }
.inst .iempty ol:empty { display: none; }
.inst .iempty ol li:has(.pf) { display: flex; align-items: center; gap: 10px; margin: 4px 0; list-style: none; }
.inst .iempty ol:has(.pf) { padding-left: 0; }
.inst .ihead { position: absolute; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; pointer-events: none; }
.inst .ihead > * { pointer-events: auto; }
.inst .ihead .back { position: static; }
.iart { display: inline-flex; background: var(--chip); border: 1px solid var(--side-line); border-radius: 8px; padding: 2px; gap: 2px; }
.iart button { background: none; border: 0; border-radius: 6px; padding: 5px 10px; color: var(--ink); cursor: pointer; font: var(--fw-semibold) var(--fs-base) var(--body); }
.iart button[aria-pressed="true"] { background: var(--ink); color: var(--chip); }
.iart button:disabled { opacity: .45; cursor: default; }
.cityart { left: 12px; top: calc(108px + env(safe-area-inset-top, 0px)); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.inst .ititle { background: var(--chip); border: 1px solid var(--side-line); border-radius: 8px; padding: 4px 10px; min-width: 0; }
.inst .ititle h2 { margin: 0; font-size: var(--title-md); letter-spacing: var(--ls-tight); }
.inst .ititle small { color: var(--muted); font-size: var(--fs-md); }
.inst select { background: var(--chip); color: var(--ink); border: 1px solid var(--side-line); border-radius: 8px; padding: 7px 8px; font: var(--fw-semibold) var(--fs-base) var(--body); }
.inst .iside { position: absolute; right: 12px; bottom: 12px; z-index: 1000; width: 230px; max-width: calc(100% - 24px); max-height: 55%; overflow: auto; background: var(--chip); border: 1px solid var(--side-line); border-radius: 10px; padding: 8px; }
.inst .iside h3 { margin: 0 4px 4px; }
.wp.dm .dmlbl { position: absolute; left: 32px; top: 50%; transform: translateY(-50%); font: var(--fw-heavy) var(--fs-md) var(--body); color: #fff; -webkit-text-stroke: .5px #000; text-shadow: 0 0 2px #000, 0 0 4px #000, 0 0 6px #000; white-space: nowrap; pointer-events: none; }
.annobar { left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 1600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; background: var(--chip); border: 1px solid var(--gold); border-radius: 10px; padding: 6px 8px 6px 12px; max-width: calc(100% - 24px); box-sizing: border-box; font-size: var(--fs-md); box-shadow: 0 2px 10px #0008; }
.annolbl span { position: absolute; transform: translate(-50%, -50%); font: var(--fw-heavy) var(--fs-md) var(--body); color: #fff; -webkit-text-stroke: .5px #000; text-shadow: 0 0 2px #000, 0 0 4px #000, 0 0 6px var(--c, #000); white-space: nowrap; pointer-events: none; }
.annohandle i { position: absolute; inset: 1px; background: #fff; border: 2px solid; border-radius: 3px; box-shadow: 0 0 2px #000; cursor: grab; }
.annoarrow i { margin: -6px 0 0 -5px; border-top-width: 6px; border-bottom-width: 6px; border-left-width: 11px; transform-origin: 5px 6px; }
.wrow.annorow.sel { outline: 1px solid var(--gold); }
.wrow.annorow b { font-size: var(--fs-base); }
.dmarrow { pointer-events: none; }
/* direction arrows along route legs (links.js drawRouteArrows): dark on the gold line */
.dmarrow.routearrow i { margin: -6px 0 0 -5px; border-top-width: 6px; border-bottom-width: 6px; border-left-width: 11px; transform-origin: 5px 6px; border-left-color: #1a1408; filter: drop-shadow(0 0 1px #f2c94c) drop-shadow(0 0 1.5px #f2c94c); }
.dmarrow i { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -8px 0 0 -7px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 14px solid #f2c94c; filter: drop-shadow(0 0 1.5px #000) drop-shadow(0 0 1px #000); transform-origin: 7px 8px; }
.boss { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 3px 4px; border-radius: 5px; cursor: pointer; font-size: var(--fs-base); }
.boss:hover:not(:disabled) { background: var(--side-2); }
.boss:disabled { cursor: default; opacity: .7; }
.bossfloor { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 4px 2px; cursor: pointer; color: var(--title-color); font: var(--fw-bold) var(--fs-sm) var(--body); letter-spacing: var(--ls-tight); }
.bossfloor:first-child { padding-top: 0; }
.bossfloor:hover { text-decoration: underline; }
.boss.away, .bossfloor.away { opacity: .5; }
.boss b, .bossmk b { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #b3261e; color: #fff; font: var(--fw-bold) var(--fs-sm) var(--body); border: 2px solid #f3d27a; }
.bossmk { display: grid; place-items: center; }
.bossmk.flash { animation: bosshit 0.6s ease-in-out 3; z-index: 1000 !important; }
@keyframes bosshit { 50% { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px #f3d27a) drop-shadow(0 0 16px #f3d27a); } }
.bossmk b { width: 24px; height: 24px; box-shadow: 0 2px 6px #000; }
.leaflet-container .entermk img { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px #000); }
.entermk span { position: absolute; left: 26px; top: 50%; transform: translateY(-50%); font: var(--fw-heavy) var(--fs-md) var(--body); color: #ffd200; -webkit-text-stroke: .6px #000; text-shadow: 0 0 2px #000, 0 0 4px #000; white-space: nowrap; }
.entermk.side-left span { left: auto; right: 26px; }
.entermk.side-top span { left: 50%; top: -12px; transform: translateX(-50%); }
/* .bossmk.portrait keeps Leaflet's position: absolute (a relative one stacked the portraits 17 px apart) */
.bossmk.portrait .ring, .bossmk.portrait .face { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background-repeat: no-repeat; }
.bossmk.portrait .face { border-radius: 50%; }
.bossmk.portrait .ord { position: absolute; right: -10px; bottom: -8px; width: 16px; height: 16px; font-size: var(--fs-xs); border-width: 1px; }
.boss .pf, .iempty .pf { position: relative; flex: none; width: 40px; height: 40px; }
.spotgroup { margin-top: 8px; border-top: 1px solid var(--side-line); padding-top: 6px; }
.spotnote, .spotsrc { margin: 0 4px 6px; font-size: var(--fs-sm); line-height: 1.35; }
.spotnote summary { cursor: pointer; font-weight: var(--fw-bold); }
.spotnote p { margin: 4px 0 0; }
.spotsrc a { color: inherit; }
.boss.spot .pf { display: grid; place-items: center; }
.leaflet-container .spotmk svg { filter: drop-shadow(0 1px 3px #000); }
.spotpop p { margin: 4px 0 0; }
.boss .pf .face, .iempty .pf .face { display: block; border-radius: 50%; background-repeat: no-repeat; box-shadow: 0 0 0 1.5px #f3d27a; }
@media (max-width: 760px) { .inst .iside { max-height: 35%; width: auto; left: 12px; } .inst #instWay { display: none; } }
.back { left: 12px; top: calc(60px + env(safe-area-inset-top, 0px)); background: var(--gold); color: var(--gold-ink); border: 0; border-radius: 8px; padding: 8px 14px; font: var(--fw-bold) var(--fs-lg) var(--body); cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.back:hover { filter: brightness(1.08); }
.crumbs button { background: none; border: 0; padding: 5px 8px; border-radius: 5px; cursor: pointer; font: var(--fw-semibold) var(--fs-base) var(--display); letter-spacing: var(--ls-tight); white-space: nowrap; }
.crumbs button:hover { background: var(--side-2); }
.crumbs button:last-child { color: var(--gold); cursor: default; }
.crumbs .sep { color: var(--muted); }
.zoom { right: max(12px, env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); display: grid; gap: 4px; }
.zoom button { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--side-line); background: var(--chip); cursor: pointer; font-size: var(--fs-xl); }
.zoom button:hover { border-color: var(--gold); }
.readout { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--chip); border: 1px solid var(--side-line); padding: 5px 10px; border-radius: 6px; font: var(--fw-medium) var(--fs-md) var(--mono); pointer-events: none; }
.hoverTag { pointer-events: none; background: var(--chip); border: 1px solid var(--gold); padding: 4px 9px; border-radius: 6px; font: var(--fw-semibold) var(--fs-base) var(--display); letter-spacing: var(--ls-tight); transform: translate(14px, 14px); white-space: nowrap; }
.hoverTag .lv { display: block; margin-top: 1px; font: var(--fw-medium) var(--fs-sm) var(--body); letter-spacing: var(--ls-none); color: var(--muted); }
.toast { left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--gold); color: var(--gold-ink); font-weight: var(--fw-semibold); padding: 7px 14px; border-radius: 20px; max-width: calc(100% - 24px); text-align: center; }
.toastnote { display: block; font-size: var(--fs-md); font-weight: var(--fw-medium); }
.toastnote a { color: inherit; text-decoration: underline; }
/* Phones show their own "Copied" bubble near the bottom of the screen; keep ours clear of it, under the breadcrumbs. */
@media (pointer: coarse) { .toast { bottom: auto; top: calc(58px + env(safe-area-inset-top, 0px)); max-width: calc(100% - 112px); } }
/* agent debug view (?agent=1 or forevermap.setDebug(true)): coordinate grid, big waypoint numbers, state panel */
.agentpanel { left: 12px; bottom: calc(48px + env(safe-area-inset-bottom, 0px)); max-width: min(360px, calc(100% - 24px)); max-height: 45%; overflow: hidden; margin: 0; background: rgba(4, 10, 14, .88); color: #e8f7ff; border: 1px solid #00e5ff; border-radius: 6px; padding: 8px 10px; font: var(--fw-medium) var(--fs-sm)/1.35 var(--mono); white-space: pre-wrap; pointer-events: none; }
.gridlbl { color: #00e5ff; font: var(--fw-bold) var(--fs-sm) var(--mono); text-shadow: 0 0 2px #000, 0 0 3px #000, 0 0 4px #000; white-space: nowrap; background: none; border: 0; }
.agent-debug .wp.typed small { min-width: 22px; height: 22px; right: -12px; bottom: -10px; border-radius: 11px; background: #ff2bd6; border: 2px solid #fff; font: var(--fw-heavy) var(--fs-lg)/18px var(--body); }

/* ?preview=1 (the /preview.png endpoint): the map alone, without the sidebar and controls */
.fm-preview .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.fm-preview .side, .fm-preview .zoom, .fm-preview .back, .fm-preview .fab, .fm-preview .finder, .fm-preview .readout, .fm-preview .hoverTag, .fm-preview .toast { display: none !important; }
.fm-preview .agentpanel { bottom: 12px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr 42%; }
  .fm-preview .app { grid-template-rows: 1fr; }
  .side { order: 2; border-right: 0; border-top: 1px solid var(--side-line); padding-right: env(safe-area-inset-right, 0px); }
  .brand { display: none; }
  .pane { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
  /* The panel under the map folds down to a slim bar, so the map can take the whole screen. */
  .sidetoggle { display: flex; }
  .app.sidecollapsed { grid-template-rows: 1fr auto; }
  .app.sidecollapsed .side > :not(.sidetoggle) { display: none; }
  .app.sidecollapsed .sidetoggle { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); border-bottom: 0; }
  .app.sidecollapsed .sidetoggle svg { transform: rotate(180deg); }
  /* The bar is also a drag handle (search.js): a grip on top, three sizes, and a short slide between them. */
  .app { transition: grid-template-rows .22s ease; }
  .app.sheetdrag { transition: none; user-select: none; }
  .app.sheetfull { grid-template-rows: 1fr max(42%, calc(100% - 220px)); }
  .sidetoggle { position: relative; padding: 14px 0 10px; touch-action: none; }
  .sidetoggle::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--muted); opacity: .55; }
  .app.sidecollapsed .sidetoggle { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .app { transition: none; } }
.wrow small a.npclink { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.pop .meta.npcstop { color: inherit; font-weight: var(--fw-medium); }
