/* =====================================================================
   Calixis Sector — Inquisition / Mechanicus theme
   ===================================================================== */

:root {
  --void:      #0a0c0f;
  --panel:     #14181d;
  --panel-2:   #1b2128;
  --line:      #2c343d;
  --brass:     #c9a227;
  --brass-dim: #8a7220;
  --rust:      #b5471f;
  --blood:     #8a1f1f;
  --tech:      #4fd0c5;   /* cogitator cyan */
  --ink:       #d7d2c4;
  --ink-dim:   #8c8675;
  --green:     #4caf50;
  --amber:     #e0a526;
  --red:       #d2412b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, #11161c 0%, var(--void) 70%) fixed;
  color: var(--ink);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 18px;
  line-height: 1.55;
}

a { color: var(--brass); text-decoration: none; }
a:hover { color: #f0cf55; text-decoration: underline; }

h1, h2, h3 { font-family: "Cinzel", serif; color: var(--brass); letter-spacing: .04em; font-weight: 700; }
h1 { font-size: 2.1rem; margin: .2em 0 .4em; }
h2 { font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .25em; }
code, .mono { font-family: "Share Tech Mono", monospace; color: var(--tech); }

/* subtle CRT scanlines overlay */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.10) 3px);
  mix-blend-mode: multiply;
}

/* ---- top bar / nav ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.4rem;
  background: linear-gradient(180deg, #11161c, #0c0f13);
  border-bottom: 2px solid var(--brass-dim);
  box-shadow: 0 2px 14px rgba(0,0,0,.6);
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand:hover { text-decoration: none; }
.brand-cog { font-size: 1.9rem; color: var(--brass); animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-text { font-family: "Cinzel", serif; font-weight: 700; color: var(--ink); font-size: 1.25rem; line-height: 1; }
.brand-text small { display: block; font-family: "Share Tech Mono", monospace; color: var(--ink-dim); font-size: .6rem; letter-spacing: .25em; }

.mainnav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.mainnav a { font-family: "Cinzel", serif; font-size: .95rem; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.mainnav a.is-active { color: var(--brass); }
.mainnav a:hover { color: var(--brass); text-decoration: none; }
.mainnav .navauth { border: 1px solid var(--brass-dim); padding: .25em .8em; border-radius: 2px; color: var(--brass); }
.mainnav .navstaff { color: var(--tech); }

/* ---- layout ---- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 2rem 1.4rem 4rem; }
.wrap-wide { max-width: 1600px; margin: 0 auto; padding: 1rem 1.4rem 2rem; }

/* ---- panels / data-slates ---- */
.slate {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass-dim);
  padding: 1.2rem 1.4rem;
  margin: 1rem 0;
  position: relative;
}
.slate::before {
  content: "";
  position: absolute; top: 6px; right: 8px; width: 10px; height: 10px;
  border: 1px solid var(--rust); border-radius: 50%;
  box-shadow: 0 0 6px var(--rust);
}

.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* ---- hero ---- */
.hero {
  text-align: center; padding: 3rem 1rem 2.5rem;
  border: 1px solid var(--line); border-top: 3px solid var(--brass);
  background:
    radial-gradient(circle at 50% 0, rgba(201,162,39,.10), transparent 60%),
    linear-gradient(180deg, var(--panel), var(--void));
  margin-bottom: 1.5rem;
}
.hero .eyebrow { font-family: "Share Tech Mono", monospace; color: var(--tech); letter-spacing: .35em; font-size: .8rem; }
.hero h1 { font-size: 3rem; margin: .3em 0 .2em; text-shadow: 0 0 18px rgba(201,162,39,.25); }
.hero p.lede { color: var(--ink-dim); max-width: 640px; margin: .5em auto 1.4em; font-size: 1.15rem; }

/* ---- buttons ---- */
.btn {
  display: inline-block; font-family: "Cinzel", serif; text-transform: uppercase;
  letter-spacing: .06em; font-size: .9rem;
  padding: .6em 1.3em; border: 1px solid var(--brass-dim);
  background: linear-gradient(180deg, #1d232b, #12161b); color: var(--brass);
  cursor: pointer; border-radius: 2px; transition: .15s;
}
.btn:hover { border-color: var(--brass); color: #f0cf55; text-decoration: none; box-shadow: 0 0 10px rgba(201,162,39,.3); }
.btn-primary { background: linear-gradient(180deg, #3a2a10, #241a0a); color: #f0cf55; }
.btn-danger { border-color: var(--blood); color: #e98c8c; }
.btn-sm { padding: .35em .8em; font-size: .78rem; }

/* hover glow for the inline (Tailwind) CTA buttons across the public pages.
   No transition here — those buttons carry Tailwind's `transition` utility,
   whose default property list already animates box-shadow. */
.btn-glow:hover      { box-shadow: 0 0 18px rgba(201,162,39,.40); }   /* brass */
.btn-glow-tech:hover { box-shadow: 0 0 18px rgba(79,208,197,.35); }   /* cogitator cyan */

/* ---- cards / links ---- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  padding: 1rem 1.1rem; transition: .15s;
}
.card:hover { border-color: var(--brass-dim); transform: translateY(-2px); }
.card h3 { margin: .1em 0 .3em; font-size: 1.15rem; }
.card .meta { font-family: "Share Tech Mono", monospace; font-size: .72rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .12em; }

.tag { display: inline-block; font-family: "Share Tech Mono", monospace; font-size: .68rem; padding: .15em .55em; border: 1px solid currentColor; border-radius: 2px; text-transform: uppercase; letter-spacing: .1em; }

/* ---- gallery ---- */
.shots { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.shots a { display: block; border: 1px solid var(--line); overflow: hidden; aspect-ratio: 16/10; background: var(--void); }
.shots img { width: 100%; height: 100%; object-fit: cover; display: block; transition: .2s; }
.shots a:hover img { transform: scale(1.05); }

/* ---- tables (staff) ---- */
table.data { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: .5em .7em; border-bottom: 1px solid var(--line); }
table.data th { font-family: "Cinzel", serif; color: var(--brass); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
table.data tr:hover td { background: rgba(201,162,39,.05); }

/* ---- forms ---- */
label { display: block; font-family: "Share Tech Mono", monospace; font-size: .72rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .12em; margin: .9rem 0 .25rem; }
input[type=text], input[type=url], input[type=number], input[type=color], select, textarea {
  width: 100%; background: var(--void); border: 1px solid var(--line); color: var(--ink);
  font-family: "EB Garamond", serif; font-size: 1rem; padding: .5em .6em; border-radius: 2px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass-dim); box-shadow: 0 0 6px rgba(201,162,39,.25); }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > div { flex: 1 1 200px; }

/* ---- notices ---- */
.notice { padding: .7em 1em; border-left: 3px solid var(--tech); background: rgba(79,208,197,.07); margin: 1rem 0; font-family: "Share Tech Mono", monospace; font-size: .85rem; }
.notice.warn { border-color: var(--amber); background: rgba(224,165,38,.07); }
.notice.err { border-color: var(--red); background: rgba(210,65,43,.08); }

/* ---- footer ---- */
.sitefoot { text-align: center; padding: 2rem 1rem 3rem; border-top: 1px solid var(--line); color: var(--ink-dim); }
.foot-line { font-family: "Cinzel", serif; color: var(--brass-dim); }
.foot-sub { font-size: .8rem; margin-top: .4rem; }

/* =====================================================================
   Star map — legacy editor chrome (node/zone styles live in the redesign
   block below; the dynamic galaxy styling supersedes the old node CSS).
   ===================================================================== */
.map-toolbar {
  position: absolute; top: 56px; right: 12px; z-index: 1000;  /* below the layer-toggle control */
  background: rgba(12,15,19,.92); border: 1px solid var(--brass-dim);
  padding: .6rem .8rem; max-width: 280px;
  max-height: calc(100vh - 200px); overflow-y: auto;
}
.map-toolbar h3 { margin: 0 0 .4rem; font-size: 1rem; }
.legend { font-family: "Share Tech Mono", monospace; font-size: .75rem; }
.legend .row-i { display: flex; align-items: center; gap: .5rem; margin: .2rem 0; }
.legend .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #000; }

.editbox {
  position: absolute; bottom: 16px; right: 12px; z-index: 1200; width: 300px;
  max-height: calc(100vh - 120px); overflow-y: auto;
  background: rgba(12,15,19,.96); border: 1px solid var(--brass-dim); padding: 1rem;
}
.editbox.hidden { display: none; }

@media (max-width: 720px) {
  .hero h1 { font-size: 2.1rem; }
  html, body { font-size: 16px; }
}

/* =====================================================================
   Redesign additions (Tailwind-complementary)
   ===================================================================== */

[x-cloak] { display: none !important; }

/* scroll-reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in-view { opacity: 1; transform: none; }

/* the global starfield canvas sits behind everything (positioned via Tailwind) */
#starfield { background: radial-gradient(ellipse at 50% -10%, #11161c 0%, #05070a 60%, #05070a 100%); }

/* galaxy map: transparent container so the page starfield shows through */
body.page-sector { overflow: hidden; }
#sectormap { width: 100%; height: calc(100vh - 64px); background: transparent; }
/* Embedded preview (home-page iframe): no nav header, so the map fills the frame. */
body.page-embed #sectormap { height: 100vh; }
.leaflet-container { background: transparent; }

/* public legend, docked flush to the left edge (a data-slate spine, not a float) */
.map-legend-dock {
  position: absolute; top: 0; left: 0; bottom: 0; z-index: 1000;
  width: 248px; max-width: 80vw;
  background: linear-gradient(180deg, rgba(10,13,17,.96), rgba(7,9,12,.96));
  border-right: 1px solid var(--brass-dim); padding: 1rem 1rem 1.25rem;
  overflow-y: auto; backdrop-filter: blur(2px);
}
@media (max-width: 640px) { .map-legend-dock { width: 200px; } }

/* system node (world-type coloured) + optional faction ring */
.sys-wrap { position: relative; width: 18px; height: 18px; }
.sys-node {
  width: 14px; height: 14px; margin: 2px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(0,0,0,.7);
  font-family: "Share Tech Mono", monospace; font-size: 9px; color: #fff;
  cursor: pointer; position: relative;
  box-shadow: 0 0 8px var(--c), 0 0 3px var(--c);
  transition: transform .12s ease;
}
.sys-wrap:hover { z-index: 600; }
.sys-wrap:hover .sys-node { transform: scale(1.3); }
.sys-wrap.has-ring::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: var(--rw) solid var(--ring); opacity: .85; pointer-events: none;
}
.sys-label {
  position: absolute; top: 130%; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-family: "Cinzel", serif; font-size: 11px;
  color: #e7e2d4; text-shadow: 0 0 5px #000, 0 0 5px #000; pointer-events: none; letter-spacing: .03em;
}
/* world-type marker variants */
.sys-node.wt-ring { background: transparent !important; border: 2px solid var(--c); }
.sys-node.wt-glow { box-shadow: 0 0 16px var(--c), 0 0 9px var(--c); }
.sys-node.wt-pentagon { border-radius: 0; clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }

/* region zones / nebulae / labels */
.region-label {
  font-family: "Cinzel", serif; text-transform: uppercase; letter-spacing: .18em;
  color: rgba(231,226,212,.42); font-size: 13px; text-align: center; white-space: nowrap;
  text-shadow: 0 0 8px #000; pointer-events: none;
}
.nebula {
  width: 360px; height: 360px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, var(--t) 0%, transparent 65%);
  opacity: .32; filter: blur(16px);
  animation: nebuladrift 26s ease-in-out infinite alternate;
}
@keyframes nebuladrift {
  from { transform: translate(-10px,-6px) scale(1); }
  to   { transform: translate(12px,8px) scale(1.08); }
}

/* directional edge markers */
.edge {
  position: absolute; z-index: 900; pointer-events: none;
  font-family: "Cinzel", serif; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(201,162,39,.5); font-size: 12px; text-shadow: 0 0 6px #000;
}
.edge-top    { top: 10px; left: 50%; transform: translateX(-50%); }
.edge-bottom { bottom: 10px; left: 50%; transform: translateX(-50%); }
.edge-left   { left: 12px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
.edge-right  { right: 12px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%); }

/* slide-in detail panel for the galaxy map */
.sys-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: 340px; max-width: 86vw;
  background: rgba(10,13,17,.96); border-left: 1px solid var(--brass-dim);
  box-shadow: -10px 0 30px rgba(0,0,0,.6); z-index: 1200;
  transform: translateX(100%); transition: transform .25s ease; padding: 1.4rem;
  overflow-y: auto;
}
.sys-panel.open { transform: none; }

/* dark Leaflet tooltip to match the galaxy theme */
.leaflet-tooltip.sys-tip {
  background: rgba(10,13,17,.95); color: #e7e2d4; border: 1px solid var(--brass-dim);
  font-family: "Cinzel", serif; font-size: 12px; box-shadow: 0 0 10px rgba(0,0,0,.6);
}
.leaflet-tooltip.sys-tip::before { border-top-color: var(--brass-dim); }

/* centred control number (serif + stroke) */
.sys-num {
  font-family: "Marcellus", serif; color: #fff; line-height: 1; font-weight: 400;
  -webkit-text-stroke: .6px rgba(0,0,0,.85); paint-order: stroke fill;
  text-shadow: 0 0 2px rgba(0,0,0,.9); pointer-events: none;
}

/* current system — prominent halo + pulse + tag */
.sys-wrap.is-current .sys-node { box-shadow: 0 0 20px var(--c), 0 0 9px #fff; }
.sys-wrap.is-current::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px solid rgba(201,162,39,.85); pointer-events: none;
  animation: sys-pulse 2.2s ease-out infinite;
}
@keyframes sys-pulse { 0% { transform: scale(.75); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.sys-current-tag {
  position: absolute; bottom: 135%; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: "Marcellus", serif; font-size: 11px; color: #f0cf55; letter-spacing: .12em;
  text-transform: uppercase; text-shadow: 0 0 6px #000, 0 0 6px #000; pointer-events: none;
}

/* search-found highlight — transient pulsing ring on the located node */
.leaflet-marker-icon.sys-found { z-index: 900 !important; }
.leaflet-marker-icon.sys-found .sys-node { box-shadow: 0 0 22px #f0cf55, 0 0 10px #fff; }
.leaflet-marker-icon.sys-found::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px;
  margin: -23px 0 0 -23px; border-radius: 50%; border: 2px solid rgba(240,207,85,.95);
  pointer-events: none; animation: sys-found-ping 0.9s ease-out 2;
}
@keyframes sys-found-ping { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.9); opacity: 0; } }

/* map search box — top-center overlay */
.map-search {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1000; width: 300px; max-width: 70vw; font-family: "Share Tech Mono", monospace;
}
.map-search .ms-input {
  width: 100%; background: rgba(10,12,15,.92); border: 1px solid var(--brass-dim);
  color: var(--ink); padding: .55em .85em; border-radius: 3px; font-size: .85rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.5); backdrop-filter: blur(4px);
}
.map-search .ms-input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 8px rgba(201,162,39,.4); }
.map-search .ms-input::placeholder { color: var(--ink-dim); }
.map-search .ms-results {
  display: none; list-style: none; margin: .35rem 0 0; padding: .25rem;
  max-height: 320px; overflow-y: auto; background: rgba(10,12,15,.96);
  border: 1px solid var(--brass-dim); border-radius: 3px; box-shadow: 0 6px 18px rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}
.map-search.open .ms-results { display: block; }
.map-search .ms-result {
  display: flex; align-items: center; gap: .55rem; padding: .4em .55em;
  border-radius: 2px; cursor: pointer;
}
.map-search .ms-result.active, .map-search .ms-result:hover { background: rgba(201,162,39,.14); }
.map-search .ms-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0,0,0,.6); }
.map-search .ms-text { display: flex; flex-direction: column; min-width: 0; }
.map-search .ms-name { color: var(--ink); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-search .ms-sub { color: var(--ink-dim); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* shipping lanes + region edit handles */
.lane-trunk { filter: drop-shadow(0 0 2px rgba(201,162,39,.5)); }
.region-vertex {
  width: 12px; height: 12px; border-radius: 50%; background: #c9a227;
  border: 2px solid #000; box-shadow: 0 0 6px #c9a227; cursor: move;
}
body.region-editing .leaflet-marker-icon { cursor: default; }
/* other regions shown as faint, clickable ghosts while editing one */
.region-ref { cursor: pointer; transition: fill-opacity .15s, stroke-opacity .15s; }
.region-ref:hover { stroke-opacity: .9; fill-opacity: .14; }
/* contested overlap area — crosshatch fill is an injected SVG pattern */
.region-contest { pointer-events: none; }

/* dossier detail panel */
.dossier-inspect {
  display: inline-block; margin: .2rem 0 .6rem; font-family: "Cinzel", serif;
  text-transform: uppercase; letter-spacing: .08em; font-size: .8rem;
  color: var(--brass); border: 1px solid var(--brass-dim); padding: .35em .8em; border-radius: 2px;
}
.dossier-inspect:hover { border-color: var(--brass); color: #f0cf55; text-decoration: none; }
.dossier-loading { color: #8c8675; font-family: "Share Tech Mono", monospace; }
.dossier-current { font-family: "Marcellus", serif; color: #f0cf55; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .2rem; }
.dossier-field { margin-top: .85rem; }
.dossier-k { font-family: "Share Tech Mono", monospace; font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: #8c8675; margin-bottom: .15rem; }
.dossier-v { color: #d7d2c4; line-height: 1.55; }
.dossier-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .85rem 0; }
.dossier-imgs a { display: block; aspect-ratio: 1; border: 1px solid var(--line); overflow: hidden; }
.dossier-imgs img { width: 100%; height: 100%; object-fit: cover; }

/* image lightbox */
.lb-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out; padding: 2rem; }
.lb-overlay img { max-width: 92vw; max-height: 85vh; border: 1px solid var(--brass-dim); }
.lb-cap { color: #8c8675; font-family: "Share Tech Mono", monospace; margin-top: .6rem; }

/* =====================================================================
   Orrery (per-system solar map)
   ===================================================================== */
.orrery {
  position: relative; width: 100%; aspect-ratio: 1; max-width: 640px; margin: 0 auto;
  background: radial-gradient(circle at 50% 50%, #0b0f15 0%, #05070a 70%);
  border: 1px solid var(--line); overflow: hidden; touch-action: none;
}
.orrery-sun { position: absolute; border-radius: 50%; pointer-events: none; }
.orrery-ring { position: absolute; border: 1px solid rgba(255,255,255,.06); border-radius: 50%; pointer-events: none; }
.orrery-planet { position: absolute; border-radius: 50%; cursor: pointer; border: 1px solid rgba(0,0,0,.5); }
.orrery-planet:hover { outline: 1px solid rgba(255,255,255,.7); }
.orrery-plabel {
  position: absolute; left: 50%; top: 130%; transform: translateX(-50%); white-space: nowrap;
  font-family: "Cinzel", serif; font-size: 10px; color: #cfcabd; text-shadow: 0 0 4px #000, 0 0 4px #000; pointer-events: none;
}
.orrery-info {
  position: absolute; left: 12px; bottom: 12px; max-width: 64%;
  background: rgba(10,13,17,.95); border: 1px solid var(--brass-dim); padding: .8rem 1rem; border-radius: 2px;
}
.orrery-info h3 { margin: 0; font-family: "Cinzel", serif; color: var(--brass); }
.orrery-info .oi-biome { font-family: "Share Tech Mono", monospace; font-size: .7rem; color: var(--tech); margin-bottom: .3rem; }
.orrery-info p { margin: .3rem 0 0; color: var(--ink); font-size: .9rem; }
.orrery-info .oi-close { position: absolute; top: 4px; right: 8px; background: none; border: 0; color: var(--ink-dim); font-size: 1.2rem; cursor: pointer; }

.planet-panel {
  position: fixed; right: 16px; top: 84px; width: 300px; z-index: 1500;
  background: rgba(10,13,17,.97); border: 1px solid var(--brass-dim); padding: 1rem; border-radius: 2px;
}

/* =====================================================================
   Map overlays: tinted SVG icon stamps, ships, wonders, routes, badges
   (monochrome SVGs are recoloured via CSS mask -> background-color)
   ===================================================================== */
.map-icon {
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
  display: inline-block;
}
.sys-badge {
  position: absolute; top: -3px; right: -3px; width: 13px; height: 13px;
  filter: drop-shadow(0 0 2px #000); pointer-events: none;
}
.obj-stamp { display: flex; flex-direction: column; align-items: center; }
.obj-stamp .map-icon { filter: drop-shadow(0 0 3px #000); transition: transform .12s ease; }
.obj-stamp.is-wonder .map-icon { filter: drop-shadow(0 0 7px currentColor); cursor: pointer; }
.obj-stamp.is-wonder:hover .map-icon { transform: scale(1.12); }
.map-icon.is-ship { filter: drop-shadow(0 0 4px #000); }
.map-icon-fallback { border-radius: 2px; opacity: .85; }
.obj-label {
  font-family: "Cinzel", serif; font-size: 11px; color: #e7e2d4;
  text-shadow: 0 0 5px #000, 0 0 5px #000; white-space: nowrap; margin-top: 2px; pointer-events: none;
}
.obj-label.only { font-size: 13px; letter-spacing: .04em; }
.map-route { filter: drop-shadow(0 0 2px rgba(0,0,0,.6)); }
.map-route.route-front { filter: drop-shadow(0 0 3px rgba(210,65,43,.5)); }

/* Leaflet overlay toggle control — themed to match */
.leaflet-control-layers {
  background: rgba(10,13,17,.92); border: 1px solid var(--brass-dim); border-radius: 2px;
  color: var(--ink); box-shadow: 0 0 12px rgba(0,0,0,.6);
}
.leaflet-control-layers-toggle { background-color: rgba(10,13,17,.92); }
.leaflet-control-layers-expanded { padding: .5rem .7rem; }
.leaflet-control-layers label { font-family: "Share Tech Mono", monospace; font-size: .72rem; color: var(--ink); }
.leaflet-control-layers-separator { border-top-color: var(--line); }

/* =====================================================================
   Staff map tool suite (left toolbar, icon picker, layer manager)
   ===================================================================== */
.map-tools {
  position: absolute; top: 50%; left: 12px; transform: translateY(-50%); z-index: 1100; width: 56px;
  background: rgba(10,13,17,.94); border: 1px solid var(--brass-dim); border-radius: 3px;
  display: flex; flex-direction: column; gap: 2px; padding: 4px;
}
/* bottom-center command bar: exit · add · undo · redo · save */
.map-cmdbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1150;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center;
  background: rgba(10,13,17,.94); border: 1px solid var(--brass-dim); border-radius: 3px;
  padding: .4rem .55rem; max-width: calc(100vw - 150px);
}
.map-cmdbar .btn { white-space: nowrap; }
.map-cmdbar .btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.cmd-dirty { font-family: "Share Tech Mono", monospace; font-size: .72rem; color: var(--brass); margin-left: .15rem; }
.cmd-dirty:empty { display: none; }
.mt-btn {
  width: 46px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #1d232b, #12161b); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 2px; cursor: pointer; font-size: 1.05rem;
}
.mt-btn:hover { color: var(--brass); border-color: var(--brass-dim); }
.mt-btn.active { color: var(--brass); border-color: var(--brass); box-shadow: 0 0 10px rgba(201,162,39,.35); background: #20272f; }
.mt-btn small { font-size: .5rem; display: block; }
.mt-sep { height: 1px; background: var(--line); margin: 3px 2px; }

/* shared floating panel for tool option boxes */
.mt-panel {
  position: absolute; top: 12px; left: 80px; z-index: 1100; width: 280px;
  background: rgba(10,13,17,.96); border: 1px solid var(--brass-dim); border-radius: 3px; padding: .9rem;
  font-size: .8rem; color: var(--ink); max-height: calc(100vh - 96px); overflow-y: auto;
}
.mt-panel h4 { margin: 0 0 .5rem; font-size: .9rem; }
.mt-panel label { display: block; font-family: "Share Tech Mono", monospace; font-size: .62rem;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-dim); margin: .55rem 0 .15rem; }
.mt-panel input[type=text], .mt-panel input[type=number], .mt-panel select, .mt-panel textarea {
  width: 100%; background: #0c1014; border: 1px solid var(--line); color: var(--ink);
  padding: .35em .5em; border-radius: 2px; font-family: inherit; }
.mt-panel textarea { min-height: 90px; resize: vertical; }
.mt-row { display: flex; gap: .5rem; }
.mt-row > * { flex: 1; }
.mt-actions { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.mt-hint { color: var(--ink-dim); font-size: .68rem; margin-top: .4rem; }

/* layer manager rows */
.lm-row { display: flex; align-items: center; gap: .4rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.lm-row .lm-name { flex: 1; }
.lm-row .lm-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #000; }
.lm-row.active { color: var(--brass); }

/* icon picker modal */
.icon-picker { position: fixed; inset: 0; z-index: 2600; background: rgba(4,6,9,.85); display: flex; align-items: center; justify-content: center; }
.ip-box { width: min(720px, 92vw); max-height: 86vh; background: var(--void); border: 1px solid var(--brass-dim); border-radius: 4px; display: flex; flex-direction: column; }
.ip-head { padding: .8rem 1rem; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; align-items: center; }
.ip-head input[type=text] { flex: 1; background: #0c1014; border: 1px solid var(--line); color: var(--ink); padding: .4em .6em; border-radius: 2px; }
.ip-tabs { display: flex; gap: .3rem; padding: .5rem 1rem 0; flex-wrap: wrap; }
.ip-tab { font-family: "Share Tech Mono", monospace; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
  padding: .25em .7em; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; color: var(--ink-dim); }
.ip-tab.active { color: var(--brass); border-color: var(--brass-dim); }
.ip-grid { padding: 1rem; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .5rem; }
.ip-cell { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: #0c1014; }
.ip-cell:hover { border-color: var(--brass-dim); }
.ip-cell .map-icon { width: 70%; height: 70%; background-color: var(--brass); }
.ip-cell.inactive { opacity: .35; }
.ip-star { position: absolute; top: 1px; right: 3px; font-size: .7rem; color: var(--ink-dim); }
.ip-cell.fav .ip-star { color: var(--brass); }
.ip-foot { padding: .6rem 1rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: .6rem; }

/* =====================================================================
   Map console chrome — Inquisition cartograph instrumentation.
   Brass-fitted panels with a faint amber cogitator scanline and a lit
   top edge; amber is reserved for the one job of "needs your attention"
   (active tool, unsaved work). Signature: panels power up on load — the
   tool-spine glyphs flicker in like an awakening cogitator.
   ===================================================================== */

/* --- tool spine (left) --- */
.map-tools {
  border-radius: 0; border-left-width: 2px;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(224,165,38,.05) 2px 3px);
  box-shadow: inset 0 1px 0 rgba(201,162,39,.3), 0 0 16px rgba(0,0,0,.55);
  animation: cog-fadein .45s ease both;
}
.map-tools::before {            /* lit brass top cap */
  content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent); pointer-events: none;
}
.mt-btn {
  border-radius: 0; position: relative;
  animation: cog-powerup .5s ease both; animation-delay: calc(var(--i, 0) * 45ms);
}
.mt-btn.active {                /* active tool = amber backlight (the one accent) */
  color: var(--amber); border-color: var(--amber); background: #20272f;
  box-shadow: inset 0 0 12px rgba(224,165,38,.28), 0 0 12px rgba(224,165,38,.45);
}
.mt-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* --- bottom command bar (the cogitator console) --- */
.map-cmdbar {
  border-radius: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(224,165,38,.05) 2px 3px);
  box-shadow: inset 0 2px 0 rgba(201,162,39,.4), 0 0 18px rgba(0,0,0,.6);
  animation: cog-fadein .45s ease both;
}
.map-cmdbar::before {           /* lit brass top cap */
  content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent); pointer-events: none;
}
.map-cmdbar .btn { border-radius: 0; }
.map-cmdbar .btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
/* unsaved counter: an amber warning lamp + reading */
.cmd-dirty:not(:empty) { display: inline-flex; align-items: center; gap: .4rem; color: var(--amber); }
.cmd-dirty:not(:empty)::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: cog-pulse 1.4s ease-in-out infinite;
}

/* --- public legend (left data-slate spine) --- */
.map-legend-dock {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(224,165,38,.04) 2px 3px),
    linear-gradient(180deg, rgba(10,13,17,.96), rgba(7,9,12,.96));
  box-shadow: inset -1px 0 0 rgba(201,162,39,.15);
  animation: cog-fadein .45s ease both;
}
.map-legend-dock::before {      /* lit brass top cap on the spine */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--brass), transparent); pointer-events: none;
}
.map-legend-dock a:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* --- signature motion --- */
@keyframes cog-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cog-powerup { 0% { opacity: 0; } 18% { opacity: .5; } 30% { opacity: .08; } 48% { opacity: .85; } 62% { opacity: .25; } 100% { opacity: 1; } }
@keyframes cog-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .map-tools, .mt-btn, .map-cmdbar, .map-legend-dock { animation: none !important; opacity: 1 !important; transform: none !important; }
  .cmd-dirty:not(:empty)::before { animation: none !important; }
}

/* =====================================================================
   Toast notifications — async save/error feedback for the map editors.
   Stacked bottom-right; brass = success, red = error.
   ===================================================================== */
.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 4000;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  min-width: 200px; max-width: 360px; padding: .6rem .9rem;
  font-family: "Share Tech Mono", monospace; font-size: .8rem; color: var(--ink);
  background: rgba(10,13,17,.96); border: 1px solid var(--brass-dim); border-left-width: 3px;
  border-radius: 2px; box-shadow: 0 4px 18px rgba(0,0,0,.6); backdrop-filter: blur(3px);
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok  { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); color: #f0c8c0; }
.toast .toast-k { color: var(--ink-dim); text-transform: uppercase; letter-spacing: .12em; font-size: .62rem; display: block; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* control-level legend gradient (public map legend dock) */
.cl-scale { margin-top: .5rem; }
.cl-bar {
  height: 8px; border-radius: 2px; border: 1px solid rgba(0,0,0,.5);
  background: linear-gradient(90deg, var(--red) 0%, var(--amber) 50%, var(--green) 100%);
}
.cl-ticks { display: flex; justify-content: space-between; font-family: "Share Tech Mono", monospace; font-size: .6rem; color: var(--ink-dim); margin-top: .15rem; }

/* legend collapse toggle — only meaningful on narrow screens */
.legend-toggle {
  display: none; position: absolute; top: 10px; left: 10px; z-index: 1001;
  background: rgba(10,13,17,.94); color: var(--brass); border: 1px solid var(--brass-dim);
  border-radius: 2px; font-size: 1.2rem; width: 38px; height: 34px; cursor: pointer;
}
@media (max-width: 640px) {
  .legend-toggle { display: block; }
  .map-legend-dock.collapsed { transform: translateX(-100%); transition: transform .22s ease; }
}

/* =====================================================================
   Compendium builder (staff/docs_edit.php) — drag-and-drop block editor.
   ===================================================================== */
.docb { position: relative; }
.docb-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.docb-bar h1 { font-size: 1.6rem; }
.docb-bar-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.docb-status { font-size: .78rem; min-width: 90px; text-align: right; }

.docb-section {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-left: 3px solid var(--brass-dim);
  padding: .9rem 1rem 1.1rem; margin: 1rem 0;
}
.docb-sec-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .7rem; flex-wrap: wrap; }
.docb-sec-title { flex: 1 1 240px; font-family: "Cinzel", serif; }
.docb-sec-tools { display: flex; gap: .4rem; align-items: center; }
.docb-sec-tools .mono { display: flex; align-items: center; gap: .3rem; font-size: .68rem; color: var(--ink-dim); }
.docb-sec-cols { width: 56px; }

.docb-cols { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.docb-section[data-cols="2"] .docb-cols { grid-template-columns: 1fr 1fr; }
.docb-section[data-cols="3"] .docb-cols { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .docb-cols, .docb-section[data-cols="2"] .docb-cols, .docb-section[data-cols="3"] .docb-cols { grid-template-columns: 1fr; } }

.docb-col {
  border: 1px dashed var(--line); border-radius: 3px; padding: .5rem; min-height: 70px;
  display: flex; flex-direction: column; gap: .5rem; transition: border-color .15s, background .15s;
}
.docb-col.drop-on { border-color: var(--brass); background: rgba(201,162,39,.06); }

.docb-block { background: var(--void); border: 1px solid var(--line); border-radius: 2px; padding: .45rem .55rem; cursor: grab; }
.docb-block.dragging { opacity: .5; }
.docb-block-head { display: flex; align-items: center; gap: .4rem; }
.docb-grip { color: var(--ink-dim); cursor: grab; letter-spacing: -3px; }
.docb-block-type { font-family: "Share Tech Mono", monospace; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--brass); flex: 1; }
.docb-block-tools { display: flex; gap: .25rem; }
.docb-block-preview { font-size: .82rem; color: var(--ink-dim); margin-top: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docb-add-block { background: none; border: 1px dashed var(--brass-dim); color: var(--brass-dim); border-radius: 2px; padding: .3rem; cursor: pointer; font-family: "Share Tech Mono", monospace; font-size: .72rem; }
.docb-add-block:hover { color: var(--brass); border-color: var(--brass); }

.docb-mini { background: none; border: 1px solid var(--line); color: var(--ink-dim); width: 24px; height: 22px; border-radius: 2px; cursor: pointer; line-height: 1; }
.docb-mini:hover { color: var(--brass); border-color: var(--brass-dim); }
.docb-mini.docb-danger:hover { color: var(--red); border-color: var(--blood); }

/* drawer */
.docb-drawer { position: fixed; inset: 0; z-index: 2500; background: rgba(4,6,9,.6); display: flex; justify-content: flex-end; }
.docb-drawer-inner { width: min(560px, 94vw); height: 100%; overflow-y: auto; background: var(--void); border-left: 1px solid var(--brass-dim); padding: 1.2rem; }
.docb-drawer-head { display: flex; align-items: center; justify-content: space-between; }
.docb-tabs { display: flex; gap: .3rem; margin: .8rem 0; }
.docb-tab { font-family: "Share Tech Mono", monospace; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; padding: .3em .8em; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; color: var(--ink-dim); background: none; }
.docb-tab.active { color: var(--brass); border-color: var(--brass-dim); }
.docb-card { border: 1px solid var(--line); border-radius: 2px; padding: .7rem; margin-bottom: .8rem; }
.docb-card-head { display: flex; gap: .4rem; align-items: center; }
.docb-rank-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.docb-members { margin: .6rem 0; }
.docb-abilities { margin-top: .4rem; display: flex; flex-direction: column; gap: .15rem; }

/* modal */
.docb-modal { position: fixed; inset: 0; z-index: 2700; background: rgba(4,6,9,.8); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.docb-modal-box { width: min(600px, 96vw); max-height: 86vh; overflow-y: auto; background: var(--void); border: 1px solid var(--brass-dim); border-radius: 3px; padding: 1.1rem; }
.docb-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }

/* build editor rows in the archetypes drawer */
.docb-build-row { border: 1px solid var(--line); border-radius: 2px; padding: .55rem; margin-top: .5rem; background: #0c1014; }
.docb-build-row .docb-card-head { gap: .4rem; }
.docb-build-row textarea { min-height: 60px; }

/* =====================================================================
   Compendium faction page — archetype browser (tier tabs + expand cards)
   ===================================================================== */
.arch-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.arch-tab {
  font-family: "Cinzel", serif; text-transform: uppercase; letter-spacing: .08em; font-size: .82rem;
  padding: .4em 1.1em; border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
  background: linear-gradient(180deg, #1d232b, #12161b); color: var(--ink-dim); transition: .15s;
}
.arch-tab:hover { color: var(--brass); border-color: var(--brass-dim); }
.arch-tab.active {
  color: #f0cf55; border-color: var(--brass);
  box-shadow: inset 0 0 12px rgba(201,162,39,.18), 0 0 10px rgba(201,162,39,.25);
  background: #20272f;
}

.arch-card {
  background: rgba(10,13,17,.6); border: 1px solid var(--line);
  border-top: 2px solid var(--accent, var(--brass)); border-radius: 2px;
  align-self: start; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.arch-card:hover {
  border-color: var(--brass-dim);
  box-shadow: inset 0 0 0 1px rgba(201,162,39,.25), 0 0 16px rgba(201,162,39,.18);
  transform: translateY(-1px);
}
.arch-card.arch-open { box-shadow: inset 0 0 0 1px rgba(201,162,39,.35), 0 0 18px rgba(201,162,39,.22); }
.arch-card-head { display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer; padding: 1rem; color: inherit; }
.arch-card-head:focus-visible { outline: 2px solid var(--brass-dim); outline-offset: -2px; }
.arch-chevron { display: inline-block; transition: transform .18s ease; }
.arch-chevron.rot { transform: rotate(90deg); }
.arch-expand { padding: 0 1rem 1rem; }
.arch-build { border-left: 2px solid var(--brass-dim); padding-left: .7rem; }

/* =====================================================================
   Table block editor (compendium builder modal)
   ===================================================================== */
.docb-tbl-edit { width: 100%; border-collapse: collapse; }
.docb-tbl-edit th, .docb-tbl-edit td { border: 1px solid var(--line); padding: 2px; }
.docb-tbl-edit input { width: 100%; min-width: 90px; box-sizing: border-box; }

/* =====================================================================
   Build calculator (staff/build_edit.php + buildcalc.js)
   ===================================================================== */
.bc-summary { position: sticky; top: .5rem; z-index: 5; }
.bc-sum-row { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.bc-sum-cell { text-align: center; }
.bc-sum-label { font-family: var(--mono, monospace); font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-dim); }
.bc-sum-val { font-size: 1.1rem; color: var(--brass); }
.bc-sum-big { font-size: 1.5rem; font-weight: 700; }
.bc-note { margin-top: .5rem; font-size: .78rem; color: var(--ink-dim); }
.bc-warn { margin-top: .4rem; font-size: .78rem; color: var(--red); }
.bc-h { font-size: 1.05rem; color: var(--brass); border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin: 1.2rem 0 .6rem; }
.bc-cols { gap: 1.5rem; }
.bc-steppers { display: flex; flex-direction: column; gap: .25rem; }
.bc-step { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: .6rem; background: var(--panel); border: 1px solid var(--line); padding: .3rem .6rem; }
.bc-step-label { color: var(--ink); }
.bc-step-base { font-size: .7rem; color: var(--ink-dim); }
.bc-step-ctl { display: inline-flex; align-items: center; gap: .4rem; }
.bc-step-val { min-width: 1.4rem; text-align: center; color: var(--brass); font-weight: 700; }
.bc-step-cost { font-size: .74rem; color: var(--tech); min-width: 3.4rem; text-align: right; }
.bc-mini { width: 1.5rem; height: 1.5rem; border: 1px solid var(--line); background: var(--panel-2); color: var(--brass); cursor: pointer; line-height: 1; }
.bc-mini:hover:not(:disabled) { border-color: var(--brass); }
.bc-mini:disabled { opacity: .35; cursor: default; }
.bc-granted { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.bc-granted-label { width: 100%; font-size: .7rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .1em; }
.bc-chip { font-size: .74rem; background: var(--panel); border: 1px solid var(--brass-dim); color: var(--brass); padding: .1rem .5rem; border-radius: 2px; }
.bc-talents { display: flex; flex-direction: column; gap: .2rem; max-height: 60vh; overflow-y: auto; }
.bc-talent { display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.bc-talent.on { border-color: var(--brass); background: var(--panel-2); }
.bc-talent-name { color: var(--ink); }
.bc-talent-meta { margin-left: auto; font-size: .72rem; color: var(--ink-dim); }
.bc-req-ok { color: var(--green); }
.bc-req-bad { color: var(--red); }
