/* =====================================================================
   Torn Territory Map — liquid glass UI
   ===================================================================== */

:root {
  --font: system-ui, "Segoe UI Variable Text", "Segoe UI", -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: system-ui, "Segoe UI Variable Display", "Segoe UI", -apple-system, "SF Pro Display", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-xs: 7px;
  --edge: 12px;
  --topbar-h: 52px;
  --panel-l: 336px;
  --panel-r: 372px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.34, 1.45, .5, 1);
  --left-off: calc(var(--edge) * 2 + var(--panel-l));
  --right-off: calc(var(--edge) * 2 + var(--panel-r));
  --ctrl-w: 48px;       /* map control column, which sits beside the log dock */
  --log-h: 268px;       /* live log dock height (set from JS, resizable) */
  --log-min: 50px;      /* collapsed dock: header + ticker */
  --tone-peace: #8b7cf6;
  --tone-raid: #f07b2c;
  --tone-gold: #e0a21a;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d12;
  --text-1: #f3f5f9;
  --text-2: #b8c1ce;
  --text-3: #838d9c;
  --text-4: #5f6878;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .13);
  --glass: rgba(22, 26, 35, .5);
  --glass-strong: rgba(18, 22, 30, .8);
  --tint: linear-gradient(150deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .035) 38%, rgba(255, 255, 255, .015) 62%, rgba(255, 255, 255, .06));
  --rim: linear-gradient(155deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .12) 24%, rgba(255, 255, 255, .03) 52%, rgba(255, 255, 255, .08) 78%, rgba(255, 255, 255, .3));
  --shine: radial-gradient(120% 70% at 12% -18%, rgba(255, 255, 255, .13), transparent 52%);
  --shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 12px 32px -10px rgba(0, 0, 0, .6), 0 34px 70px -28px rgba(0, 0, 0, .55);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -1px 0 rgba(255, 255, 255, .035);
  --hover: rgba(255, 255, 255, .065);
  --press: rgba(255, 255, 255, .11);
  --accent: #5aa2ff;
  --accent-strong: #3987e5;
  --accent-soft: rgba(90, 162, 255, .18);
  --accent-ink: #ffffff;
  --field: rgba(255, 255, 255, .055);
  --field-hover: rgba(255, 255, 255, .08);
  --field-focus: rgba(255, 255, 255, .1);
  --thumb: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .07));
  --thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -1px 0 rgba(255, 255, 255, .06), 0 2px 8px rgba(0, 0, 0, .35);
  --scroll: rgba(255, 255, 255, .16);
  --good: #3ccf74;
  --warn: #fab219;
  --bad: #e5484d;
  --vignette: radial-gradient(130% 95% at 50% 45%, transparent 55%, rgba(0, 0, 0, .55));
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #e9edf2;
  --text-1: #0b1019;
  --text-2: #3b4454;
  --text-3: #667083;
  --text-4: #8c95a5;
  --line: rgba(10, 20, 40, .07);
  --line-2: rgba(10, 20, 40, .13);
  --glass: rgba(255, 255, 255, .5);
  --glass-strong: rgba(250, 251, 253, .84);
  --tint: linear-gradient(150deg, rgba(255, 255, 255, .75), rgba(255, 255, 255, .28) 42%, rgba(255, 255, 255, .12) 62%, rgba(255, 255, 255, .5));
  --rim: linear-gradient(155deg, #fff, rgba(255, 255, 255, .55) 26%, rgba(255, 255, 255, .15) 55%, rgba(255, 255, 255, .4) 80%, rgba(255, 255, 255, .9));
  --shine: radial-gradient(120% 70% at 12% -18%, rgba(255, 255, 255, .7), transparent 55%);
  --shadow: 0 1px 1px rgba(10, 20, 40, .05), 0 12px 30px -12px rgba(10, 25, 50, .28), 0 34px 70px -30px rgba(10, 25, 50, .3);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .35);
  --hover: rgba(10, 25, 50, .05);
  --press: rgba(10, 25, 50, .09);
  --accent: #2a78d6;
  --accent-strong: #1c5cab;
  --accent-soft: rgba(42, 120, 214, .14);
  --accent-ink: #ffffff;
  --field: rgba(10, 25, 50, .045);
  --field-hover: rgba(10, 25, 50, .065);
  --field-focus: rgba(255, 255, 255, .85);
  --thumb: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 255, 255, .72));
  --thumb-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(10, 25, 50, .12), 0 4px 12px -2px rgba(10, 25, 50, .18);
  --scroll: rgba(10, 25, 50, .2);
  --good: #0c8a3c;
  --warn: #b77900;
  --bad: #d03b3b;
  --vignette: radial-gradient(130% 95% at 50% 45%, transparent 60%, rgba(30, 45, 70, .16));
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text-1);
  font: 13px/1.42 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd, .kbd {
  font: 600 10.5px/1 var(--font);
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--text-3);
  background: var(--field);
  box-shadow: inset 0 -1px 0 var(--line-2), inset 0 0 0 1px var(--line);
}
code { font: 12px var(--mono); padding: 1px 5px; border-radius: 5px; background: var(--field); }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- glass */
.glass, .glass-strong {
  position: relative;
  isolation: isolate;
  background: var(--shine), var(--tint), var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  backdrop-filter: blur(22px) saturate(185%);
  border-radius: var(--r-lg);
  box-shadow: var(--inner), var(--shadow);
}
.glass-strong {
  background: var(--shine), var(--tint), var(--glass-strong);
  -webkit-backdrop-filter: blur(34px) saturate(170%);
  backdrop-filter: blur(34px) saturate(170%);
}
.glass::before, .glass-strong::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
/* Chromium: genuine lens-like refraction along the rim of small floating controls */
html.refraction .liquid {
  -webkit-backdrop-filter: blur(2.5px) saturate(185%) var(--lg-filter, );
  backdrop-filter: blur(2.5px) saturate(185%) var(--lg-filter, );
}

/* ---------------------------------------------------------------- map */
.map-root { position: fixed; inset: 0; overflow: hidden; }
.map-root canvas { display: block; touch-action: none; cursor: grab; }
.map-root.grabbing canvas { cursor: grabbing; }
.map-vignette { position: absolute; inset: 0; pointer-events: none; background: var(--vignette); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed;
  top: var(--edge);
  left: var(--edge);
  right: var(--edge);
  height: var(--topbar-h);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.bar-cluster {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--topbar-h);
  padding: 0 7px;
  border-radius: 999px;
}
.bar-right { margin-left: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 0 6px; user-select: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(140deg, #63a4ff, #9085e9 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 4px rgba(0, 0, 0, .12), 0 4px 12px -2px rgba(90, 130, 255, .55);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-text { font: 700 15px/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.brand-text span { font-weight: 450; color: var(--text-2); margin-left: 3px; }

.bar-search {
  flex: 1 1 260px;
  min-width: 180px;
  max-width: 440px;
  height: var(--topbar-h);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px 0 17px;
}
.bar-search .search-ico { color: var(--text-3); }
.bar-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13.5px;
}
.bar-search input::placeholder { color: var(--text-3); }
.bar-search input::-webkit-search-cancel-button { display: none; }
.bar-search:focus-within { box-shadow: var(--inner), var(--shadow), 0 0 0 2px var(--accent-soft); }
.bar-search:focus-within .kbd { opacity: 0; }

.search-results {
  position: fixed;
  max-height: min(60vh, 480px);
  overflow: auto;
  padding: 6px;
  border-radius: var(--r-lg);
  z-index: 45;
  animation: pop-in .3s var(--spring);
  transform-origin: top center;
}
.sr-group { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.sr-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  text-align: left;
}
.sr-item:hover, .sr-item[aria-selected="true"] { background: var(--hover); }
.sr-item .sr-main { flex: 1; min-width: 0; }
.sr-item .sr-title { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item .sr-sub { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item .f-avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 10px; }
.sr-item > .dotc { margin: 0 11px 0 11px; }
.sr-item .sr-right { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12px; }
.sr-empty { padding: 18px; text-align: center; color: var(--text-3); }

.bar-modes { height: var(--topbar-h); padding: 0 6px; border-radius: 999px; display: flex; align-items: center; }

/* ---------------------------------------------------------------- segmented control */
.seg { position: relative; display: flex; align-items: center; gap: 2px; }
.seg button {
  position: relative;
  z-index: 1;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  transition: color .25s var(--ease);
}
.seg button svg { width: 16px; height: 16px; }
.seg button:hover { color: var(--text-1); }
.seg button[aria-checked="true"] { color: var(--text-1); }
.seg-thumb {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  height: 38px;
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
  transition: transform .5s var(--spring), width .5s var(--spring);
  pointer-events: none;
}
.seg-thumb::after {
  content: "";
  position: absolute;
  inset: 1px 8% auto;
  height: 45%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent);
  pointer-events: none;
}
.seg.no-anim .seg-thumb { transition: none; }
.seg-sm button { height: 30px; padding: 0 12px; font-size: 12px; }
.seg-sm .seg-thumb { height: 30px; }
.seg-sm { padding: 3px; border-radius: 999px; background: var(--field); }
.seg-sm .seg-thumb { top: 3px; }

/* ---------------------------------------------------------------- buttons */
.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background .2s var(--ease), color .2s var(--ease), transform .18s var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text-1); }
.icon-btn:active { transform: scale(.92); background: var(--press); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.ghost { color: var(--text-3); }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[data-theme="dark"] .when-light, [data-theme="light"] .when-dark { display: none; }

.btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-1);
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { background: var(--field-hover); }
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, #6aaeff, #3987e5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 6px 18px -6px rgba(57, 135, 229, .7);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.live-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px 0 11px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
  transition: background .2s;
}
.live-chip:hover { background: var(--field-hover); color: var(--text-1); }
.live-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); flex: none; }
.live-chip.live .dot { background: var(--good); box-shadow: 0 0 0 0 rgba(60, 207, 116, .6); animation: pulse 2.4s infinite; }
.live-chip.busy .dot { background: var(--accent); animation: pulse-blue 1.2s infinite; }
.live-chip.stale .dot { background: var(--warn); }
.live-chip.error .dot { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(60, 207, 116, .55); } 70% { box-shadow: 0 0 0 7px rgba(60, 207, 116, 0); } 100% { box-shadow: 0 0 0 0 rgba(60, 207, 116, 0); } }
@keyframes pulse-blue { 0% { box-shadow: 0 0 0 0 rgba(90, 162, 255, .6); } 70% { box-shadow: 0 0 0 7px rgba(90, 162, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(90, 162, 255, 0); } }

/* ---------------------------------------------------------------- panels */
.panel {
  position: fixed;
  top: calc(var(--edge) + var(--topbar-h) + 10px);
  bottom: var(--edge);
  z-index: 20;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: transform .55s var(--spring), opacity .35s var(--ease);
  will-change: transform;
}
.panel-left { left: var(--edge); width: var(--panel-l); }
.panel-right { right: var(--edge); width: var(--panel-r); }
body:not(.show-left) .panel-left { transform: translateX(calc(-100% - var(--edge) * 2)) scale(.98); opacity: 0; pointer-events: none; }
body:not(.show-right) .panel-right { transform: translateX(calc(100% + var(--edge) * 2)) scale(.98); opacity: 0; pointer-events: none; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; animation: view-in .38s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 8px 18px;
}
.panel-title { display: flex; align-items: center; gap: 9px; }
.panel-title h2 { margin: 0; font: 700 17px/1.2 var(--font-display); letter-spacing: -.015em; }
.count-pill {
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--field);
  font-variant-numeric: tabular-nums;
}

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 2px 14px 10px; }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
}
.kpi-v { font: 700 17px/1.15 var(--font-display); letter-spacing: -.01em; }
.kpi-l { font-size: 11px; color: var(--text-3); font-weight: 600; }
.kpi.bad .kpi-v { color: var(--bad); }

.tools-row { display: flex; align-items: center; gap: 6px; padding: 4px 14px 10px; }
.field {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, box-shadow .2s;
}
.field:hover { background: var(--field-hover); }
.field:focus-within { background: var(--field-focus); box-shadow: inset 0 0 0 1px var(--line-2), 0 0 0 3px var(--accent-soft); }
.field svg { width: 15px; height: 15px; color: var(--text-3); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12.5px; }
.field input::placeholder { color: var(--text-3); }
.field.mono input { font-family: var(--mono); letter-spacing: .02em; }
.grow { flex: 1; min-width: 0; }

.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  padding: 0 28px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  outline: none;
}
.select-wrap select:hover { background: var(--field-hover); color: var(--text-1); }
.select-wrap select:focus-visible { box-shadow: inset 0 0 0 1px var(--line-2), 0 0 0 3px var(--accent-soft); }
.select-wrap select option { background: var(--glass-strong); color: var(--text-1); }
[data-theme="dark"] .select-wrap select option { background: #1b2029; }
.select-wrap svg { position: absolute; right: 9px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }

.list-scroll { flex: 1; min-height: 0; overflow: auto; padding: 2px 8px 12px; scrollbar-gutter: stable; }
.list-meta { padding: 0 18px 6px; font-size: 11.5px; color: var(--text-3); display: flex; justify-content: space-between; gap: 8px; }
.list-meta b { color: var(--text-2); font-weight: 650; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-4); }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }

/* faction rows */
.frow {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 15px;
  text-align: left;
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.frow:hover { background: var(--hover); }
.frow:active { transform: scale(.985); }
.frow.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--line-2); }
.f-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font: 750 11px/1 var(--font);
  letter-spacing: -.01em;
  color: var(--ink, #fff);
  background: var(--fc, #777);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), inset 0 -2px 5px rgba(0, 0, 0, .16), 0 3px 10px -3px var(--fc, #000);
  overflow: hidden;
}
.f-avatar::after { content: ""; position: absolute; inset: 0 0 50%; background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent); }
.f-avatar.me { outline: 2px solid var(--text-1); outline-offset: 2px; }
.f-main { min-width: 0; }
.f-name { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13px; }
.f-name .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-name img { height: 14px; max-width: 54px; border-radius: 3px; flex: none; }
.f-name .loading { color: var(--text-3); font-weight: 550; }
.f-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.f-sub .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-4); }
.f-sub .hot { color: var(--bad); font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.f-sub .hot svg { width: 12px; height: 12px; }
.f-stat { text-align: right; font-variant-numeric: tabular-nums; }
.f-stat b { display: block; font-weight: 700; font-size: 13.5px; }
.f-stat span { font-size: 11px; color: var(--text-3); }
.f-share { grid-column: 2 / 4; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: -2px; }
.f-share i { display: block; height: 100%; border-radius: 3px; background: var(--fc); opacity: .85; }
.badge-me {
  font-size: 9.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; color: var(--accent-ink); background: var(--accent-strong); flex: none;
}

.skeleton { position: relative; overflow: hidden; color: transparent !important; border-radius: 6px; background: var(--field); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 26px 28px 40px; }
.empty h3 { margin: 6px 0 0; font: 700 16px/1.25 var(--font-display); }
.empty p { margin: 0 0 10px; color: var(--text-2); font-size: 12.5px; max-width: 260px; }
.empty-art {
  width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #63a4ff, #9085e9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 12px 30px -10px rgba(99, 130, 255, .7);
}
.empty-art svg { width: 28px; height: 28px; }
.empty.small { flex: none; padding: 28px 20px; }
.empty.small p { margin: 0; }

/* tabs */
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--field); position: relative; }
.tabs button {
  position: relative;
  z-index: 1;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .2s;
}
.tabs button[aria-selected="true"] { color: var(--text-1); }
.tabs .seg-thumb { top: 3px; height: 30px; }
.tab-badge:empty { display: none; }
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 750; color: var(--text-2); background: var(--line-2); font-variant-numeric: tabular-nums;
}
.tab-badge.hot { color: #fff; background: var(--bad); }
.tab-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.filter-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--glass-strong); }

.filters { display: flex; flex-direction: column; gap: 10px; margin: 0 14px 10px; padding: 12px; border-radius: var(--r-md); background: var(--field); box-shadow: inset 0 0 0 1px var(--line); animation: view-in .3s var(--ease); }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.fg-label { font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-2);
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background .18s, color .18s, box-shadow .18s, transform .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { background: var(--field-hover); color: var(--text-1); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { color: var(--text-1); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.chip .sw { width: 9px; height: 9px; border-radius: 3px; background: var(--sw); }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 2px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 12.5px; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: var(--line-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
  transition: background .25s var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #e8ecf2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform .4s var(--spring);
}
.switch input:checked + .track { background: var(--accent-strong); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* virtual territory list */
.vlist { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 0 8px; outline: none; scrollbar-gutter: stable; }
.vspacer { position: relative; width: 100%; }
.trow {
  position: absolute;
  left: 0;
  right: 0;
  height: 54px;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 0 12px 0 10px;
  border-radius: 14px;
  text-align: left;
  transition: background .15s var(--ease);
}
.trow:hover { background: var(--hover); }
.trow.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--line-2); }
.trow .bar { width: 4px; height: 32px; border-radius: 4px; background: var(--fc, var(--line-2)); box-shadow: 0 0 10px -2px var(--fc, transparent); }
.trow .bar.free { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.t-main { min-width: 0; }
.t-top { display: flex; align-items: center; gap: 7px; }
.t-code { font: 700 13.5px/1.2 var(--font-display); letter-spacing: .02em; }
.t-tags { display: flex; gap: 4px; }
.t-tag {
  height: 17px; padding: 0 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: .02em; color: var(--text-2); background: var(--field); box-shadow: inset 0 0 0 1px var(--line);
}
.t-tag svg { width: 11px; height: 11px; }
.t-tag.racket { color: #fff; background: var(--rc, var(--accent-strong)); box-shadow: none; }
.t-tag.war { color: #fff; background: var(--bad); box-shadow: none; }
.t-tag.irr { color: #2b1d00; background: var(--warn); box-shadow: none; }
.t-tag.lm { color: var(--text-2); }
.t-sub { margin-top: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub b { color: var(--text-2); font-weight: 600; }
.t-resp { text-align: right; font-variant-numeric: tabular-nums; }
.t-resp b { display: block; font-weight: 750; font-size: 14px; }
.t-resp span { font-size: 10.5px; color: var(--text-3); }

.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.foot-note { font-size: 11px; color: var(--text-3); text-align: right; }

/* racket + war cards */
.card-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 12px 13px;
  margin-bottom: 7px;
  border-radius: 16px;
  text-align: left;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background .18s, transform .18s var(--ease);
}
.card-row:hover { background: var(--field-hover); }
.card-row:active { transform: scale(.985); }
.card-row.active { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.cr-top { display: flex; align-items: center; gap: 10px; }
.cr-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--rc, var(--accent-strong)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); flex: none; }
.cr-ico svg { width: 17px; height: 17px; }
.cr-ico.war { background: var(--bad); }
.cr-title { flex: 1; min-width: 0; }
.cr-title b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-title span { font-size: 11.5px; color: var(--text-3); }
.cr-level { display: flex; gap: 2px; }
.cr-level i { width: 6px; height: 14px; border-radius: 2px; background: var(--line-2); }
.cr-level i.on { background: var(--rc, var(--accent)); }
.cr-reward { font-weight: 650; color: var(--text-1); }
.cr-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.cr-meta .owner { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.cr-meta .owner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dotc { width: 8px; height: 8px; border-radius: 50%; background: var(--fc); flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--fc) 25%, transparent); }

.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.vs .side { min-width: 0; }
.vs .side b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.vs .side span { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.vs .side.r { text-align: right; }
.vs .mid { font-size: 10px; font-weight: 800; color: var(--text-3); letter-spacing: .08em; }
.warbar { position: relative; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.warbar .agg { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ff7a7e, #e5484d); border-radius: 8px; }
.warbar .tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text-1); opacity: .5; }
.war-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.war-foot b { color: var(--text-2); }

/* ---------------------------------------------------------------- inspector / detail views */
.detail-head { display: flex; align-items: center; gap: 4px; padding: 12px 10px 4px 8px; }
.detail-head .spacer { flex: 1; }
.detail-scroll { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 18px; }
.hero { display: flex; align-items: flex-start; gap: 14px; padding: 4px 2px 14px; }
.hero-code { font: 750 34px/1 var(--font-display); letter-spacing: -.01em; }
.hero-sub { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.hero-badge {
  height: 22px; padding: 0 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--field); box-shadow: inset 0 0 0 1px var(--line);
}
.hero-badge svg { width: 12px; height: 12px; }
.hero-badge.war { color: #fff; background: var(--bad); box-shadow: none; }
.hero-badge.irr { color: #2b1d00; background: var(--warn); box-shadow: none; }
.hero-badge.racket { color: #fff; background: var(--rc, var(--accent-strong)); box-shadow: none; }
.hero-respect { margin-left: auto; text-align: right; }
.hero-respect b { display: block; font: 750 28px/1 var(--font-display); letter-spacing: -.02em; }
.hero-respect span { font-size: 11px; color: var(--text-3); font-weight: 600; }

.section { margin-top: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 7px; font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.box { padding: 12px 13px; border-radius: 16px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.owner-box { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; transition: background .18s; }
button.owner-box:hover { background: var(--field-hover); }
.owner-box .f-avatar { width: 40px; height: 40px; border-radius: 13px; font-size: 12px; }
.owner-box .ob-main { flex: 1; min-width: 0; }
.owner-box .ob-main b { display: block; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-box .ob-main span { font-size: 11.5px; color: var(--text-3); }
.owner-box > svg { color: var(--text-3); }
.unclaimed { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.unclaimed .ring { width: 40px; height: 40px; border-radius: 13px; box-shadow: inset 0 0 0 1.5px var(--line-2); display: grid; place-items: center; color: var(--text-3); }

.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.formula .term { display: inline-flex; flex-direction: column; align-items: center; padding: 6px 9px; border-radius: 11px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); min-width: 48px; }
.formula .term b { font-weight: 750; font-size: 13px; }
.formula .term span { font-size: 9.5px; color: var(--text-3); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.formula .op { color: var(--text-3); font-weight: 700; }
.formula .term.total { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.stat { padding: 10px 12px; border-radius: 14px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.stat .l { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--text-3); text-transform: uppercase; }
.stat .v { margin-top: 3px; font-weight: 700; font-size: 14px; display: flex; align-items: baseline; gap: 6px; }
.stat .v small { font-size: 11px; color: var(--text-3); font-weight: 650; }
.stat .meter { display: flex; gap: 3px; margin-top: 7px; }
.stat .meter i { flex: 1; height: 4px; border-radius: 3px; background: var(--line-2); }
.stat .meter i.on { background: var(--accent); }

.racket-box { display: flex; gap: 12px; align-items: flex-start; }
.racket-box .cr-ico { width: 40px; height: 40px; border-radius: 13px; }
.racket-box b { display: block; font-size: 14px; font-weight: 700; }
.racket-box .rw { margin-top: 2px; font-weight: 650; color: var(--text-1); }
.racket-box .meta { margin-top: 4px; font-size: 11.5px; color: var(--text-3); }

.nb-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.nb-chip {
  height: 26px; padding: 0 9px 0 7px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  font: 700 11.5px/1 var(--font); letter-spacing: .02em; color: var(--text-2); background: var(--field); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .15s, color .15s, transform .15s;
}
.nb-chip:hover { background: var(--field-hover); color: var(--text-1); }
.nb-chip:active { transform: scale(.95); }
.nb-chip .dotc { width: 7px; height: 7px; }
.nb-chip .dotc.free { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-4); }

.actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.muted { color: var(--text-3); }
.small { font-size: 11.5px; }

.fd-hero { display: flex; gap: 14px; align-items: center; padding: 4px 2px 12px; }
.fd-hero .f-avatar { width: 54px; height: 54px; border-radius: 17px; font-size: 15px; }
.fd-hero h3 { margin: 0; font: 750 20px/1.15 var(--font-display); letter-spacing: -.015em; overflow-wrap: anywhere; }
.fd-hero .sub { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.fd-hero .sub img { height: 16px; border-radius: 3px; }
.color-btn { position: relative; width: 26px; height: 26px; border-radius: 9px; background: var(--fc); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 0 0 1px var(--line-2); overflow: hidden; }
.color-btn input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.tlist { display: flex; flex-direction: column; gap: 2px; }
.tlist .trow { position: relative; height: 48px; }

/* ---------------------------------------------------------------- floating map UI */
body { --lo: var(--edge); --ro: var(--edge); --log-space: var(--log-h); }
body.show-left { --lo: var(--left-off); }
body.show-right { --ro: var(--right-off); }
body.log-collapsed { --log-space: var(--log-min); }

.map-controls {
  position: fixed;
  right: var(--ro);
  bottom: var(--edge);
  z-index: 21; /* the layers pop-up opens over the log dock */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  transition: right .55s var(--spring), opacity .3s;
}
.ctrl-stack { display: flex; flex-direction: column; align-items: center; padding: 4px; border-radius: 999px; }
.ctrl-stack .icon-btn { width: 40px; height: 40px; }
.ctrl-sep { width: 20px; height: 1px; background: var(--line-2); margin: 1px 0; }
.layers-pop {
  position: absolute;
  right: calc(100% + 10px);
  bottom: 0;
  width: 250px;
  padding: 14px 16px 16px;
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 11px;
  animation: pop-in .35s var(--spring);
  transform-origin: right bottom;
}
.layers-pop h4 { margin: 0 0 2px; font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
@keyframes pop-in { from { opacity: 0; transform: scale(.92) translateY(6px); } }

.legend {
  position: fixed;
  left: var(--lo);
  bottom: calc(var(--edge) + var(--log-space) + 10px);
  z-index: 18;
  max-width: min(340px, calc(100vw - var(--lo) - var(--ro) - 70px));
  padding: 12px 14px 13px;
  border-radius: var(--r-lg);
  transition: left .55s var(--spring), bottom .45s var(--spring), opacity .3s;
}
@media (max-width: 1180px) {
  body.show-left.show-right .legend { opacity: 0; pointer-events: none; }
}
.lg-head {
  display: flex; align-items: center; gap: 7px; width: 100%; margin: 0 0 8px;
  font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3);
}
.lg-head:hover { color: var(--text-1); }
.lg-head svg { width: 13px; height: 13px; }
.lg-head .lg-chev { margin-left: auto; transition: transform .3s var(--ease); }
.legend.collapsed { padding-bottom: 12px; }
.legend.collapsed .lg-head { margin: 0; }
.legend.collapsed .lg-chev { transform: rotate(180deg); }
.legend.collapsed .lg-body { display: none; }
.lg-items { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.lg-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); font-weight: 550; white-space: nowrap; }
.lg-sw { width: 14px; height: 10px; border-radius: 3px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); flex: none; }
.lg-sw.outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-4); }
.lg-sw.war { background: repeating-linear-gradient(90deg, var(--bad) 0 5px, transparent 5px 8px); box-shadow: none; height: 3px; border-radius: 2px; }
.lg-sw.hatch { background: repeating-linear-gradient(135deg, #fab219 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px rgba(250, 178, 25, .5); }
.lg-sw.dot { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff inset, 0 0 0 0 transparent; }
.lg-sw.dot.neutral { background: #f4f6fa; box-shadow: 0 0 0 1.5px rgba(10, 15, 25, .55); }
.lg-sw.landmark { background: repeating-linear-gradient(135deg, rgba(160, 170, 190, .55) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px rgba(160, 170, 190, .45); }
.lg-ramp { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.lg-ramp i { height: 10px; border-radius: 3px; background: var(--sw); }
.lg-ramp-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; margin-top: 5px; }
.lg-ramp-labels span { font-size: 10.5px; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-note { margin-top: 8px; font-size: 11px; color: var(--text-3); line-height: 1.35; }

.zoom-readout {
  position: fixed;
  bottom: calc(var(--edge) + var(--log-space) + 12px);
  right: calc(var(--ro) + 56px);
  z-index: 17;
  padding: 4px 9px;
  border-radius: 999px;
  font: 700 11px/1 var(--font);
  color: var(--text-2);
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0;
  transition: opacity .4s, right .55s var(--spring);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.zoom-readout.on { opacity: 1; transition: opacity .1s, right .55s var(--spring); }

/* tooltip */
.tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: 250px;
  padding: 12px 13px 12px;
  border-radius: 18px;
  pointer-events: none;
  will-change: transform;
}
.tt-head { display: flex; align-items: center; gap: 8px; }
.tt-code { font: 750 16px/1 var(--font-display); letter-spacing: .01em; }
.tt-head .hero-badge { height: 19px; font-size: 10px; padding: 0 7px; }
.tt-resp { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.tt-resp b { font: 750 15px/1 var(--font-display); }
.tt-resp span { font-size: 10px; color: var(--text-3); margin-left: 2px; }
.tt-owner { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-weight: 650; min-width: 0; }
.tt-owner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-owner.free { color: var(--text-3); font-weight: 550; }
.tt-owner .dotc.free { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-4); }
.tt-grid { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 2px 10px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.tt-grid div { display: flex; flex-direction: column; }
.tt-grid span { font-size: 9.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.tt-grid b { font-size: 12px; font-weight: 700; }
.tt-extra { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.tt-extra .r { display: flex; align-items: center; gap: 6px; }
.tt-extra svg { width: 13px; height: 13px; flex: none; }
.tt-extra .warc { color: var(--bad); }
.tt-hint { margin-top: 8px; font-size: 10.5px; color: var(--text-4); }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: calc(var(--edge) + var(--log-space) + 14px); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 520px);
  padding: 11px 16px 11px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  animation: toast-in .5s var(--spring);
}
.toast svg { width: 17px; height: 17px; }
.toast.err svg { color: var(--bad); }
.toast.ok svg { color: var(--good); }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* settings dialog */
.dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  color: var(--text-1);
  overflow: hidden;
}
.dialog[open] { animation: dialog-in .45s var(--spring); }
.dialog::backdrop { background: rgba(4, 7, 12, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in .3s; }
[data-theme="light"] .dialog::backdrop { background: rgba(30, 45, 70, .22); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100vh - 40px); overflow: auto; padding: 8px 22px 22px; }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; }
.dialog-head h2 { margin: 0; font: 750 20px/1.2 var(--font-display); letter-spacing: -.015em; }
.set-section { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 11px; }
.set-section:first-of-type { border-top: 0; }
.set-section h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.set-section h3 svg { width: 16px; height: 16px; color: var(--accent); }
.hint { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.hint.small { font-size: 11.5px; color: var(--text-3); }
.key-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-2); }
.tos { font-size: 12px; color: var(--text-2); }
.tos summary { cursor: pointer; color: var(--text-3); font-weight: 650; width: fit-content; }
.tos summary:hover { color: var(--text-1); }
.tos table { width: 100%; margin: 8px 0 6px; border-collapse: collapse; }
.tos th, .tos td { padding: 5px 8px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.tos th { width: 38%; font-weight: 650; color: var(--text-3); }

/* ---------------------------------------------------------------- live log dock */
.log-dock {
  position: fixed;
  left: var(--lo);
  right: calc(var(--ro) + var(--ctrl-w) + 10px);
  bottom: var(--edge);
  height: var(--log-space);
  z-index: 19;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl);
  overflow: hidden;
  container: log / inline-size;
  transition: left .55s var(--spring), right .55s var(--spring), height .45s var(--spring), opacity .3s, transform .45s var(--spring);
}
.log-dock.resizing { transition: none; }
.log-grip { position: absolute; z-index: 3; top: 0; left: 24px; right: 24px; height: 9px; cursor: ns-resize; }
.log-grip::after {
  content: ""; position: absolute; top: 4px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px;
  background: var(--line-2); opacity: 0; transition: opacity .2s;
}
.log-dock:hover .log-grip::after, .log-dock.resizing .log-grip::after { opacity: 1; }

.log-head { display: flex; align-items: center; gap: 10px; height: var(--log-min); flex: none; padding: 0 12px 0 9px; }
.log-title {
  display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 9px 0 10px; border-radius: 999px; flex: none;
  font: 700 14px/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; transition: background .2s;
}
.log-title:hover { background: var(--hover); }
.log-live { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--text-4); flex: none; }
.log-dock[data-state="live"] .log-live { background: var(--good); animation: pulse 2.4s infinite; }
.log-dock[data-state="warn"] .log-live { background: var(--warn); }
.log-dock[data-state="err"] .log-live { background: var(--bad); }
.log-unread {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  font: 800 10.5px/1 var(--font); color: #fff; background: var(--accent-strong); font-variant-numeric: tabular-nums;
  animation: pop-in .35s var(--spring);
}
.log-chev { width: 15px; height: 15px; color: var(--text-3); transition: transform .35s var(--ease); }
body.log-collapsed .log-chev { transform: rotate(180deg); }
.log-filters { flex: none; flex-wrap: nowrap; }
.log-filters .chip { height: 28px; }
.log-search { width: 190px; height: 32px; flex: 0 1 190px; }
.log-status { margin-left: auto; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-dock[data-state="err"] .log-status { color: var(--bad); }
.log-dock[data-state="warn"] .log-status { color: var(--warn); }

/* collapsed: one line with the newest event */
.log-ticker { display: none; flex: 1; min-width: 0; align-items: center; gap: 9px; height: 34px; padding: 0 10px; border-radius: 12px; cursor: pointer; }
.log-ticker:hover { background: var(--hover); }
body.log-collapsed .log-ticker { display: flex; }
body.log-collapsed .log-filters, body.log-collapsed .log-search, body.log-collapsed .log-body { display: none; }
body.log-collapsed .log-status { flex: none; max-width: 30%; margin-left: 0; }
.tk-ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--tone); flex: none; }
.tk-ico svg { width: 13px; height: 13px; }
.tk-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-size: 12.5px; }
.tk-text.muted { color: var(--text-3); }
.tk-label { color: var(--tone-ink); font-weight: 750; margin-right: 3px; }
.tk-ago { flex: none; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }

.log-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
.log-feed { position: relative; min-height: 0; display: flex; }
.log-list { flex: 1; min-height: 0; overflow: auto; padding: 0 6px 10px 4px; scrollbar-gutter: stable; overscroll-behavior: contain; }
.log-now { display: none; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
@container log (min-width: 860px) {
  .log-body { grid-template-columns: minmax(0, 1fr) clamp(272px, 31%, 390px); }
  .log-now { display: flex; }
}
@container log (max-width: 700px) { .log-search { display: none; } }
@container log (max-width: 520px) { .log-filters { display: none; } }
@container log (max-width: 380px) { .log-status { display: none; } }
.log-newpill {
  position: absolute; top: 10px; left: 50%; z-index: 4; transform: translateX(-50%); height: 28px; padding: 0 13px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--accent-strong); box-shadow: 0 6px 18px -6px rgba(57, 135, 229, .8);
  animation: pop-in .35s var(--spring);
}

/* event tones */
.tone-good { --tone: #2fb866; --tone-ink: var(--good); }
.tone-bad { --tone: #e5484d; --tone-ink: #ff6b70; }
.tone-info { --tone: #3987e5; --tone-ink: var(--accent); }
.tone-peace { --tone: var(--tone-peace); --tone-ink: #a99dff; }
.tone-raid { --tone: var(--tone-raid); --tone-ink: #ff9b5c; }
.tone-gold { --tone: var(--tone-gold); --tone-ink: #f2bd45; }
.tone-warn { --tone: #e8a50f; --tone-ink: var(--warn); }
.tone-muted { --tone: #6c7686; --tone-ink: var(--text-3); }
[data-theme="light"] .tone-bad { --tone-ink: #c93439; }
[data-theme="light"] .tone-peace { --tone-ink: #6650e0; }
[data-theme="light"] .tone-raid { --tone-ink: #c2560f; }
[data-theme="light"] .tone-gold { --tone-ink: #9a6a00; }

/* rows: a timeline of icon badges */
.lg-day { position: sticky; top: 0; z-index: 3; padding: 8px 0 5px 52px; pointer-events: none; }
.lg-day span {
  display: inline-block; padding: 4px 10px 4px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2);
  background: var(--glass-strong); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 4px 12px -4px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .lg-day span { background: #161b24; }
.lg-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px 30px minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  padding: 6px 10px 6px 2px;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
  transition: background .18s var(--ease);
}
.lg-row:hover { background: var(--hover); }
.lg-row:focus-visible { background: var(--hover); box-shadow: inset 0 0 0 2px var(--accent-soft); }
.lg-row::before { /* the thread joining one badge to the next */
  content: ""; position: absolute; left: 70px; top: 38px; bottom: -6px; width: 2px; border-radius: 2px; background: var(--line);
}
.lg-row:has(+ .lg-day)::before, .lg-row:has(+ .lg-end)::before, .lg-row:last-child::before { display: none; }
.lg-time { padding-top: 8px; text-align: right; font: 600 11.5px/1.25 var(--font); font-variant-numeric: tabular-nums; color: var(--text-3); white-space: nowrap; }
.lg-ico {
  position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 80%, #fff), var(--tone) 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 5px 14px -5px var(--tone), 0 0 0 3px var(--glass-strong);
}
.lg-ico svg { width: 16px; height: 16px; stroke-width: 2; }
.lg-main { min-width: 0; padding: 2px 0 2px; }
.lg-top { display: flex; align-items: baseline; gap: 8px; }
.lg-label { font-size: 10.5px; font-weight: 800; letter-spacing: .065em; text-transform: uppercase; color: var(--tone-ink); }
.lg-ago { margin-left: auto; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-text { margin-top: 2px; font-size: 13px; line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
.lg-text b { color: var(--text-1); font-weight: 650; }
.lg-fac { display: inline; font-weight: 700; color: var(--text-1); text-decoration: none; border-radius: 4px; }
.lg-fac i { display: inline-block; width: 8px; height: 8px; margin: 0 5px 1px 1px; border-radius: 3px; background: var(--fc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--fc) 25%, transparent); vertical-align: middle; }
.lg-fac:hover { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--fc) 70%, transparent); text-underline-offset: 3px; }
.lg-fac.unknown { color: var(--text-3); font-weight: 600; }
.lg-terr {
  display: inline-flex; align-items: center; height: 21px; padding: 0 7px 0 8px; margin: 1px 0; border-radius: 7px; vertical-align: 1px;
  font: 700 11.5px/1 var(--mono); letter-spacing: .03em; color: var(--text-1);
  background: var(--field); box-shadow: inset 0 0 0 1px var(--line-2), inset 3px 0 0 var(--fc, var(--line-2));
  transition: background .15s, transform .15s;
}
.lg-terr:hover { background: var(--field-hover); box-shadow: inset 0 0 0 1px var(--text-4), inset 3px 0 0 var(--fc, var(--text-4)); }
.lg-terr:active { transform: scale(.95); }
.lg-more { height: 21px; padding: 0 8px; border-radius: 7px; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); vertical-align: 1px; }
.lg-sub { margin-top: 3px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.lg-row.is-new { animation: lg-in .7s var(--spring); }
.lg-row.is-new::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 22%, transparent), transparent 70%);
  animation: lg-flash 3.6s var(--ease) forwards;
}
@keyframes lg-in { from { opacity: 0; transform: translateY(-10px) scale(.99); } }
@keyframes lg-flash { 0%, 40% { opacity: 1; } to { opacity: 0; } }

/* live assault progress inside a row */
.lg-prog { display: flex; align-items: center; gap: 9px; margin-top: 5px; max-width: 460px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lg-prog b { color: var(--text-1); }
.lg-prog .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.lg-prog .bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ff8a8d, #e5484d); }
.lg-prog .end { white-space: nowrap; }

/* raid scoreboard */
.lg-score { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 1.1fr) minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 6px; max-width: 560px; }
.sb-side { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-2); }
.sb-side.r { flex-direction: row-reverse; text-align: right; }
.sb-side .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-side b { font: 750 14px/1 var(--font-display); color: var(--text-1); font-variant-numeric: tabular-nums; }
.sb-side.win .nm { color: var(--text-1); font-weight: 700; }
.sb-side svg { width: 13px; height: 13px; color: var(--tone-gold); align-self: center; flex: none; }
.sb-bar { position: relative; height: 7px; border-radius: 7px; background: var(--cb); overflow: hidden; opacity: .9; }
.sb-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 7px 0 0 7px; background: var(--ca); box-shadow: 1px 0 0 var(--glass-strong); }
.lg-score.live .sb-bar { animation: lg-breathe 2.4s ease-in-out infinite; }
@keyframes lg-breathe { 50% { opacity: .6; } }

.lg-empty { display: flex; align-items: center; gap: 14px; max-width: 560px; margin: 18px auto; padding: 16px 18px; border-radius: 16px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); }
.lg-empty b { display: block; font-size: 13.5px; }
.lg-empty p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); }
.lg-empty-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(145deg, #63a4ff, #9085e9); }
.lg-empty.err .lg-empty-ico { background: linear-gradient(145deg, #ff8a8d, #e5484d); }
.lg-row.skel { cursor: default; }
.lg-row.skel .lg-ico { box-shadow: none; }
.lg-end { padding: 10px 0 4px; text-align: center; font-size: 11.5px; color: var(--text-4); }
.lg-link { color: var(--accent); font-weight: 650; font-size: 11.5px; }
.lg-link:hover { text-decoration: underline; }
.lg-spin { display: inline-block; width: 11px; height: 11px; margin: 0 7px -1px 0; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* "happening now": running assaults and raids */
.log-now-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 14px 7px; font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.log-now-head span + span { letter-spacing: .02em; text-transform: none; font-weight: 600; color: var(--text-4); }
.log-now-list { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 6px; scrollbar-gutter: stable; }
.now-card { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 9px 11px 9px; border-radius: 14px; text-align: left; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); transition: background .18s; }
button.now-card:hover { background: var(--field-hover); }
.nc-top { display: flex; align-items: center; gap: 8px; }
.nc-ico { width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--tone); flex: none; }
.nc-ico svg { width: 12px; height: 12px; stroke-width: 2.1; }
.nc-code { font: 750 12.5px/1 var(--mono); letter-spacing: .03em; }
.nc-time { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nc-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: var(--text-1); }
.nc-vs > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-vs > span:last-child { text-align: right; }
.nc-vs i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 2px; background: var(--fc); vertical-align: 1px; }
.nc-vs .vs { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; color: var(--text-4); }
.nc-bar { position: relative; height: 5px; border-radius: 5px; background: var(--line-2); overflow: hidden; }
.nc-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: linear-gradient(90deg, #ff8a8d, #e5484d); }
.nc-bar.duo { background: var(--cb); }
.nc-bar.duo i { background: var(--ca); border-radius: 5px 0 0 5px; }
.nc-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nc-foot b { color: var(--text-1); }
.now-empty { padding: 14px 6px; font-size: 12px; color: var(--text-3); }

/* history inside the territory / faction views */
.lg-mini { display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; }
.lg-mini .lg-row { grid-template-columns: 40px 26px minmax(0, 1fr); column-gap: 9px; padding: 5px 6px 5px 0; }
.lg-mini .lg-row::before { left: 61px; top: 33px; }
.lg-mini .lg-row:last-child::before { display: none; }
.lg-mini .lg-time { padding-top: 4px; font-size: 10.5px; }
.lg-mini .lg-ico { width: 26px; height: 26px; border-radius: 9px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 0 0 3px var(--glass-strong); }
.lg-mini .lg-ico svg { width: 14px; height: 14px; }
.lg-mini .lg-text { font-size: 12.5px; }
.lg-hist-note { margin: 0 2px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .bar-modes .seg button span { display: none; }
  .bar-modes .seg button { padding: 0 11px; }
}
@media (max-width: 1060px) {
  :root { --panel-l: 304px; --panel-r: 330px; }
  .brand-text { display: none; }
  .live-chip .live-text { display: none; }
  .live-chip { padding: 0 11px; }
}
@media (max-width: 760px) {
  :root { --edge: 8px; --topbar-h: 46px; }
  .topbar { flex-wrap: wrap; height: auto; }
  .bar-search { order: 3; flex: 1 1 100%; max-width: none; height: 44px; }
  .bar-modes { order: 4; flex: 1 1 100%; justify-content: center; height: 46px; overflow-x: auto; }
  .bar-cluster { height: 46px; }
  .bar-search .kbd { display: none; }
  .panel {
    top: auto;
    left: var(--edge) !important;
    right: var(--edge) !important;
    width: auto !important;
    height: min(58vh, 520px);
    border-radius: 24px;
  }
  body:not(.show-left) .panel-left, body:not(.show-right) .panel-right { transform: translateY(calc(100% + 30px)); }
  body { --lo: var(--edge) !important; --ro: var(--edge) !important; }
  body.show-left .legend, body.show-right .legend { opacity: 0; pointer-events: none; }
  body.show-right .map-controls, body.show-left .map-controls { opacity: 0; pointer-events: none; }
  .legend { max-width: calc(100vw - 80px); }
  .tooltip { display: none; }

  /* live log: a ticker along the bottom that opens into a sheet */
  body, body.log-collapsed { --log-space: 54px; }
  .map-controls { bottom: calc(var(--edge) + var(--log-space) + 8px); }
  .log-dock { left: var(--edge) !important; right: var(--edge) !important; height: 54px; border-radius: 22px; z-index: 22; }
  .log-dock .log-grip, .log-dock .log-filters, .log-dock .log-search, .log-dock .log-status, .log-dock .log-body, .log-dock .log-name { display: none; }
  .log-dock .log-ticker { display: flex; padding: 0 6px; }
  .log-dock .log-chev { transform: rotate(180deg); }
  .log-head { padding: 0 8px 0 6px; gap: 4px; }
  body.show-log .log-dock { height: min(64vh, 560px); }
  body.show-log .log-dock .log-ticker { display: none; }
  body.show-log .log-dock .log-body { display: grid; }
  body.show-log .log-dock .log-name { display: inline; }
  body.show-log .log-dock .log-filters { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  body.show-log .log-dock .log-chev { transform: none; }
  body.show-log .legend, body.show-log .map-controls { opacity: 0; pointer-events: none; }
  body.show-left .log-dock, body.show-right .log-dock { opacity: 0; pointer-events: none; transform: translateY(16px); }
  .lg-row { grid-template-columns: 38px 28px minmax(0, 1fr); column-gap: 8px; }
  .lg-row::before { left: 61px; }
  .lg-day { padding-left: 44px; }
}

html.preload *, html.preload *::before, html.preload *::after { transition: none !important; animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .glass, .glass-strong { border: 1px solid CanvasText; }
}
