:root {
  --bg: #0f1720;
  --bg2: #16212c;
  --panel: rgba(20, 30, 41, 0.94);
  --edge: #3a4d60;
  --text: #e9e3d3;
  --dim: #9aa3ad;
  --gold: #e8c46a;
  --teal: #5ed1c4;
  --blue: #8fb8ff;
  --purple: #c59bff;
  --font: "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); }
button { font: inherit; color: inherit; }

#map { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; display: block; cursor: grab;
  background: radial-gradient(ellipse at center, #1c2a38 0%, var(--bg) 70%); touch-action: none; user-select: none; }
#map.dragging { cursor: grabbing; }

.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }

#side { position: fixed; left: 12px; top: 12px; width: 280px; max-height: calc(100% - 24px); overflow-y: auto; padding: 12px; z-index: 5; }
.brand { font-weight: 700; font-size: 15px; color: var(--gold); margin-bottom: 10px; letter-spacing: .3px; }
.brand span { color: var(--text); font-weight: 600; }
.lbl { display: block; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin: 10px 0 4px; }
.lbl.inline { display: inline; margin: 0 0 0 4px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.note { color: var(--dim); font-size: 12px; margin-top: 10px; }

/* custom dropdown (no native <select>: the Steam overlay browser draws those badly) */
.dd { position: relative; }
.ddBtn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: var(--bg2); border: 1px solid var(--edge);
  border-radius: 6px; cursor: pointer; text-align: left; min-height: 34px; }
.ddBtn:hover { border-color: var(--gold); }
.ddBtn .cap { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ddBtn .caret { color: var(--dim); }
.ddBtn.disabled { opacity: .5; cursor: default; }
.ddList { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 20; background: #101922; border: 1px solid var(--edge);
  border-radius: 6px; max-height: 340px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.ddList input { width: calc(100% - 12px); margin: 6px; padding: 5px 7px; background: var(--bg2); color: var(--text); border: 1px solid var(--edge); border-radius: 4px; }
.ddItem { display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer; }
.ddItem:hover, .ddItem.sel { background: #24364a; }
.ddItem .sub { display: block; color: var(--dim); font-size: 11px; }
.ico { width: 24px; height: 24px; flex: none; object-fit: contain; }
.ico.none { display: inline-block; border-radius: 50%; background: #2b3b4c; }

.assimRow { display: flex; align-items: center; margin-top: 12px; }
.circle { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--gold); background: var(--bg2); color: var(--gold);
  cursor: pointer; font-weight: 700; line-height: 1; padding: 0; margin-right: 4px; }
.circle:hover { background: #2a3a4b; }
#assimList .dd { margin-top: 6px; }

#detail { position: fixed; right: 12px; top: 12px; width: 340px; max-height: calc(100% - 24px); overflow-y: auto; padding: 12px 14px; z-index: 5; }
.x { position: absolute; right: 8px; top: 6px; background: none; border: 0; color: var(--dim); font-size: 20px; cursor: pointer; }
.x:hover { color: var(--text); }
.dHead { display: flex; gap: 10px; align-items: center; margin-right: 20px; }
.dHead img { width: 48px; height: 48px; }
.dHead .nm { font-size: 16px; font-weight: 700; }
.dHead .kd { color: var(--dim); font-size: 12px; }
#detail h4 { margin: 12px 0 4px; font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: .6px; }
#detail ul { margin: 0; padding-left: 16px; }
#detail li { margin: 3px 0; }
#detail .desc { color: #cfc8b6; margin-top: 8px; }
.cond { color: var(--dim); font-size: 11px; }
.ti { height: 16px; width: 16px; vertical-align: -3px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--edge); border-radius: 12px; padding: 1px 8px 1px 3px; font-size: 12px; }
.chip img { width: 18px; height: 18px; }

#zoom { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; padding: 4px; z-index: 4; }
#zoom button { width: 34px; height: 34px; background: none; border: 0; cursor: pointer; font-size: 18px; color: var(--text); }
#zoom button:hover { color: var(--gold); }
.hint { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); color: var(--dim); font-size: 12px; pointer-events: none;
  background: rgba(15,23,32,.7); padding: 3px 10px; border-radius: 10px; white-space: nowrap; }

.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(5,10,15,.6); z-index: 30; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.menuBox { width: 860px; max-width: calc(100% - 24px); height: 640px; max-height: calc(100% - 24px); display: flex; flex-direction: column; padding: 12px; position: relative; }
.menuHead { display: flex; align-items: center; margin-right: 26px; }
#tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border: 1px solid var(--edge); border-radius: 6px 6px 0 0; background: var(--bg2); cursor: pointer; }
.tab.on { background: #2a3d52; border-color: var(--gold); color: var(--gold); }
.menuTools { display: flex; gap: 14px; align-items: center; margin: 8px 0; }
#menuSearch { flex: 1; padding: 6px 9px; background: var(--bg2); color: var(--text); border: 1px solid var(--edge); border-radius: 6px; }
#strategicBox { white-space: nowrap; cursor: pointer; }
#menuGrid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; align-content: start; }
.mItem { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; background: var(--bg2); }
.mItem:hover { border-color: var(--gold); }
.mItem img { width: 36px; height: 36px; flex: none; }
.mItem .sub { display: block; color: var(--dim); font-size: 11px; }
.mSec { grid-column: 1 / -1; color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin-top: 6px; }

/* svg */
.hex { stroke: #0b1117; stroke-width: 2; }
.node { cursor: pointer; }
.node:hover .hex { stroke: var(--gold); stroke-width: 3; }
.node.center .hex { stroke: var(--gold); stroke-width: 4; }
.lab { font: 600 11px var(--font); fill: #10161c; text-anchor: middle; pointer-events: none; }
.lab.out { fill: var(--text); }
.labBg { fill: rgba(12,18,25,.85); }
.qmark { font: 700 56px var(--font); fill: var(--gold); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.link { fill: none; stroke-width: 2.2; }
.link.bonus { stroke: var(--gold); }
.link.mod { stroke: var(--teal); }
.link.cond { stroke-dasharray: 7 5; }
.link.place { stroke: var(--blue); stroke-dasharray: 4 4; }
.link.member { stroke: var(--dim); stroke-dasharray: 2 4; stroke-width: 1.6; }
.link.repl { stroke: var(--purple); stroke-dasharray: 2 4; }
.link.r2 { opacity: .55; }
.pill rect { fill: rgba(12,18,25,.92); stroke: var(--edge); }
.pill text { font: 600 11px var(--font); fill: var(--text); dominant-baseline: central; }
.chipHex { cursor: pointer; }
.chipHex polygon { stroke: #0b1117; stroke-width: 1.5; }
.chipHex.off { opacity: .6; filter: grayscale(.85); }
.chipHex.on polygon { stroke: var(--gold); stroke-width: 2.5; }
.more { font: 700 11px var(--font); fill: var(--gold); text-anchor: middle; pointer-events: none; }

@media (max-width: 700px) {
  #side { width: calc(100% - 24px); max-height: 45%; }
  #detail { left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: 45%; }
  .hint { display: none; }
}
