:root{
  --bg0:#05060a;
  --bg1:#070a12;
  --panel: rgba(0,0,0,0.28);
  --stroke: rgba(255,255,255,0.10);
  --txt: rgba(234,240,255,0.92);
  --muted: rgba(234,240,255,0.68);
  --cyan:#22d3ee;
  --blue:#60a5fa;
  --red:#ff2c2c;
  --green:#34d399;
  --amber:#fbbf24;

  --wl1:#a78bfa;
  --wl2:#f472b6;
  --wl3:#34d399;
  --wl4:#fbbf24;
  --wl5:#22d3ee;

  --radius: 18px;
}

*{ box-sizing: border-box; }
html,body{ height:100%; margin:0; background: radial-gradient(1200px 700px at 50% -10%, #11183a 0%, var(--bg0) 50%, #03040a 100%); color: var(--txt); font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; }
#app{ position: relative; width:100%; height:100%; overflow:hidden; }

#stage{ position:absolute; inset:0; }
.layer{ position:absolute; inset:0; opacity:1; transition: opacity 420ms ease, filter 420ms ease; will-change: opacity, filter; }
#globeLayer{ z-index:1; }
#tilesLayer{ z-index:2; }
#stage.mode-3d #globeLayer{ opacity:1; pointer-events:auto; filter:none; }
#stage.mode-3d #tilesLayer{ opacity:0; pointer-events:none; filter: blur(8px); }
#stage.mode-2d #globeLayer{ opacity:0; pointer-events:none; filter: blur(8px); }
#stage.mode-2d #tilesLayer{ opacity:1; pointer-events:auto; filter:none; }

.overlay{ position:absolute; inset:0; z-index:30; display:flex; align-items:center; justify-content:center; backdrop-filter: blur(10px); background: rgba(0,0,0,0.35); }
.overlayCard{ width:min(520px, 92vw); padding:18px 16px; border-radius: 22px; border:1px solid rgba(255,255,255,0.10); background: rgba(0,0,0,0.45); box-shadow: 0 0 34px rgba(34,211,238,0.12); display:flex; align-items:center; gap:14px; }
.spinner{ width:26px; height:26px; border-radius:999px; border:2px solid rgba(255,255,255,0.25); border-top-color: rgba(34,211,238,0.95); animation: spin 0.9s linear infinite; }
@keyframes spin{ to{ transform: rotate(360deg);} }
.overlayTitle{ font-weight:800; letter-spacing:0.2px; }
.overlaySub{ color: var(--muted); font-size: 12px; margin-top:2px; }

.topbar{
  position:absolute; left:16px; right:16px; top:14px; z-index:20;
  display:flex; gap:10px; align-items:center; justify-content:space-between;
}
.topbar .left, .topbar .right{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.brand{
  display:flex; gap:10px; align-items:center;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.35);
  box-shadow: 0 0 22px rgba(34,211,238,0.08);
}
.brand .dot{
  width:8px; height:8px; border-radius:999px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(34,211,238,0.45);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{ transform:scale(1); opacity:0.75;} 50%{ transform:scale(1.35); opacity:1; } }
.pill{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  font-size: 12px;
  color: rgba(234,240,255,0.86);
  white-space: nowrap;
}

.seg{
  display:flex; gap:6px;
  padding:6px;
  border-radius: 16px;
  background: rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.10);
}
.seg button{
  cursor:pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
}
.seg button.active{
  color:#fff;
  border-color: rgba(34,211,238,0.35);
  background: rgba(34,211,238,0.10);
  box-shadow: 0 0 24px rgba(34,211,238,0.12);
}

.panel{
  position:absolute;
  top: 74px;
  bottom: 18px;
  width: 360px;
  z-index:20;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.26);
  box-shadow: 0 0 36px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  overflow:hidden;
}
.panel.right{ right: 16px; }
.panel.left{ left: 16px; }

@media (max-width: 980px){
  .panel.left{ display:none; }
  .panel.right{ width: 360px; }
}


.panel .inner{ padding: 12px; height:100%; overflow:auto; }
.card{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  box-shadow: 0 0 22px rgba(34,211,238,0.06);
  padding: 12px;
  margin-bottom: 10px;
}
.cardTitle{
  display:flex; align-items:center; justify-content:space-between;
  font-weight:800; letter-spacing:0.2px;
}
.cardSub{ color: var(--muted); font-size: 12px; margin-top:4px; }
.row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.kpi{
  display:flex; flex-direction:column; gap:2px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  min-width: 105px;
}
.kpi .k{ color: var(--muted); font-size: 11px; }
.kpi .v{ font-weight: 900; }
canvas{ max-width:100%; }

.tooltip{
  position:absolute; left:0; top:0; z-index:25;
  transform: translate(-9999px, -9999px);
  pointer-events:none;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.74);
  border: 1px solid rgba(255,60,60,0.35);
  box-shadow: 0 0 22px rgba(255,44,44,0.18);
  font-size: 12px;
  color: #fff;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* Buttons */
.btn{
  cursor:pointer;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.30);
  color: rgba(234,240,255,0.92);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
}
.btn:hover{ border-color: rgba(34,211,238,0.35); box-shadow: 0 0 18px rgba(34,211,238,0.10); }

a.btn{ text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.buyBtn{ padding:6px 12px; border-radius:999px; font-weight:900; letter-spacing:0.2px;
  background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.30);
  box-shadow: 0 0 16px rgba(34,211,238,0.10);
}
.buyBtn:hover{ background: rgba(34,211,238,0.16); border-color: rgba(34,211,238,0.42); }

/* Leaflet flow styling */
.leaflet-interactive.flowLine{ filter: drop-shadow(0 0 6px rgba(34,211,238,0.18)); }
.leaflet-interactive.flowDot{ filter: drop-shadow(0 0 10px rgba(34,211,238,0.22)); }
.btn.ghost{ background: transparent; }
.iconBtn{
  cursor:pointer;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.28);
  color: rgba(234,240,255,0.92);
  width: 34px; height: 34px;
  border-radius: 12px;
}

/* Modals */
.modalBackdrop{
  position:absolute; inset:0; z-index:40;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
}
.modal{
  position:absolute; z-index:50;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(820px, 92vw);
  max-height: min(78vh, 720px);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(3,6,12,0.92);
  box-shadow: 0 0 44px rgba(0,0,0,0.65);
  overflow:hidden;
}
.modalWide{ width: min(980px, 94vw); }
.modalHeader{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 12px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.modalTitle{ font-weight: 900; letter-spacing:0.2px; }
.modalBody{ padding: 12px; overflow:auto; max-height: calc(min(78vh, 720px) - 58px); }
.modalMeta{ color: var(--muted); font-size: 12px; margin-bottom: 10px; }

.listControls{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom: 10px; }
.pager{ display:flex; gap:8px; align-items:center; }
.pagerInfo{ color: var(--muted); font-size: 12px; min-width: 70px; text-align:center; }

.botList{ display:flex; flex-direction:column; gap:8px; }
.botRow{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
}
.botRow:hover{ border-color: rgba(34,211,238,0.35); box-shadow: 0 0 18px rgba(34,211,238,0.08); }
.badges{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.badge{
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  color: rgba(234,240,255,0.86);
}
.badge.on{ border-color: rgba(52,211,153,0.35); background: rgba(52,211,153,0.12); }
.badge.off{ border-color: rgba(255,44,44,0.35); background: rgba(255,44,44,0.12); }
.badge.my{ border-color: rgba(96,165,250,0.35); background: rgba(96,165,250,0.12); }
.badge.wl{ border-color: rgba(167,139,250,0.35); background: rgba(167,139,250,0.12); }

.botDetailsGrid{
  display:grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}
@media (max-width: 900px){
  .panel.right{ width: 320px; }
  .botDetailsGrid{ grid-template-columns: 1fr; }
}

.detailCard{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  padding: 12px;
}
.detailTitle{ font-weight: 900; margin-bottom: 8px; }
.detailKV{ display:flex; justify-content:space-between; gap:12px; padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,0.08); }
.detailKV:last-child{ border-bottom: none; }
.detailKV .k{ color: var(--muted); font-size: 12px; }
.detailKV .v{ font-weight: 800; }


/* WL demo buy button */
.buyBtn{
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.2px;
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.30);
  box-shadow: 0 0 18px rgba(34,211,238,0.12);
}
.buyBtn:hover{
  background: rgba(34,211,238,0.16);
  border-color: rgba(34,211,238,0.45);
  box-shadow: 0 0 22px rgba(34,211,238,0.18);
}

/* 2D strategy flow visibility */
.leaflet-interactive.flowLine{
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.08));
}
.leaflet-interactive.flowDot{
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.10));
}
