.intel-view-tabs {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(54px, 1fr));
  border-right: 1px solid var(--line);
}

.intel-view-tabs button,
.intel-world-lenses button,
.intel-world-locations button,
.intel-world-mobile-switch button,
.intel-open-world {
  min-height: 26px;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  color: var(--secondary);
  font: 900 10px var(--mono);
}

.intel-view-tabs button[aria-pressed="true"],
.intel-world-lenses button[aria-pressed="true"],
.intel-world-locations button[aria-pressed="true"],
.intel-world-mobile-switch button[aria-pressed="true"] {
  color: #fff;
  background: #0b0b0b;
  box-shadow: inset 0 -2px var(--amber);
}

.intel-view-tabs button:focus-visible,
.intel-world-lenses button:focus-visible,
.intel-world-locations button:focus-visible,
.intel-world-node:focus-visible,
.intel-world-event-row:focus-visible,
.intel-world-mobile-switch button:focus-visible,
.intel-open-world:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: -2px;
}

.intel-open-world {
  width: 100%;
  min-height: 32px;
  border-bottom: 1px solid var(--line-hot);
  color: var(--amber);
  text-align: left;
}

.intel-world-workspace {
  display: none;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-top: 2px solid var(--amber);
  background: #020202;
}

.s5-intelligence[data-intel-mode="WORLD"] .intel-rail,
.s5-intelligence[data-intel-mode="WORLD"] .intel-wire,
.s5-intelligence[data-intel-mode="WORLD"] .intel-detail {
  display: none;
}

.s5-intelligence[data-intel-mode="WORLD"] .intel-world-workspace {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  /* 67.8% of the operational surface is the map/context field. */
  grid-template-columns: minmax(0, 1.9fr) minmax(310px, .9fr);
  gap: 2px;
}

.intel-world-map-pane,
.intel-world-side {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #040504;
}

.intel-world-map-pane {
  display: grid;
  grid-template-rows: 39px 32px minmax(0, 1fr) 34px;
}

.intel-world-head,
.intel-world-wire-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
  background: #070707;
}

.intel-world-head div {
  min-width: 0;
}

.intel-world-head span {
  display: block;
  overflow: hidden;
  color: var(--dim);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intel-world-head h2 {
  margin: 1px 0 0;
  color: var(--text);
  font: 900 14px/16px var(--sans);
  letter-spacing: .02em;
}

.intel-world-head > b,
.intel-world-wire-head > span {
  color: var(--positive);
  font-size: 10px;
  white-space: nowrap;
}

.intel-world-lenses {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  border-bottom: 1px solid var(--line);
  background: #050505;
}

.intel-world-lenses button {
  min-height: 31px;
}

.intel-world-map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(#101410 1px, transparent 1px) 0 0 / 100% 20%,
    linear-gradient(90deg, #101410 1px, transparent 1px) 0 0 / 12.5% 100%,
    radial-gradient(ellipse at 50% 47%, #09110b 0%, #040604 55%, #010201 100%);
}

.intel-world-map-stage::before,
.intel-world-map-stage::after {
  position: absolute;
  z-index: 0;
  content: "";
  pointer-events: none;
}

.intel-world-map-stage::before {
  inset: 7% 3%;
  border: 1px solid #1b241d;
}

.intel-world-map-stage::after {
  left: 50%;
  top: 0;
  bottom: 0;
  border-left: 1px solid #151b16;
}

.intel-world-land,
.intel-world-land i {
  position: absolute;
  pointer-events: none;
}

.intel-world-land {
  z-index: 0;
  inset: 9% 5%;
  opacity: .82;
}

.intel-world-land i {
  display: block;
  background: #162219;
  box-shadow: inset 0 0 0 1px #26392b;
}

.intel-world-land .north-america { left: 7%; top: 12%; width: 27%; height: 32%; clip-path: polygon(4% 23%,31% 0,71% 8%,100% 39%,75% 64%,62% 100%,31% 80%,17% 55%); }
.intel-world-land .south-america { left: 24%; top: 49%; width: 13%; height: 42%; clip-path: polygon(11% 0,84% 9%,100% 30%,66% 100%,42% 85%,18% 42%); }
.intel-world-land .europe { left: 43%; top: 16%; width: 17%; height: 19%; clip-path: polygon(0 38%,28% 8%,70% 0,100% 49%,72% 100%,30% 78%); }
.intel-world-land .africa { left: 45%; top: 38%; width: 17%; height: 42%; clip-path: polygon(6% 0,86% 5%,100% 35%,58% 100%,25% 78%,0 29%); }
.intel-world-land .asia { left: 55%; top: 12%; width: 35%; height: 43%; clip-path: polygon(0 30%,21% 5%,55% 0,100% 31%,82% 68%,55% 100%,29% 79%,10% 61%); }
.intel-world-land .oceania { left: 78%; top: 63%; width: 15%; height: 19%; clip-path: polygon(0 22%,39% 0,100% 37%,78% 100%,26% 78%); }

.intel-world-node {
  position: absolute;
  z-index: 2;
  left: var(--world-x);
  top: var(--world-y);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 104px;
  min-height: 52px;
  padding: 5px 7px;
  transform: translate(-50%, -50%);
  border: 1px solid #35533c;
  color: var(--text);
  background: #050706ed;
  font: 10px/1.15 var(--mono);
  text-align: left;
}

.intel-world-node::before {
  position: absolute;
  left: -5px;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translateY(-50%);
  border: 1px solid #071008;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 2px #193420;
  content: "";
}

.intel-world-node > span {
  overflow: hidden;
  color: var(--amber);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intel-world-node strong {
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.intel-world-node small {
  grid-column: 1 / -1;
  margin-top: 3px;
  overflow: hidden;
  color: var(--dim);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intel-world-node[aria-pressed="true"] {
  border-color: var(--cyan);
  box-shadow: inset 0 -2px var(--cyan), 0 0 0 1px #0c323c;
}

.intel-world-node:disabled {
  opacity: .28;
}

.intel-world-node:disabled::before {
  background: var(--dim);
  box-shadow: none;
}

.intel-world-caption {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 9px;
  border-top: 1px solid var(--line);
  color: var(--secondary);
  background: #070707;
}

.intel-world-caption b { color: var(--cyan); }
.intel-world-caption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.intel-world-caption small { color: var(--warning); font-size: 10px; white-space: nowrap; }

.intel-world-side {
  display: grid;
  grid-template-rows: 38px auto minmax(150px, 1fr) minmax(178px, .72fr);
}

.intel-world-wire-head > b {
  color: var(--amber);
  letter-spacing: .06em;
}

.intel-world-locations {
  display: flex;
  min-height: 32px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.intel-world-locations button {
  flex: 0 0 auto;
  min-height: 31px;
  white-space: nowrap;
}

.intel-world-event-wire {
  min-height: 0;
  overflow: auto;
}

.intel-world-event-row {
  display: grid;
  grid-template-columns: 42px 78px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 45px;
  padding: 3px 6px;
  border-bottom: 1px solid #171b17;
  color: var(--secondary);
  font: 10px/1.2 var(--mono);
  text-align: left;
}

.intel-world-event-row time { color: var(--amber); font-variant-numeric: tabular-nums; }
.intel-world-event-row > b { overflow: hidden; color: var(--cyan); text-overflow: ellipsis; white-space: nowrap; }
.intel-world-event-row strong { overflow: hidden; color: #fff; text-overflow: ellipsis; white-space: nowrap; }
.intel-world-event-row small { grid-column: 3; overflow: hidden; color: var(--dim); text-overflow: ellipsis; white-space: nowrap; }
.intel-world-event-row[aria-selected="true"],
.intel-world-event-row:hover { background: #111710; box-shadow: inset 3px 0 var(--cyan); }

.intel-world-detail {
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--line-hot);
}

.intel-world-detail > header {
  min-height: 27px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--amber);
  font-weight: 900;
}

.intel-world-detail .detail-bucket { display: inline-block; margin: 6px 8px 0; padding: 2px 4px; color: #050505; background: var(--amber); font-weight: 900; }
.intel-world-detail h2 { margin: 5px 8px; color: #fff; font: 900 12px/15px var(--sans); }
.intel-world-detail > p { margin: 5px 8px; color: var(--secondary); }
.intel-world-detail dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); margin: 6px 8px; border: 1px solid var(--line); }
.intel-world-detail dt,
.intel-world-detail dd { min-height: 25px; margin: 0; padding: 5px; border-bottom: 1px solid var(--line); }
.intel-world-detail dt { color: var(--amber); }
.intel-world-detail dd { overflow-wrap: anywhere; border-left: 1px solid var(--line); }
.intel-world-detail > a { display: inline-flex; align-items: center; min-height: 28px; margin: 0 8px 8px; padding: 0 7px; border: 1px solid var(--cyan); color: var(--cyan); }

.intel-world-mobile-switch {
  display: none;
}

@media (max-width: 1120px) and (min-width: 761px) {
  .intel-controls { overflow-x: auto; }
  .s5-intelligence[data-intel-mode="WORLD"] .intel-world-workspace {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.72fr) minmax(290px, .92fr);
  }
  .intel-world-node { min-width: 88px; }
  .intel-world-caption small { display: none; }
}

@media (max-width: 760px) {
  .intel-controls { gap: 2px; }
  .intel-controls input { flex-basis: 132px; width: 132px; }
  .intel-view-tabs { flex: 0 0 116px; }
  .intel-view-tabs button { min-height: 38px; padding: 0 4px; }

  .s5-intelligence[data-intel-mode="WORLD"] .intel-world-workspace {
    grid-column: 1;
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 44px minmax(0, 1fr);
    gap: 0;
  }

  .intel-world-mobile-switch {
    z-index: 4;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: repeat(2, 1fr);
    border-bottom: 1px solid var(--line-hot);
  }

  .intel-world-mobile-switch button { min-height: 44px; }
  .intel-world-map-pane,
  .intel-world-side { grid-column: 1; grid-row: 2; }
  .s5-intelligence[data-world-mobile="MAP"] .intel-world-side,
  .s5-intelligence[data-world-mobile="WIRE"] .intel-world-map-pane { display: none; }

  .intel-world-map-pane { grid-template-rows: 38px 44px minmax(0, 1fr) 34px; }
  .intel-world-head { padding: 0 6px; }
  .intel-world-head h2 { font-size: 12px; }
  .intel-world-head span { display: none; }
  .intel-world-head > b { max-width: 56%; overflow: hidden; text-overflow: ellipsis; }
  .intel-world-lenses button { min-width: 0; min-height: 44px; padding: 0 2px; }
  .intel-world-node { min-width: 68px; min-height: 44px; padding: 3px 4px; }
  .intel-world-node > span { font-size: 9px; }
  .intel-world-node strong { font-size: 11px; }
  .intel-world-node small { font-size: 9px; }
  .intel-world-node:disabled { display: none; }
  .intel-world-caption { grid-template-columns: auto minmax(0, 1fr); gap: 6px; padding: 0 6px; }
  .intel-world-caption small { display: none; }

  .intel-world-side { grid-template-rows: 36px 44px minmax(155px, 1fr) minmax(150px, .82fr); }
  .intel-world-locations { min-height: 44px; }
  .intel-world-locations button { min-height: 44px; }
  .intel-world-event-row { min-height: 48px; }
  .intel-world-detail dl { grid-template-columns: 82px minmax(0, 1fr); }

  .s5-intelligence[data-mobile-surface="WORLD"] .intel-mobile-dock button[data-intel-target="WORLD"] {
    color: #fff;
    background: #090909;
    box-shadow: inset 0 -2px var(--amber);
  }
}
