/* Мир: окна стоят на большой карте, камера летает между ними по нитям */
.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 2300px;
  height: 1450px;
  transform-origin: 0 0;
}

.world.is-moving {
  will-change: transform;
}

.threads,
.flights {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.flights {
  z-index: 5;
}

/* ---------- Нити ---------- */
.thread {
  fill: none;
  stroke: rgba(206, 49, 34, 0.42);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.thread-halo {
  fill: none;
  stroke: rgba(206, 49, 34, 0.1);
  stroke-width: 12;
  stroke-linecap: round;
}

.thread-dot {
  fill: var(--night);
  stroke: rgba(206, 49, 34, 0.6);
  stroke-width: 2;
  transition: opacity 0.4s;
}

.app.is-night .thread {
  stroke: rgba(206, 49, 34, 0.3);
}

/* ---------- Полёт метки ---------- */
.lit {
  fill: none;
  stroke: var(--signal-hi);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.9;
  transition: opacity 1.2s ease;
}

.lit.is-off {
  opacity: 0;
}

.tail {
  fill: none;
  stroke: var(--signal-hi);
  stroke-linecap: round;
}

.tail--1 {
  stroke-width: 6;
}

.tail--2 {
  stroke-width: 3.5;
  opacity: 0.5;
}

.fl--cmd .lit,
.fl--cmd .tail,
.fl--report .lit,
.fl--report .tail {
  stroke: var(--bone);
}

.fl--cmd .lit,
.fl--report .lit {
  opacity: 0.6;
}

.fl.is-docked .tail {
  opacity: 0;
  transition: opacity 0.2s;
}

.tok__in {
  transform-box: fill-box;
  transform-origin: center;
}

.tok__box {
  fill: var(--signal);
}

.tok__txt {
  font: 800 12px var(--head);
  letter-spacing: 0.03em;
  fill: #fff;
}

.fl--cmd .tok__box,
.fl--report .tok__box {
  fill: var(--bone);
}

.fl--cmd .tok__txt,
.fl--report .tok__txt {
  fill: var(--ink);
}

.fl--alert .tok__box {
  fill: #2A1411;
  stroke: var(--signal-hi);
  stroke-width: 2;
}

.fl--alert .tok__txt {
  fill: var(--signal-hi);
}

.fl.is-docked .tok__in {
  animation: dock 0.4s var(--ease-out) forwards;
}

.fl.is-blocked .tok__in {
  animation: jolt 0.5s ease-in-out, fadeout 0.45s ease-in 1s forwards;
}

.fl__stop {
  font: 800 11px var(--head);
  letter-spacing: 0.1em;
  fill: var(--signal-hi);
  animation: fadeout 0.45s ease-in 1.2s forwards;
}

/* Круги, которые расходятся от окна, куда прилетела метка */
.ripple {
  fill: none;
  stroke: var(--signal-hi);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: ripple 0.9s var(--ease-out) forwards;
}

.ripple--cmd {
  stroke: var(--bone);
}

@keyframes ripple {
  from { opacity: 0.9; transform: scale(0.3); }
  to { opacity: 0; transform: scale(2.6); }
}

@keyframes dock {
  to { transform: scale(0.2); opacity: 0; }
}

@keyframes jolt {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes fadeout {
  to { opacity: 0; }
}

/* ---------- Окна ---------- */
.win {
  position: absolute;
  z-index: 2;
  border-radius: 26px;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  box-shadow:
    0 60px 120px -50px rgba(0, 0, 0, 0.85),
    0 20px 40px -24px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(242, 238, 231, 0.08);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.9s var(--spring),
    filter 0.7s var(--ease-out);
}

/* Окно уже встречалось, но сейчас главное не в нём */
.win.is-dim {
  opacity: 0.34;
  filter: saturate(0.4) brightness(0.8);
  transform: scale(0.97);
}

/* Окно ещё не появлялось. Правило ниже «приглушённого», чтобы скрытое не просвечивало */
.win.is-hidden {
  opacity: 0;
  transform: translateY(26px) scale(0.86);
  pointer-events: none;
}

.win.is-hit::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: win-hit 1.1s var(--ease-out) forwards;
}

.win.is-hit-cmd::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: win-hit-cmd 1.1s var(--ease-out) forwards;
}

@keyframes win-hit {
  0% { box-shadow: inset 0 0 0 2px rgba(224, 71, 58, 0.95), inset 0 0 40px rgba(224, 71, 58, 0.25); }
  100% { box-shadow: inset 0 0 0 2px rgba(224, 71, 58, 0), inset 0 0 40px rgba(224, 71, 58, 0); }
}

@keyframes win-hit-cmd {
  0% { box-shadow: inset 0 0 0 2px rgba(23, 19, 15, 0.5), inset 0 0 30px rgba(23, 19, 15, 0.08); }
  100% { box-shadow: inset 0 0 0 2px rgba(23, 19, 15, 0), inset 0 0 30px rgba(23, 19, 15, 0); }
}

.app.is-night .win:not(.win--robot):not(.is-hidden) {
  filter: brightness(0.62) saturate(0.7);
}

.app.is-night .win.is-dim:not(.win--robot) {
  filter: brightness(0.45) saturate(0.4);
}

/* Подписи над окнами */
.tag {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: rgba(27, 22, 18, 0.7);
  border: 1px solid var(--glass-line);
  font: 700 11px/1 var(--head);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sand);
  white-space: nowrap;
  transition: opacity 0.7s var(--ease-out), transform 0.9s var(--spring);
}

.tag i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
}

.tag.is-dim {
  opacity: 0.35;
}

.tag.is-hidden {
  opacity: 0;
  transform: translateY(10px);
}
