:root {
  --bg: #0b0c10;
  --panel: rgba(14, 15, 20, 0.92);
  --edge: #2c2e3a;
  --text: #d6d8e0;
  --dim: #8a8ea0;
  --accent: #58b7ff;
  --topbar-h: 40px;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #363949 transparent;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2c2e3a;
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #4a4e63; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  user-select: none;
}

#map { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#map.dragging { cursor: grabbing; }

/* ---------- waiting card ---------- */
#nodata {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#nodata.hidden { display: none; }
.nodata-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 22px 30px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}
.nodata-title { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.nodata-sub { color: var(--dim); line-height: 1.5; }
.nodata-sub code, .arbi-drop code { color: var(--accent); }

/* ---------- top HUD ---------- */
#hud {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 6px 14px;
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on  { background: #46d05c; box-shadow: 0 0 6px #46d05c; }
.dot.off { background: #d04040; box-shadow: 0 0 6px #d04040; }
#mission-label { color: var(--accent); }
#feed-age { color: var(--dim); }

/* ---------- bottom-right viewer badge ---------- */
#viewer-badge {
  flex-shrink: 0;
  background: #141720;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 3px 9px;
  display: flex; align-items: center; gap: 6px;
  color: var(--dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#viewer-count { color: var(--text); font-weight: 500; }

/* ---------- side panel ---------- */
#panel {
  position: absolute; top: 10px; left: 10px;
  width: 248px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  max-height: calc(100% - 20px);
  display: flex; flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}
#panel-head {
  padding: 8px 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; letter-spacing: 1px; color: var(--accent);
  border-bottom: 1px solid var(--edge);
}
#panel-toggle {
  background: none; border: 1px solid var(--edge); color: var(--dim);
  border-radius: 4px; width: 22px; height: 22px; cursor: pointer; line-height: 1;
}
#panel-toggle:hover { color: var(--text); border-color: var(--dim); }
#panel-body { padding: 10px 12px; overflow-y: auto; }
#panel.collapsed #panel-body { display: none; }

.section {
  margin: 11px 0 6px;
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 3px;
}

/* Follow / Freecam segmented switch */
.mode-switch {
  display: flex;
  background: #12131a;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  margin-bottom: 6px;
}
.mode-switch button {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--dim);
  border-radius: 4px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.mode-switch button:hover { color: var(--text); }
.mode-switch button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: #14202e;
}

.row { margin: 6px 0; }
.btn-row { display: flex; gap: 6px; }
.btn-row button {
  flex: 1;
  background: #1a1c26;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 5px;
  padding: 5px 4px;
  cursor: pointer;
  font-size: 12px;
}
.btn-row button:hover { color: var(--text); border-color: var(--dim); }
.btn-row button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: #14202e;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; }
.grid2 label.disabled { opacity: 0.45; cursor: not-allowed; }
label { display: flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
label input { accent-color: var(--accent); margin: 0; }

.hint { color: var(--dim); font-size: 11px; margin-top: 6px; line-height: 1.45; }

/* Entities + nested Enemy only tree */
.ent-group { margin: 2px 0 6px; }
.ent-master { font-weight: 600; }
.ent-sub {
  margin: 3px 0 0 7px;
  padding: 2px 0 2px 12px;
  position: relative;
}
.ent-sub::before {
  content: "";
  position: absolute;
  left: 0; top: -3px;
  width: 8px; height: calc(50% + 3px);
  border-left: 2px solid var(--edge);
  border-bottom: 2px solid var(--edge);
  border-bottom-left-radius: 3px;
  box-sizing: border-box;
}
.ent-sub label { color: var(--dim); font-size: 12px; }
.ent-sub.disabled { opacity: 0.45; pointer-events: none; }
.rot-row { margin: 5px 0 2px; font-size: 12px; color: var(--dim); }
.rot-row.disabled { opacity: 0.45; pointer-events: none; }
.name-sub { margin-top: 5px; }
.name-sub.disabled { opacity: 0.45; pointer-events: none; }

/* ---------- 3D labels (HTML overlay over the canvas) ---------- */
#labels {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.room-label, .blip-label {
  position: absolute;
  left: 0; top: 0;
  white-space: nowrap;
  will-change: transform;
}
.room-label {
  color: rgba(235, 235, 235, 0.88);
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.blip-label {
  color: rgba(214, 216, 224, 0.92);
  font-size: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}
.grid-label {
  position: absolute;
  left: 0; top: 0;
  white-space: nowrap;
  will-change: transform;
  color: rgba(138, 152, 184, 0.72);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.circle-dot {
  position: absolute;
  left: 0; top: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 0 2px rgba(11, 12, 16, 0.85);
  will-change: transform;
}
#an-map.place-mode { cursor: crosshair; }

/* ---------- top bar: Map / Log-Analyzer / Riven Roller / Auto-Banner ---------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--edge);
  display: flex; align-items: stretch;
  padding: 0 8px;
  overflow-x: auto; overflow-y: hidden;
}
.topbar-right {
  margin-left: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 12px;
}
.wf-player {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(88, 183, 255, 0.22);
  background: rgba(11, 13, 19, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  font-size: 12px;
  max-width: calc(100vw - 24px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.wf-player:hover {
  border-color: rgba(88, 183, 255, 0.42);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.72), 0 0 18px rgba(88, 183, 255, 0.08);
}
.wf-pl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  opacity: 0.45;
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.wf-player.is-playing .wf-pl-dot {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 8px var(--accent);
}
.wf-pl-dd {
  position: relative;
}
.wf-pl-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.wf-pl-dd-btn:hover,
.wf-pl-dd.open .wf-pl-dd-btn {
  border-color: rgba(88, 183, 255, 0.45);
  background: rgba(88, 183, 255, 0.10);
}
.wf-pl-chev {
  color: var(--dim);
  transition: transform 0.18s ease, color 0.18s ease;
}
.wf-pl-dd.open .wf-pl-chev {
  transform: rotate(180deg);
  color: var(--accent);
}
.wf-pl-dd-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  min-width: 175px;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid rgba(88, 183, 255, 0.25);
  background: rgba(11, 13, 19, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
}
.wf-pl-dd-menu[hidden] { display: none; }
.wf-pl-dd-opt {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--dim);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.14s ease, color 0.14s ease;
}
.wf-pl-dd-opt:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.wf-pl-dd-opt.selected {
  background: rgba(88, 183, 255, 0.14);
  color: var(--accent);
  font-weight: 500;
}
.wf-dd { position: relative; display: inline-flex; }
.wf-dd-full { flex: 1; min-width: 0; }
.wf-dd-full .wf-dd-btn { width: 100%; justify-content: space-between; }
.wf-dd-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.wf-dd-lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-dd-btn {
  border-radius: 6px;
  padding: 6px 10px;
  background: #141720;
  border-color: var(--edge);
}
.wf-dd-compact .wf-dd-btn {
  padding: 4px 8px;
  font-size: 11.5px;
}
.wf-dd-menu {
  max-height: 280px;
  overflow-y: auto;
  min-width: 100%;
}
.wf-dd-down {
  top: calc(100% + 6px);
  bottom: auto;
}
.wf-dd-up {
  bottom: calc(100% + 6px);
  top: auto;
}
.wf-dd-opt-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-dd-chk {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
}
.wf-dd-grp {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 8px 3px;
  opacity: 0.85;
}
.wf-pl-sep {
  width: 1px;
  height: 14px;
  background: var(--edge);
  flex-shrink: 0;
}
.wf-pl-now {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
  font-size: 11.5px;
  transition: color 0.2s ease;
}
.wf-player.is-playing .wf-pl-now { color: var(--text); }
.wf-pl-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.wf-pl-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.wf-pl-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(88, 183, 255, 0.12);
}
.wf-pl-btn:active:not(:disabled) { transform: scale(0.93); }
.wf-pl-btn.active {
  color: var(--accent);
  border-color: rgba(88, 183, 255, 0.55);
  background: rgba(88, 183, 255, 0.14);
}
.wf-pl-btn.muted {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
}
.wf-pl-btn:disabled { opacity: 0.3; cursor: not-allowed; }
#wf-pl-vol {
  width: 64px;
  height: 4px;
  margin-left: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
@media (max-width: 720px) {
  .wf-pl-now, .wf-pl-sep { display: none; }
  .wf-player { padding: 5px 10px; gap: 6px; }
}
.topbar-auth-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.topbar-auth-btn:hover { color: var(--text); border-color: var(--accent); }
.topbar-auth-btn[hidden] { display: none; }
@media (max-width: 900px) { .topbar-credit { display: none; } }
.tab {
  display: flex; align-items: center;
  padding: 0 14px;
  color: var(--dim); text-decoration: none;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border-top: 2px solid transparent; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab[hidden] { display: none; }

/* tab pages stay hidden until tabs.js marks the active one (no flash of the wrong tab) */
.view { display: none; }
.view.active { display: block; }
#view-map { position: absolute; top: var(--topbar-h); left: 0; right: 0; bottom: 0; }
.page.active {
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: var(--topbar-h); left: 0; right: 0; bottom: 0;
  padding: 16px; overflow-y: auto;
}
.page-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 24px 28px;
  width: 100%; max-width: 420px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}
.page-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.page-sub { color: var(--dim); line-height: 1.5; }

/* Auto-Banner intake */
.ab-note {
  color: #e8c46a;
  background: rgba(232, 196, 106, 0.08);
  border: 1px solid rgba(232, 196, 106, 0.35);
  border-radius: 6px;
  padding: 9px 12px; margin-bottom: 14px;
  line-height: 1.5;
}
#ab-form { display: flex; gap: 8px; }
#ab-id {
  flex: 1; min-width: 0;
  background: #12131a; color: var(--text);
  border: 1px solid var(--edge); border-radius: 6px;
  padding: 8px 10px; font: inherit;
  user-select: text;
}
#ab-id::placeholder { color: var(--dim); }
#ab-id:focus { outline: none; border-color: var(--accent); }
#ab-submit { flex-shrink: 0; font-family: inherit; }
#ab-submit:disabled { opacity: 0.5; cursor: default; }
.ab-status { min-height: 18px; margin-top: 10px; font-size: 12px; line-height: 1.4; color: var(--dim); }
.ab-status.ok { color: #46d05c; }
.ab-status.err { color: #ff6b6b; }
.page-hint { margin-top: 14px; color: var(--dim); font-size: 11px; line-height: 1.45; }

.btn-primary {
  background: #14202e; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 6px;
  padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #1a2d42; }
.btn-secondary {
  background: #141720; color: var(--text);
  border: 1px solid var(--edge); border-radius: 6px;
  padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Arbitration tab (user-input-only; analysis is server-side) ---------- */
#view-home.page.active,
#view-tiles.page.active,
#view-arbitration.page.active,
#view-perita.page.active,
#view-stripper.page.active {
  display: block;   /* not the centered flex card: a wide scrollable column */
}
#view-home.page.active.arbi-is-landing,
#view-arbitration.page.active.arbi-is-landing,
#view-perita.page.active.arbi-is-landing,
#view-stripper.page.active.arbi-is-landing {
  display: flex; align-items: center; justify-content: center;
}
#view-home.arbi-is-landing .arbi-wrap,
#view-arbitration.arbi-is-landing .arbi-wrap,
#view-perita.arbi-is-landing .arbi-wrap,
#view-stripper.arbi-is-landing .arbi-wrap {
  max-width: 440px;
  padding: 16px;
}
#view-home.arbi-is-landing.home-has-file .arbi-wrap {
  max-width: 540px;
}
#view-home.arbi-is-landing .arbi-main,
#view-arbitration.arbi-is-landing .arbi-main,
#view-perita.arbi-is-landing .arbi-main,
#view-stripper.arbi-is-landing .arbi-main {
  padding: 22px 30px;
}
#view-home.arbi-is-landing .arbi-landing,
#view-arbitration.arbi-is-landing .arbi-landing,
#view-perita.arbi-is-landing .arbi-landing,
#view-stripper.arbi-is-landing .arbi-landing {
  padding: 0;
}
#view-home.arbi-is-landing .arbi-landing-title,
#view-arbitration.arbi-is-landing .arbi-landing-title,
#view-perita.arbi-is-landing .arbi-landing-title,
#view-stripper.arbi-is-landing .arbi-landing-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 14px;
}
#view-home.arbi-is-landing .arbi-landing-sub,
#view-arbitration.arbi-is-landing .arbi-landing-sub,
#view-perita.arbi-is-landing .arbi-landing-sub,
#view-stripper.arbi-is-landing .arbi-landing-sub {
  margin-bottom: 14px;
}
#view-home.arbi-is-landing .arbi-drop,
#view-arbitration.arbi-is-landing .arbi-drop,
#view-perita.arbi-is-landing .arbi-drop,
#view-stripper.arbi-is-landing .arbi-drop {
  padding: 20px 16px;
}
.arbi-credits {
  position: fixed;
  right: 14px;
  bottom: 10px;
  font-size: 11px;
  color: var(--dim);
  opacity: 0.7;
  pointer-events: none;
}

.bg-picker {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 7px;
  padding: 4px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.bg-picker[hidden] { display: none; }
.bg-label {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.5px;
}
.bg-picker input[type="color"] {
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}
.bg-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.bg-picker input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }
.bg-reset {
  background: none;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.bg-reset:hover { color: var(--text); border-color: var(--dim); }
.arbi-wrap {
  width: 100%; max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}
.arbi-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 16px 18px;
}
/* the one top-level page container: same shadow tier as .page-card */
.arbi-main {
  width: 100%;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  user-select: text;
}
/* section headers: the map panel's .section idiom (dim + rule) */
.arbi-h {
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 3px;
  margin: 0 0 8px;
}
.arbi-sub { color: var(--dim); font-size: 11px; margin-bottom: 10px; }

/* landing: the drop card the tab opens on */
.arbi-landing { text-align: center; padding: 30px 0 10px; }
.arbi-landing-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.arbi-landing-sub { color: var(--dim); line-height: 1.5; margin-bottom: 18px; }
.arbi-drop {
  max-width: 520px; margin: 0 auto;
  border: 1px dashed var(--edge); border-radius: 10px;
  padding: 34px 18px; color: var(--dim); font-size: 13px;
  cursor: pointer;
}
.arbi-drop:hover, .arbi-drop.drag { border-color: var(--accent); color: var(--text); }
.arbi-drop:focus-visible { outline: none; border-color: var(--accent); }
.arbi-drop.busy { opacity: 0.6; pointer-events: none; }

/* header: session chips + node + mode badge */
.arbi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.arbi-chip {
  background: #1a1c26; color: var(--dim);
  border: 1px solid var(--edge); border-radius: 14px;
  padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer;
}
.arbi-chip:hover { color: var(--text); border-color: var(--dim); }
.arbi-chip.on { color: var(--accent); border-color: var(--accent); background: #14202e; }
.arbi-chip-back { border-style: dashed; }
.arbi-chip-tag {
  margin-left: 7px; padding: 0 6px; border-radius: 8px;
  background: #12131a; border: 1px solid var(--edge);
  color: var(--dim); font-size: 10px; letter-spacing: 1px;
}
.arbi-chip.on .arbi-chip-tag { color: var(--accent); border-color: var(--accent); }
.arbi-title-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.arbi-node { font-size: 17px; font-weight: 600; color: var(--text); }
.arbi-planet { color: var(--dim); font-weight: 400; font-size: 14px; }
.arbi-badge {
  background: #ffaa00; color: #000;
  border-radius: 4px; padding: 3px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
}
.arbi-runs { color: var(--dim); font-size: 12px; }

/* KPI grid */
.arbi-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.arbi-kpi {
  background: #12131a;
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 10px 12px;
}
.arbi-kpi-v { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.arbi-kpi-l { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.arbi-kpi-s { color: var(--dim); font-size: 11px; margin-top: 3px; }

/* two-column zones (vitus / saturation, and the interval pair), collapse on
   narrow screens; section cards inside the page card sit on the INNER tier
   (flat #12131a like .arbi-kpi) so the hierarchy reads panel+shadow > flat */
.arbi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.arbi-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.arbi-grid .arbi-card, .arbi-grid2 .arbi-card {
  margin-bottom: 0;
  background: #12131a;
  display: flex;
  flex-direction: column;
}
.arbi-grid2 .arbi-card { padding: 12px 14px; }   /* the compact interval pair */
@media (max-width: 880px) { .arbi-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .arbi-grid2 { grid-template-columns: 1fr; } }
#arbi-body > .arbi-card { background: #12131a; }   /* stray section card (waves) */
#arbi-body > .arbi-card:not(:last-child) { margin-bottom: 12px; }

.arbi-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.arbi-table th {
  text-align: left; color: var(--dim); font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; font-weight: 500; padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--edge);
}
.arbi-table td { padding: 4px 8px 4px 0; border-bottom: 1px solid #1c1e28; font-variant-numeric: tabular-nums; }
.arbi-num { text-align: right; }
.arbi-dim { color: var(--dim); }

.arbi-luck-row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
  margin: auto 0; padding-top: 4px;
}
#arbi-vitus-in {
  background: #12131a; color: var(--text);
  border: 1px solid var(--edge); border-radius: 6px;
  padding: 7px 10px; font: inherit; width: 130px;
  user-select: text;
}
#arbi-vitus-in:focus { outline: none; border-color: var(--accent); }
#arbi-luck-out { color: var(--dim); font-size: 12px; }

/* saturation bars */
.arbi-round-chips { margin-bottom: 10px; }
.arbi-rchip {
  background: #1a1c26; color: var(--dim);
  border: 1px solid var(--edge); border-radius: 12px;
  padding: 2px 10px; font: inherit; font-size: 11px; cursor: pointer;
}
.arbi-rchip:hover { color: var(--text); border-color: var(--dim); }
.arbi-rchip.on { color: var(--accent); border-color: var(--accent); background: #14202e; }
.arbi-sat-line { color: var(--dim); font-size: 12px; margin-bottom: 10px; }
.arbi-bars { display: flex; flex-direction: column; gap: 3px; }
.arbi-bar { display: flex; align-items: center; gap: 8px; }
.arbi-bar-l { width: 52px; text-align: right; color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.arbi-bar-t { flex: 1; height: 12px; background: #12131a; border-radius: 3px; overflow: hidden; }
.arbi-bar-f { height: 100%; border-radius: 3px; }
.arbi-bar-v { width: 48px; color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }

/* interval graphs + heatmap */
.arbi-graph { width: 100%; height: auto; display: block; user-select: text; }
.arbi-heat { display: flex; flex-wrap: wrap; gap: 5px; }
.arbi-heat-tile {
  min-width: 46px; padding: 6px 4px;
  background: #12131a; border: 1px solid var(--edge); border-radius: 6px;
  text-align: center; font-weight: 600; font-variant-numeric: tabular-nums;
}
.arbi-heat-tile small { display: block; color: var(--dim); font-size: 10px; font-weight: 400; margin-top: 2px; }

/* wave map */
.arbi-waves { display: flex; flex-wrap: wrap; gap: 5px; }
.arbi-wave {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.arbi-wave.fast { background: rgba(70, 208, 92, 0.18); color: #46d05c; border: 1px solid rgba(70, 208, 92, 0.5); }
.arbi-wave.slow { background: rgba(255, 82, 82, 0.16); color: #ff5252; border: 1px solid rgba(255, 82, 82, 0.5); }

.arbi-empty { color: var(--dim); padding: 18px 0; text-align: center; }
.arbi-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* message card ("no recognizable runs"), same shape as the map tab's #nodata */
.arbi-nodata {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 260px; text-align: center;
}
.arbi-nodata-title { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.arbi-nodata-sub { color: var(--dim); line-height: 1.5; }

/* Perita tables */
.perita-table-wrap { overflow-x: auto; }
.perita-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.perita-table th {
  text-align: left; color: var(--dim); font-weight: 500;
  border-bottom: 1px solid var(--edge); padding: 6px 8px;
  white-space: nowrap;
}
.perita-table td {
  padding: 6px 8px; border-bottom: 1px solid rgba(44, 46, 58, 0.45);
  color: var(--text); vertical-align: top;
}
.perita-table tr:last-child td { border-bottom: none; }
.perita-num { text-align: right; white-space: nowrap; }
.perita-sub { color: var(--dim); font-size: 11px; }
.perita-badge-ok { background: rgba(70, 208, 92, 0.18); color: #46d05c; border: 1px solid rgba(70, 208, 92, 0.5); border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 600; }
.perita-badge-warn { background: rgba(255, 170, 0, 0.16); color: #ffaa00; border: 1px solid rgba(255, 170, 0, 0.45); border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 600; }
.perita-badge-err { background: rgba(255, 82, 82, 0.16); color: #ff5252; border: 1px solid rgba(255, 82, 82, 0.45); border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 600; }
.perita-tag { display: inline-block; margin-left: 4px; padding: 1px 5px; border-radius: 4px; font-size: 10px; font-weight: 600; background: #1a1c26; border: 1px solid var(--edge); color: var(--dim); }
.perita-tag-prime { background: rgba(255, 170, 0, 0.14); border-color: rgba(255, 170, 0, 0.45); color: #ffaa00; }
.perita-tag-skip { background: rgba(88, 183, 255, 0.14); border-color: rgba(88, 183, 255, 0.45); color: var(--accent); }
.perita-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 900px) { .perita-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 540px) { .perita-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.perita-h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--edge); padding-bottom: 5px; }
.perita-toggle-btn {
  background: #141720; color: var(--dim);
  border: 1px solid var(--edge); border-radius: 5px;
  padding: 2px 9px; font-size: 11px; cursor: pointer;
}
.perita-toggle-btn:hover { color: var(--text); border-color: var(--accent); }
.perita-map-box {
  flex: 1; min-width: 0;
  height: 460px;
  background: #0b0c10;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px;
  display: flex; align-items: center; justify-content: center;
}
.perita-map-split {
  display: flex; gap: 10px; margin-top: 8px; align-items: stretch;
}
.perita-map-orders {
  width: 230px; flex-shrink: 0;
  max-height: 460px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.an-3d-slider-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--dim);
}
.an-3d-slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.mi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mi-cfg-btn {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  cursor: pointer;
}
.mi-cfg-btn:hover, .mi-cfg-btn.active {
  color: var(--text);
  border-color: var(--accent);
}
.mi-cfg-panel {
  margin: 6px 0 4px;
  padding: 6px 8px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: rgba(11, 12, 16, 0.72);
  max-height: 240px;
  overflow-y: auto;
  font-size: 11px;
}
.mi-cfg-cat { margin-bottom: 6px; }
.mi-cfg-cat:last-child { margin-bottom: 0; }
.mi-cfg-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 3px;
}
.mi-cfg-actions {
  display: flex;
  gap: 4px;
}
.mi-cfg-actions button {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 9.5px;
  cursor: pointer;
}
.mi-cfg-actions button:hover { color: var(--text); border-color: var(--accent); }
.mi-cfg-types {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 4px;
}
.mi-cfg-types label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mi-cfg-types label:hover { color: var(--text); }
.mi-dot-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  font-size: 10px;
  line-height: 1.15;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(11, 12, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  white-space: nowrap;
  will-change: transform;
}
.mi-modal-card {
  width: min(980px, 92vw);
  height: min(680px, 86vh);
  display: flex;
  flex-direction: column;
}
.mi-modal-x {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 5px;
  width: 26px;
  height: 26px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.mi-modal-x:hover {
  color: var(--text);
  border-color: var(--accent);
}
.mi-modal-toolbar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--edge);
  display: flex;
  align-items: center;
  gap: 10px;
}
.mi-modal-zero-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
  cursor: pointer;
}
.mi-modal-toolbar input[type="text"] {
  flex: 1;
  background: #0b0c10;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.mi-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-content: start;
}
.mi-modal-body .mi-cfg-cat {
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(11, 12, 16, 0.55);
  margin-bottom: 0;
}
.mi-modal-body .mi-cfg-types {
  display: block;
  max-height: 175px;
  overflow-y: auto;
  padding-right: 4px;
}
.mi-modal-body .mi-cfg-types label {
  margin-bottom: 3px;
}
.mi-cfg-zero { opacity: 0.55; }
@media (max-width: 720px) {
  .perita-map-split { flex-direction: column; }
  .perita-map-orders { width: 100%; max-height: 180px; }
}
.perita-ord-btn {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  background: #141720; color: var(--text);
  border: 1px solid var(--edge); border-radius: 5px;
  padding: 5px 8px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.perita-ord-btn:hover { border-color: var(--dim); }
.perita-ord-btn.active { border-color: #ffaa00; background: rgba(255, 170, 0, 0.12); }
.perita-ord-num { color: var(--accent); font-weight: 600; flex-shrink: 0; }
.perita-ord-btn.active .perita-ord-num { color: #ffaa00; }
.perita-ord-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perita-ord-layer { color: var(--dim); font-size: 10.5px; flex-shrink: 0; }

/* Instant dark tooltips on Perita headers/KPIs */
[data-tip] {
  cursor: help;
  text-decoration: underline dotted rgba(138, 142, 160, 0.55);
  text-underline-offset: 3px;
}
.arbi-kpi[data-tip] { text-decoration: none; }
.wf-tip {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  background: #141720;
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 11px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  display: none;
}
.perita-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Map Analyzer tab ---------- */
#view-analyzer { position: absolute; top: var(--topbar-h); left: 0; right: 0; bottom: 0; }
#an-map { width: 100%; height: 100%; display: block; }
#an-labels {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
#an-nodata {
  position: absolute; inset: 0; z-index: 5;
  padding: 16px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#an-nodata.hidden { display: none; }
.an-landing-card {
  width: 100%;
  max-width: 408px;
  padding: 22px 30px;
  pointer-events: auto;
}
.an-landing-card .nodata-title { font-weight: 500; margin-bottom: 14px; }
.an-landing-card .arbi-drop { padding: 20px 16px; }
#home-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#view-home .arbi-wrap {
  position: relative;
  z-index: 5;
}
#an-bar, #home-map-bar {
  position: absolute; top: 10px; right: 10px; z-index: 20;
  width: min(390px, calc(100% - 280px));
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}
#view-home .arbi-main,
#view-home .home-history,
#home-map-bar,
.home-bg-ctrl {
  background: rgba(11, 13, 19, 0.83);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(88, 183, 255, 0.22);
}
.home-bg-ctrl {
  position: absolute;
  right: 14px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(88, 183, 255, 0.22);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  font-size: 11px;
  color: var(--dim);
}
.home-bg-lbl {
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text);
}
#home-bg-opacity {
  width: 78px;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}
.home-bg-val {
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .home-bg-ctrl {
    bottom: 60px;
    right: 10px;
  }
}
#an-form, #home-map-form { display: flex; gap: 6px; }
#an-input, #home-map-input {
  flex: 1; min-width: 0;
  background: #141720; color: var(--text);
  border: 1px solid var(--edge); border-radius: 5px;
  padding: 4px 8px; font-size: 12px; font-family: inherit;
}
#an-input:focus, #home-map-input:focus { outline: none; border-color: var(--accent); }
#an-submit, #home-map-submit { padding: 4px 10px; font-size: 12px; }
.an-status { margin-top: 3px; font-size: 11px; color: var(--dim); min-height: 14px; }
.an-status.ok { color: #46d05c; }
.an-status.err { color: #ff5252; }

#an-panel {
  position: absolute; top: 10px; left: 10px; z-index: 20;
  width: 248px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  max-height: calc(100% - 20px);
  display: flex; flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}
#an-panel-head {
  padding: 8px 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; letter-spacing: 1px; color: var(--accent);
  border-bottom: 1px solid var(--edge);
}
#an-panel-toggle {
  background: none; border: 1px solid var(--edge); color: var(--dim);
  border-radius: 4px; width: 22px; height: 22px; cursor: pointer; line-height: 1;
}
#an-panel-toggle:hover { color: var(--text); border-color: var(--dim); }
#an-panel-body { padding: 10px 12px; overflow-y: auto; }
#an-panel.collapsed #an-panel-body { display: none; }
#an-panel[hidden] { display: none; }

#view-analyzer.dragover::after {
  content: "Drop EE.log to load maps";
  position: absolute; inset: 12px; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 12, 16, 0.78);
  border: 2px dashed var(--accent); border-radius: 10px;
  color: var(--accent); font-size: 16px; font-weight: 600;
  pointer-events: none;
}
#an-log-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 220px; overflow-y: auto;
}
.an-map-item {
  width: 100%; text-align: left;
  background: #141720; color: var(--text);
  border: 1px solid var(--edge); border-radius: 5px;
  padding: 5px 8px; cursor: pointer; font-family: inherit;
}
.an-map-item:hover { border-color: var(--dim); }
.an-map-item.active { border-color: var(--accent); background: rgba(88, 183, 255, 0.12); }
.an-map-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-map-sub { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* ---------- Home startpage ---------- */
#home-drop.compact { padding: 12px 16px; }
#home-result { text-align: left; }
.home-file-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 8px 12px;
  background: #12131a; border: 1px solid var(--edge); border-radius: 6px;
}
.home-file-info { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.home-file-name {
  font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-file-meta { font-size: 11px; color: var(--dim); flex-shrink: 0; }
.home-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  margin-top: 10px;
}
.home-action {
  text-align: left; padding: 12px 14px;
  background: #141720; color: var(--text);
  border: 1px solid var(--edge); border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.12s, background 0.12s, opacity 0.12s;
}
.home-action:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(88, 183, 255, 0.1);
}
.home-action.disabled, .home-action:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: #101218;
}
.home-action-title { font-size: 13px; font-weight: 600; color: var(--text); }
.home-action:hover:not(:disabled) .home-action-title { color: var(--accent); }
.home-action-sub { font-size: 11.5px; color: var(--dim); margin-top: 3px; line-height: 1.35; }
@media (max-width: 520px) {
  .home-actions { grid-template-columns: 1fr; }
}
.home-history {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  width: 250px; max-height: calc(100% - 24px);
  background: var(--panel); border: 1px solid var(--edge); border-radius: 10px;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}
.home-history-head {
  padding: 8px 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; letter-spacing: 1px; color: var(--accent);
  border-bottom: 1px solid var(--edge);
}
.home-history-hint {
  padding: 7px 12px;
  font-size: 11px; line-height: 1.35; color: var(--dim);
  border-bottom: 1px solid var(--edge);
}
.home-hist-list {
  padding: 8px;
  display: flex; flex-direction: column; gap: 5px;
  overflow-y: auto;
}
.home-hist-empty {
  padding: 10px 4px; text-align: center;
  font-size: 11.5px; color: var(--dim);
}
.home-hist-item {
  display: flex; align-items: center; gap: 6px;
  background: #141720; border: 1px solid var(--edge); border-radius: 6px;
  padding: 6px 8px;
}
.home-hist-item:hover { border-color: var(--dim); }
.home-hist-item.active { border-color: var(--accent); background: rgba(88, 183, 255, 0.12); }
.home-hist-pick {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: none; padding: 0; color: inherit;
  cursor: pointer; font-family: inherit;
}
.home-hist-del {
  flex-shrink: 0; background: none; border: none; color: var(--dim);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px;
}
.home-hist-del:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
@media (max-width: 1060px) {
  #view-home.page.active.arbi-is-landing {
    flex-direction: column; justify-content: flex-start; gap: 14px;
  }
  .home-history { position: static; width: 100%; max-width: 440px; max-height: 240px; order: 2; }
  #home-map-bar { position: static; width: 100%; max-width: 440px; order: 0; }
  #view-home.home-has-file .home-history, #view-home.home-has-file #home-map-bar { max-width: 540px; }
}

/* ---------- Disruption / Survival analyzer mode ---------- */
.ds-brush-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.ds-brush {
  flex: 1 1 22%;
  background: #1a1c26;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 5px;
  padding: 5px 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.ds-brush:hover { color: var(--text); border-color: var(--dim); }
.ds-brush.active[data-grade="best"]    { color: #22c55e; border-color: #22c55e; background: rgba(34, 197, 94, 0.14); }
.ds-brush.active[data-grade="good"]    { color: #38bdf8; border-color: #38bdf8; background: rgba(56, 189, 248, 0.14); }
.ds-brush.active[data-grade="average"] { color: #f59e0b; border-color: #f59e0b; background: rgba(245, 158, 11, 0.14); }
.ds-brush.active[data-grade="bad"]       { color: #ef4444; border-color: #ef4444; background: rgba(239, 68, 68, 0.14); }
.ds-brush.active[data-grade="void_easy"] { color: #f472b6; border-color: #f472b6; background: rgba(244, 114, 182, 0.14); }
.ds-brush.active[data-grade="void_med"]  { color: #ec4899; border-color: #ec4899; background: rgba(236, 72, 153, 0.16); }
.ds-brush.active[data-grade="void_hard"] { color: #db2777; border-color: #be185d; background: rgba(190, 24, 93, 0.22); }
.ds-brush.active[data-grade="none"]      { color: var(--text); border-color: var(--dim); background: #262936; }

.ds-tune-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  margin-top: 4px;
}
.ds-tune-grid label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--dim);
  cursor: default;
}
.ds-tune-grid input {
  width: 48px;
  background: #12131a;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ds-hud {
  position: absolute;
  top: 82px;
  right: 10px;
  z-index: 20;
  min-width: 240px;
  max-width: min(390px, calc(100% - 280px));
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 9px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
.ds-hud[hidden] { display: none; }
.ds-hud-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ds-hud-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.ds-hud-score {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.ds-hud-sub {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.mi-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ds-submit-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.ds-submit-row input {
  flex: 1;
  min-width: 0;
  background: #12131a;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 11px;
}
.ds-submit-row button {
  background: #14202e;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.ds-subs-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  max-height: 180px;
  overflow-y: auto;
}
.ds-sub-item {
  background: #141720;
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 11px;
}
.ds-sub-meta {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}
.ds-sub-info {
  color: var(--dim);
  font-size: 10px;
  margin-bottom: 4px;
}
.ds-sub-actions {
  display: flex;
  gap: 4px;
}
.ds-sub-actions button {
  flex: 1;
  background: #1a1c26;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 10px;
  cursor: pointer;
}
.ds-sub-actions button:hover { color: var(--text); border-color: var(--dim); }

/* ---------- Tiles catalog page ---------- */
.tiles-main { max-width: 1060px; }
.tiles-header { margin-bottom: 14px; }
.tiles-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tiles-spawns-toggle {
  font-size: 12px;
  color: var(--dim);
  gap: 6px;
}
.tiles-form {
  display: flex;
  gap: 8px;
}
.tiles-form input {
  width: 240px;
  max-width: 38%;
  background: #12131a;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
}
.tiles-form select {
  flex: 1;
  min-width: 0;
  background: #12131a;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.tiles-form input:focus, .tiles-form select:focus { outline: none; border-color: var(--accent); }
.tiles-cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--edge);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.tiles-cat-avg {
  font-size: 11px;
  font-weight: 500;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.tiles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #141720;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--edge);
  border-radius: 7px;
  padding: 10px 12px;
}
.tile-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.tile-idx {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  background: #1a1d28;
  border: 1px solid var(--edge);
  border-radius: 5px;
  padding: 4px 7px;
  font-variant-numeric: tabular-nums;
}
.tile-info { min-width: 0; flex: 1; }
.tile-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.tile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tile-prefab {
  font-size: 11px;
  color: var(--dim);
  background: #101219;
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: monospace;
}
.tile-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 6px;
  background: rgba(88, 183, 255, 0.14);
  color: var(--accent);
}
.tile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tile-stat {
  font-size: 11px;
  color: var(--dim);
  background: #101219;
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}
.tile-stat.good {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}
.tile-stat.bad {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.tile-path {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--dim);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-plan-wrap {
  flex-shrink: 0;
  width: 196px;
  background: #0b0c10;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 5px 6px 4px;
}
.tile-plan-cap {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 3px;
}
.tile-plan-svg {
  display: block;
  width: 100%;
  height: 92px;
}
.tile-plans {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: stretch;
}
.tile-plan-wrap.elev { width: 152px; }
.tiles-sync-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.tiles-submit-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}
.tiles-submit-wrap input {
  width: 165px;
  background: #12131a;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
}
.tiles-subs-wrap {
  margin-top: 8px;
  background: #12141c;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 10px;
}
.tiles-subs-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}
.tile-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}
.tile-custom-name {
  width: 170px;
  background: #101219;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11.5px;
  font-family: inherit;
}
.tile-custom-name:focus { outline: none; border-color: var(--accent); }
.tile-grade-sel {
  background: #101219;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11.5px;
  cursor: pointer;
}
.tile-3d-btn {
  background: #14202e;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.tile-3d-btn:hover { background: rgba(88, 183, 255, 0.22); }
.tile-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 6, 10, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tile-modal[hidden] { display: none; }
.tile-modal-card {
  width: min(860px, 96vw);
  height: min(600px, 88vh);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}
.tile-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--edge);
  font-weight: 600;
  font-size: 13px;
}
#tile-3d-canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
}
.tile-modal-hint {
  padding: 6px 14px;
  font-size: 11px;
  color: var(--dim);
  border-top: 1px solid var(--edge);
}
.an-3d-slider-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--dim);
}
.an-3d-slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.mi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mi-cfg-btn {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  cursor: pointer;
}
.mi-cfg-btn:hover, .mi-cfg-btn.active {
  color: var(--text);
  border-color: var(--accent);
}
.mi-cfg-panel {
  margin: 6px 0 4px;
  padding: 6px 8px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: rgba(11, 12, 16, 0.72);
  max-height: 240px;
  overflow-y: auto;
  font-size: 11px;
}
.mi-cfg-cat { margin-bottom: 6px; }
.mi-cfg-cat:last-child { margin-bottom: 0; }
.mi-cfg-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 3px;
}
.mi-cfg-actions {
  display: flex;
  gap: 4px;
}
.mi-cfg-actions button {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 9.5px;
  cursor: pointer;
}
.mi-cfg-actions button:hover { color: var(--text); border-color: var(--accent); }
.mi-cfg-types {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 4px;
}
.mi-cfg-types label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mi-cfg-types label:hover { color: var(--text); }
.mi-dot-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  font-size: 10px;
  line-height: 1.15;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(11, 12, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  white-space: nowrap;
  will-change: transform;
}
.mi-modal-card {
  width: min(980px, 92vw);
  height: min(680px, 86vh);
  display: flex;
  flex-direction: column;
}
.mi-modal-x {
  background: transparent;
  border: 1px solid var(--edge);
  color: var(--dim);
  border-radius: 5px;
  width: 26px;
  height: 26px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.mi-modal-x:hover {
  color: var(--text);
  border-color: var(--accent);
}
.mi-modal-toolbar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--edge);
  display: flex;
  align-items: center;
  gap: 10px;
}
.mi-modal-zero-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
  cursor: pointer;
}
.mi-modal-toolbar input[type="text"] {
  flex: 1;
  background: #0b0c10;
  border: 1px solid var(--edge);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.mi-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-content: start;
}
.mi-modal-body .mi-cfg-cat {
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(11, 12, 16, 0.55);
  margin-bottom: 0;
}
.mi-modal-body .mi-cfg-types {
  display: block;
  max-height: 175px;
  overflow-y: auto;
  padding-right: 4px;
}
.mi-modal-body .mi-cfg-types label {
  margin-bottom: 3px;
}
.mi-cfg-zero { opacity: 0.55; }
@media (max-width: 720px) {
  .tile-row { flex-direction: column; align-items: stretch; }
  .tile-plans { flex-direction: column; }
  .tile-plan-wrap, .tile-plan-wrap.elev { width: 100%; }
}
