/* ============================================================
   RESUMEEASY · BIBABOBA — стили НЕЙРО-HUD
   Живая нейросеть: чёрный космос, сферы-ядра со своим светом,
   дорожки-аксоны с градиентами, циан HUD, оранж ошибок
   ============================================================ */

:root {
  --bg: #030810;
  --panel: rgba(8, 22, 38, 0.72);
  --line: rgba(25, 200, 255, 0.18);
  --cyan: #19c8ff;
  --cyan-soft: rgba(25, 200, 255, 0.35);
  --green: #2bffb0;
  --amber: #ffb54d;
  --red: #ff5f47;
  --text: #cfefff;
  --dim: #5f87a8;
  --font-head: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  letter-spacing: 0.02em;
}

/* ---------- фон ---------- */
#bg { position: fixed; inset: 0; z-index: 0; }

#scanlines {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ---------- каркас ---------- */
#app {
  position: relative; z-index: 10;
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-rows: 54px 1fr 218px;
  gap: 10px; padding: 10px 12px;
}

main {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 10px; min-height: 0;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(3px);
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
}

/* уголки-скобки как у HUD */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 2px solid var(--cyan-soft); pointer-events: none;
}
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel-title {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 8px 12px 6px;
  font-family: var(--font-head);
  font-size: 12px; font-weight: 700; letter-spacing: 0.22em;
  color: var(--cyan);
  border-bottom: 1px solid var(--line);
  text-shadow: 0 0 8px var(--cyan-soft);
  flex: 0 0 auto;
  white-space: nowrap;
}
.panel-title > span:first-child { flex: 0 0 auto; }
.panel-title .hint {
  font-family: var(--font-body); font-weight: 500; font-size: 11px;
  letter-spacing: 0.06em; color: var(--dim); text-shadow: none;
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  align-self: center;
}

/* ---------- верхняя панель ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); padding: 0 14px;
  backdrop-filter: blur(3px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  color: var(--cyan); font-size: 22px;
  text-shadow: 0 0 12px var(--cyan);
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse { 50% { text-shadow: 0 0 22px var(--cyan); opacity: .85; } }
.brand-name {
  font-family: var(--font-head); font-weight: 900; font-size: 16px;
  letter-spacing: 0.28em; color: var(--text);
}
/* многоцветное имя бренда: переливается всей палитрой планет —
   только если браузер умеет background-clip:text, иначе обычный цвет */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand-name {
    background: linear-gradient(90deg, #ffd166, #ff5d9e, #b18cff, #22d3ee, #4ade80, #ffd166);
    background-size: 320% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: hueflow 12s ease-in-out infinite;
  }
}
@keyframes hueflow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.brand-sub {
  font-family: var(--font-head); font-weight: 500; font-size: 11px;
  letter-spacing: 0.34em; color: var(--cyan);
  border-left: 1px solid var(--line); padding-left: 10px;
}
.top-status { display: flex; align-items: center; gap: 8px; }

.chip {
  font-family: var(--font-head); font-size: 10px; letter-spacing: 0.14em;
  color: var(--cyan); background: rgba(25, 200, 255, 0.08);
  border: 1px solid var(--cyan-soft); border-radius: 4px;
  padding: 4px 8px; cursor: pointer; user-select: none;
  transition: background .2s, box-shadow .2s;
}
.chip:hover { background: rgba(25, 200, 255, 0.18); box-shadow: 0 0 10px var(--cyan-soft); }
.chip.warn { color: var(--amber); border-color: rgba(255, 181, 77, 0.4); background: rgba(255, 181, 77, 0.08); }
.chip.warn:hover { background: rgba(255, 181, 77, 0.16); }
.chip.ghost { color: var(--dim); border-color: rgba(95, 135, 168, 0.35); background: transparent; cursor: default; }

.conn { display: flex; align-items: center; gap: 6px; font-family: var(--font-head); font-size: 10px; letter-spacing: 0.14em; color: var(--dim); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.conn.on { color: var(--green); }
.conn.on i { background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 2s infinite; }
.conn.off { color: var(--red); }
.conn.off i { background: var(--red); animation: blink 0.8s infinite; }
.conn.mid { color: #ffb020; }
.conn.mid i { background: #ffb020; box-shadow: 0 0 8px #ffb020; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.clock { font-family: var(--font-head); font-size: 14px; color: var(--text); letter-spacing: 0.14em; text-shadow: 0 0 8px var(--cyan-soft); }

/* ---------- карта (SVG) ---------- */
#mapPanel { overflow: hidden; }
#mapWrap { flex: 1; min-height: 0; }
#map { width: 100%; height: 100%; display: block; }

/* нейро-сферы — СТЕКЛЯННЫЕ ПЛАНЕТЫ: почти прозрачное стекло (градиент из
   JS) + тонкий обод + уникальный рисунок внутри (tex) + блик + мягкий
   ореол; вокруг — молекулярная сетка (orbit-line + orb + bond).
   Планеты можно ПЕРЕТАСКИВАТЬ мышью/пальцем — связи тянутся следом. */
.nd { cursor: grab; touch-action: none; }
.nd.drag { cursor: grabbing; }
#map { touch-action: none; user-select: none; -webkit-user-select: none; }
/* ЖИВАЯ СЦЕНА: гало каждой планеты постоянно медленно дышит (масштаб),
   а ядро — светится волнами; фазы разведены инлайн-задержками из JS,
   поэтому все планеты дышат вразнобой — видно, что всё анимировано */
.nd .halo { opacity: .10; transition: opacity .9s ease;
  transform-box: fill-box; transform-origin: center;
  animation: haloBreath 5.2s ease-in-out infinite; }
@keyframes haloBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }
.nd .core { animation: corePulse 3.8s ease-in-out infinite; }
.nd.active .halo { opacity: .42; }
.nd.done .halo { opacity: .22; }
.nd.err .halo { opacity: .30; }
.nd .spec { fill: rgba(255, 255, 255, .26); filter: blur(1.5px); pointer-events: none; transition: opacity .8s ease; }
.nd .core {
  stroke: none;
  transition: filter .8s ease;
}
.nd .rim {
  fill: none; stroke: currentColor; stroke-opacity: .45; stroke-width: 1.2;
  transition: stroke .8s ease, stroke-opacity .8s ease, filter .8s ease;
}
/* уникальный рисунок планеты — тонкими линиями, материал один */
.nd .texg { pointer-events: none; }
.nd .tex {
  fill: none; stroke: currentColor; stroke-width: 1.1; stroke-opacity: .34;
  stroke-linecap: round; stroke-linejoin: round;
  transition: stroke-opacity .8s ease;
}
.nd .tex.dim { stroke-opacity: .20; }
.nd .texdot { fill: currentColor; fill-opacity: .5; transition: fill .8s ease; }
.nd .texdot.big { fill-opacity: .75; }
/* молекулярная сетка вокруг планеты: орбита + атомы + связи соседей */
.nd .orbit-line { fill: none; stroke: currentColor; stroke-opacity: .14; stroke-width: 1; transition: stroke-opacity .8s ease; }
.nd .orb { fill: currentColor; transition: fill .8s ease; }
.nd .bond { stroke: currentColor; stroke-width: .8; opacity: .15; transition: stroke .8s ease; }
.nd .glyph { transition: filter .8s ease, opacity .8s ease; }
.nd .gicon {
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; opacity: .92;
}
.nd .nlabel {
  font-family: var(--font-head); font-weight: 700; font-size: 11.5px; letter-spacing: 0.16em;
  text-anchor: middle; fill: var(--text); transition: fill .8s ease, text-shadow .8s ease;
}
.nd .nsub {
  font-family: var(--font-body); font-weight: 500; font-size: 10.5px;
  text-anchor: middle; fill: var(--dim);
}
.nd .dot { fill: currentColor; fill-opacity: .5; transition: fill .8s ease, fill-opacity .8s ease; }

/* молекулы живут постоянно (анимация в JS); когда узел берёт работу —
   планета «кипит»: атомы ускоряются, рисунок и обод загораются */
.nd.active .rim, .nd.burst .rim { stroke-opacity: 1; }
.nd.active .tex { stroke-opacity: .62; }
.nd.active .tex.dim { stroke-opacity: .38; }
.nd.active .orbit-line { stroke-opacity: .30; }
.nd.active .bond { opacity: .30; }
@keyframes corePulse { 50% { filter: drop-shadow(0 0 22px currentColor); } }
.nd.active .core {
  filter: drop-shadow(0 0 10px currentColor);
  animation: corePulse 1.5s ease-in-out infinite;
}
.nd.active .glyph { filter: drop-shadow(0 0 9px currentColor); }
.nd.active .nlabel { fill: currentColor; text-shadow: 0 0 10px currentColor; }
.nd.active .dot { fill-opacity: 1; filter: drop-shadow(0 0 6px currentColor); animation: blink 1.4s infinite; }

/* ЕДИНЫЙ СТИЛЬ: завершение тоже в цвете самой сферы (никакого чужого
   зелёного) — отличие от «в работе» даёт нейро-панцирь вокруг планеты */
.nd.done .rim { stroke: currentColor; stroke-opacity: .95; }
.nd.done .orb, .nd.done .texdot { fill: currentColor; }
.nd.done .bond { stroke: currentColor; }
.nd.done .nlabel { fill: currentColor; text-shadow: 0 0 10px currentColor; }
.nd.done .dot { fill: currentColor; fill-opacity: 1; }
/* плавное остывание из done/err в idle: классы снимает JS, а цвета
   переходят мягко за счёт transition выше */

/* ---------- КРУГОВАЯ ЗАГРУЗКА (в цвет сферы) ----------
   Пока в узле идёт процесс, вокруг планеты бежит дуга-спиннер:
   цвет — самой сферы (currentColor), никакого выбивающегося зелёного. */
.nd .loadring { display: none; pointer-events: none; }
.nd.active .loadring { display: block; }
.loadring .lr-track { fill: none; stroke: currentColor; stroke-opacity: .14; stroke-width: 1.4; }
.loadring .lr-arc {
  fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round;
  stroke-dasharray: 96 118; /* дуга ~43% окружности r=34 */
  transform-box: fill-box; transform-origin: center;
  animation: lrspin 1.15s linear infinite;
  filter: drop-shadow(0 0 5px currentColor);
}
@keyframes lrspin { to { transform: rotate(360deg); } }

/* ---------- НЕЙРО-ПАНЦИРЬ (после выполнения задачи) ----------
   Сфера «обрастает» панцирем: сегменты-пластины вокруг шара с
   синапсами-узлами и внешней сеточкой; цвет — самой сферы.
   Появляется с пружинкой, остывает вместе с узлом. */
.nd .shell {
  opacity: 0; pointer-events: none;
  transform-box: fill-box; transform-origin: center; transform: scale(.55) rotate(-14deg);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, 1.5, .35, 1);
}
.nd.done .shell { opacity: 1; transform: scale(1) rotate(0deg); }
.shell .sh-plate {
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round;
  opacity: .8; filter: drop-shadow(0 0 4px currentColor);
}
.shell .sh-node { fill: currentColor; }
.shell .sh-ring { fill: none; stroke: currentColor; stroke-opacity: .22; stroke-width: .7; stroke-dasharray: 2 7; }

/* ---------- ПОДТВЕРЖДЕНИЕ: бейдж «✓ ГОТОВО» над планетой ----------
   Выпрыгивает с пружиной в момент завершения, через несколько секунд тает. */
.nd .donemark {
  opacity: 0; pointer-events: none;
  transform-box: fill-box; transform-origin: center; transform: scale(.3);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2, 1.7, .4, 1);
}
.nd.done.donemark-on .donemark { opacity: 1; transform: scale(1); }
.donemark .dm-box { fill: rgba(4, 14, 24, .88); stroke: currentColor; stroke-opacity: .55; stroke-width: 1; }
.donemark .dm-text {
  font-family: var(--font-head); font-size: 8.5px; font-weight: 700;
  letter-spacing: .14em; fill: currentColor; text-anchor: middle;
}

.nd.err .rim { stroke: var(--red); stroke-opacity: 1; }
.nd.err .orb, .nd.err .texdot { fill: var(--red); }
.nd.err .bond { stroke: var(--red); }
.nd.err .nlabel { fill: var(--red); }
.nd.err .dot { fill: var(--red); fill-opacity: 1; animation: blink .5s infinite; }
.nd.err { animation: shake .45s ease-in-out 2; }
@keyframes shake {
  25% { transform: translateX(-2.5px); } 75% { transform: translateX(2.5px); }
}

.nd.planned .rim { stroke: rgba(95, 135, 168, 0.35); stroke-opacity: 1; stroke-dasharray: 2 5; }
.nd.planned .orbit-line { stroke: rgba(95, 135, 168, 0.35); stroke-opacity: .8; stroke-dasharray: 2 5; }
.nd.planned .orb, .nd.planned .texdot { fill: rgba(95, 135, 168, 0.35); }
.nd.planned .bond { stroke: rgba(95, 135, 168, 0.35); }
.nd.planned .nlabel { fill: var(--dim); }
.nd.planned .glyph { opacity: .45; }
.nd.planned .halo { opacity: .05; }

/* активный узел светится РОВНО; вспышка (мигание) — только на событие */
.nd.active .glowring { display: block; animation: none; opacity: .32; transform: scale(1.3); stroke: currentColor; }
.nd.burst .glowring { display: block; animation: breathe .55s ease-out 3; stroke: currentColor; }
.glowring { display: none; fill: none; stroke: currentColor; stroke-opacity: .6; stroke-width: 1; opacity: .6; transform-box: fill-box; transform-origin: center; animation: breathe 1.6s ease-out infinite; }
@keyframes breathe { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.7); opacity: 0; } }

/* связи-аксоны: три слоя жизни. Базовая дорожка тонкая, течение видно:
   штрихи бегут сами (9s); сама линия ещё и «дышит» — JS ведёт по ней
   медленную волну (undulation); поверх — постоянные фоновые искры (flow)
   и горячий слой (lkhot) со вспышкой на реальное событие. */
.lk { fill: none; stroke-width: 1.1; stroke-dasharray: 2 8; animation: dashflow 9s linear infinite; }
.lkhot {
  fill: none; stroke: var(--cyan); stroke-width: 1.6; stroke-dasharray: 2 8;
  opacity: 0; transition: opacity .55s ease, stroke .55s ease, filter .55s ease;
  animation: dashflow .8s linear infinite;
  pointer-events: none;
}
.lkhot.on { opacity: 1; }
.lkhot.err { stroke: var(--red) !important; }
@keyframes dashflow { to { stroke-dashoffset: -20; } }

/* фоновые нейро-импульсы: постоянно текут по каждой связи от источника
   к приёмнику; прозрачность искрит JS (мягкий вход/выход у узлов) */
.flow { opacity: 0; }

/* ярлыки связей — лаконичные ПИЛЮЛИ на тёмной подложке: появляются только
   на событие передачи, сами плавно исчезают; полная фраза — в окне сферы.
   Сами связи и ярлыки рисуются ПОД планетами — ничего не налипает. */
.lklabel {
  font-family: var(--font-body); font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em;
  text-anchor: middle; fill: rgba(190, 226, 245, .92);
  opacity: 0; transition: opacity .9s ease;
  pointer-events: none;
}
.lklabel.show { opacity: 1; }
.lklabel .lbl-bg {
  fill: rgba(3, 10, 20, .9); stroke: rgba(120, 180, 215, .28); stroke-width: .6;
}
.lklabel .lbl-tx { fill: inherit; }

/* бегущий импульс — появляется и тает плавно; цвет задаёт JS */
.pulse { fill: #bff2ff; filter: drop-shadow(0 0 4px var(--cyan)); opacity: 0; transition: opacity .45s ease; }
.pulse.show { opacity: 1; }
.pulse.err { fill: #ffb3a6; filter: drop-shadow(0 0 6px var(--red)); }

/* ---------- правая колонка ---------- */
#side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
#nowPanel { flex: 1.5; }
#chronPanel { flex: 1; min-height: 140px; }

.idle-note {
  color: var(--dim); font-size: 13px; text-align: center; margin: auto 0; padding: 18px 10px;
  letter-spacing: 0.1em;
}

/* ---------- чек-лист задач («Сейчас в работе») ----------
   Каждая задача — карточка со статусом, общим таймером и шагами-галочками.
   Активный шаг мигает с таймером — сразу видно, ГДЕ работа стоит. */
.task-list {
  flex: 1; overflow-y: auto; padding: 8px 10px; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin; scrollbar-color: var(--cyan-soft) transparent;
}
.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-thumb { background: var(--cyan-soft); border-radius: 3px; }

.task-card {
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(3, 10, 18, 0.55); padding: 8px 11px;
  animation: evIn .3s ease-out;
  transition: border-color .6s ease, box-shadow .6s ease, opacity .6s ease;
}
.task-card.st-queued { border-color: rgba(255, 181, 77, 0.45); }
.task-card.st-run { border-color: var(--cyan-soft); box-shadow: 0 0 14px rgba(25, 200, 255, 0.08); }
.task-card.st-done { opacity: .7; border-color: rgba(43, 255, 176, 0.25); }
.task-card.st-err { border-color: rgba(255, 95, 71, 0.5); box-shadow: 0 0 12px rgba(255, 95, 71, 0.12); }

.tc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tc-title {
  font-size: 13px; font-weight: 700; color: #e3f6ff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tc-status {
  font-family: var(--font-head); font-size: 8.5px; letter-spacing: 0.14em;
  border: 1px solid; border-radius: 3px; padding: 1px 6px; flex: 0 0 auto;
  transition: color .5s ease, border-color .5s ease;
}
.st-queued .tc-status { color: var(--amber); border-color: var(--amber); animation: blink 1.6s infinite; }
.st-run .tc-status { color: var(--cyan); border-color: var(--cyan); }
.st-done .tc-status { color: var(--green); border-color: var(--green); }
.st-err .tc-status { color: var(--red); border-color: var(--red); }

.tc-meta {
  font-family: var(--font-head); font-size: 9.5px; letter-spacing: 0.08em;
  color: var(--dim); margin: 3px 0 5px;
}

.tstep { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 11.5px; }
.tstep i {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--dim); background: transparent;
  transition: background .4s ease, border-color .4s ease, box-shadow .4s ease;
}
.tstep span { color: var(--dim); font-weight: 600; transition: color .4s ease; }
.tstep em {
  margin-left: auto; font-style: normal; font-family: var(--font-head);
  font-size: 9px; letter-spacing: 0.06em; color: var(--dim); flex: 0 0 auto;
}
.tstep.active i { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: blink 1.2s infinite; }
.tstep.active span { color: var(--cyan); }
.tstep.active em { color: var(--cyan); }
.tstep.done i { background: var(--green); border-color: var(--green); }
.tstep.done span { color: var(--green); }
.tstep.done em { color: rgba(43, 255, 176, 0.6); }
.tstep.err i { background: var(--red); border-color: var(--red); box-shadow: 0 0 6px var(--red); }
.tstep.err span { color: var(--red); }
.tstep.sub { padding-left: 17px; font-size: 10.5px; }

/* пункты ПЛАНА — тудушки 1:1 как в чате: квадрат вместо точки,
   у выполненного — зелёная галочка */
.tstep.todo { padding: 2.5px 0; }
.tstep.todo i { border-radius: 2.5px; width: 11px; height: 11px; }
.tstep.todo.done i::after {
  content: "✓"; display: block; width: 11px; height: 11px;
  font-size: 9px; line-height: 11px; text-align: center;
  color: #04121e; font-weight: 700;
}
.tstep.todo.active i { animation: blink 1.2s infinite; }

/* кнопка «Очистить» в шапке каждой панели */
.clearbtn {
  font-family: var(--font-head); font-size: 8px; letter-spacing: .16em;
  color: var(--dim); background: transparent;
  border: 1px solid rgba(95, 135, 168, 0.4); border-radius: 3px;
  padding: 2px 8px; cursor: pointer; flex: 0 0 auto; margin-left: 2px;
  transition: color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.clearbtn:hover {
  color: var(--amber); border-color: var(--amber);
  box-shadow: 0 0 8px rgba(255, 181, 77, 0.25);
}
.panel-title .clearbtn { align-self: center; }

.tc-text {
  font-size: 11.5px; color: #a8cde4; line-height: 1.35;
  border-left: 2px solid var(--cyan-soft); padding: 2px 8px; margin-top: 5px;
  white-space: pre-wrap; word-break: break-word;
}
.tc-result { font-size: 11.5px; color: var(--green); margin-top: 5px; line-height: 1.35; }
.tc-result.bad { color: var(--red); }

.tc-text[hidden], .tc-result[hidden] { display: none; }

/* ---------- чат с BIBABOBA (внизу, на всю ширину) ---------- */
#chatPanel { flex: 0 0 auto; }
.chat-log {
  flex: 1; overflow-y: auto; padding: 10px 16px;
  display: flex; flex-direction: column; gap: 6px; min-height: 0;
  scrollbar-width: thin; scrollbar-color: var(--cyan-soft) transparent;
}
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--cyan-soft); border-radius: 3px; }
.chat-empty { color: var(--dim); font-size: 12px; text-align: center; padding: 12px 8px; letter-spacing: .05em; margin: auto 0; }
.bub {
  max-width: 62%; padding: 6px 12px 7px; border-radius: 10px;
  font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-break: break-word;
  animation: evIn .25s ease-out;
}
.bub.pending { opacity: .7; font-style: italic; }
.bub.pending .dots i { animation: dotJump 1s infinite; display: inline-block; }
.bub.pending .dots i:nth-child(2) { animation-delay: .18s; }
.bub.pending .dots i:nth-child(3) { animation-delay: .36s; }
@keyframes dotJump { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }

/* шаги работы BIBABOBA прямо в чате — как статус-строки в мессенджере */
.step-line {
  align-self: flex-start; max-width: 78%;
  font-size: 11.5px; color: var(--dim); line-height: 1.35;
  padding: 2px 10px; border-left: 2px solid var(--cyan-soft);
  animation: evIn .25s ease-out; white-space: pre-wrap; word-break: break-word;
}
.step-line .ic { color: var(--cyan); font-style: normal; margin-right: 5px; text-shadow: 0 0 6px var(--cyan-soft); }
.step-line b { color: var(--cyan); font-weight: 600; }

/* статус BIBABOBA в шапке чата */
#zaiStatus { font-family: var(--font-body); font-weight: 600; letter-spacing: .06em; }
#zaiStatus::before { content: "● "; }
#zaiStatus.st-idle { color: var(--green); }
#zaiStatus.st-busy { color: #ffd166; animation: blink 1.1s infinite; }
#zaiStatus.st-work { color: var(--cyan); animation: blink 1.6s infinite; }
.bub.me {
  align-self: flex-end; border-bottom-right-radius: 3px;
  background: rgba(25, 200, 255, 0.13); border: 1px solid var(--cyan-soft); color: #e3f6ff;
}
.bub.bot {
  align-self: flex-start; border-bottom-left-radius: 3px;
  background: rgba(43, 255, 176, 0.06); border: 1px solid rgba(43, 255, 176, 0.3); color: #dcf8ee;
}
.bub .who {
  display: block; font-family: var(--font-head); font-size: 8.5px;
  letter-spacing: .18em; color: var(--dim); margin-bottom: 2px;
}
.bub.me .who { color: var(--cyan); }
.bub.bot .who { color: var(--green); }
.chat-input { display: flex; gap: 8px; padding: 8px 16px 12px; border-top: 1px solid var(--line); flex: 0 0 auto; }
.chat-input input, .chat-keyrow input {
  flex: 1; min-width: 0; background: rgba(3, 10, 18, 0.8);
  border: 1px solid var(--line); border-radius: 6px; color: var(--text);
  padding: 9px 12px; font-family: var(--font-body); font-size: 14px; outline: none;
}
.chat-input input:focus, .chat-keyrow input:focus { border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan-soft); }
.chat-input button, .chat-keyrow button {
  font-family: var(--font-head); font-size: 11px; letter-spacing: .1em;
  color: #04121e; background: var(--cyan); border: 0; border-radius: 6px;
  padding: 0 12px; cursor: pointer; box-shadow: 0 0 10px var(--cyan-soft);
}
.chat-input button:hover, .chat-keyrow button:hover { box-shadow: 0 0 18px var(--cyan); }
.chat-keyrow { display: flex; gap: 6px; padding: 0 16px 10px; flex: 0 0 auto; }
.chat-keyrow[hidden] { display: none; }
.linkkey {
  background: none; border: 1px solid var(--line); border-radius: 4px;
  color: var(--dim); cursor: pointer; font-size: 10px; padding: 1px 7px;
}
.linkkey:hover { color: var(--cyan); border-color: var(--cyan-soft); }

/* ---------- хроника ---------- */
#chron {
  flex: 1; overflow-y: auto; padding: 6px 10px; min-height: 0;
  scrollbar-width: thin; scrollbar-color: var(--cyan-soft) transparent;
}
.ev {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3.5px 8px; border-radius: 4px; font-size: 12.5px;
  border-left: 2px solid transparent;
  animation: evIn .3s ease-out;
}
@keyframes evIn { from { opacity: 0; transform: translateY(-6px); } }
.ev:nth-child(odd) { background: rgba(25, 200, 255, 0.03); }
.ev .t { color: var(--dim); font-family: var(--font-head); font-size: 10px; letter-spacing: 0.06em; flex: 0 0 auto; }
.ev .badge {
  font-family: var(--font-head); font-size: 9px; letter-spacing: 0.12em; flex: 0 0 auto;
  border: 1px solid; border-radius: 3px; padding: 1px 6px; opacity: .9;
}
.ev .who { flex: 0 0 auto; font-weight: 700; color: var(--text); }
.ev .tx { color: #a8cde4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .tx.long { white-space: normal; }

.ev.c-task   { border-left-color: var(--cyan); }  .ev.c-task .badge   { color: var(--cyan); border-color: var(--cyan); }
.ev.c-start  { border-left-color: var(--cyan); }  .ev.c-start .badge  { color: var(--cyan); border-color: var(--cyan); }
.ev.c-think  { border-left-color: #3fa9d9; }      .ev.c-think .badge  { color: #3fa9d9; border-color: #3fa9d9; }
.ev.c-move   { border-left-color: #8f7bff; }      .ev.c-move .badge   { color: #8f7bff; border-color: #8f7bff; }
.ev.c-ok     { border-left-color: var(--green); } .ev.c-ok .badge     { color: var(--green); border-color: var(--green); }
.ev.c-out    { border-left-color: var(--green); } .ev.c-out .badge    { color: var(--green); border-color: var(--green); }
.ev.c-err    { border-left-color: var(--red); background: rgba(255, 95, 71, 0.05); }
.ev.c-err .badge    { color: var(--red); border-color: var(--red); }
.ev.c-tool   { border-left-color: var(--amber); } .ev.c-tool .badge   { color: var(--amber); border-color: var(--amber); }
.ev.c-tool .who { color: var(--amber); }

#chron::-webkit-scrollbar { width: 6px; }
#chron::-webkit-scrollbar-thumb { background: var(--cyan-soft); border-radius: 3px; }

/* ---------- настройка ---------- */
#setup[hidden] { display: none; }
#setup {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 6, 12, 0.88); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.setup-card {
  width: min(420px, 92vw); text-align: center;
  border: 1px solid var(--cyan-soft); border-radius: 12px;
  background: rgba(8, 22, 38, 0.9); padding: 30px 28px;
  box-shadow: 0 0 40px rgba(25, 200, 255, 0.12);
}
.setup-logo { font-size: 42px; color: var(--cyan); text-shadow: 0 0 24px var(--cyan); animation: logoPulse 3s infinite; }
.setup-card h1 { font-family: var(--font-head); font-size: 15px; letter-spacing: 0.24em; margin: 10px 0 4px; color: var(--text); }
.setup-card p { color: var(--dim); font-size: 13px; margin-bottom: 16px; }
.setup-card label { display: block; text-align: left; font-size: 11px; letter-spacing: 0.14em; color: var(--dim); font-family: var(--font-head); margin: 12px 0 4px; }
.setup-card input {
  width: 100%; padding: 9px 12px; border-radius: 6px; font-size: 14px;
  border: 1px solid var(--line); background: rgba(3, 10, 18, 0.8); color: var(--text);
  font-family: var(--font-body); outline: none;
}
.setup-card input:focus { border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-soft); }
#goBtn {
  margin-top: 18px; width: 100%; padding: 11px;
  font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.24em;
  color: #04121e; background: var(--cyan); border: 0; border-radius: 6px; cursor: pointer;
  box-shadow: 0 0 18px var(--cyan-soft);
}
#goBtn:hover { box-shadow: 0 0 26px var(--cyan); }
.setup-err { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 10px; }

/* ---------- диалоговое окно сферы ----------
   Клик по планете открывает её личное окно: кто это, состояние,
   с кем связана и последние события (включая полные комментарии
   с связей — без налипания на карту). */
#nodeCard {
  position: fixed; z-index: 300; width: 310px; max-width: calc(100vw - 20px);
  background: rgba(5, 15, 27, .93); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 0 22px rgba(25, 200, 255, .1);
  backdrop-filter: blur(7px); display: none; overflow: hidden;
  color: var(--cyan); /* currentColor: точка и акценты в цвете сферы (задаёт JS) */
}
#nodeCard.open { display: block; animation: cardIn .2s ease-out; }
@keyframes cardIn { from { opacity: 0; transform: translateY(7px) scale(.97); } }
.nc-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.nc-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor; box-shadow: 0 0 12px currentColor; }
.nc-name { display: flex; flex-direction: column; min-width: 0; }
.nc-title { font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--text); white-space: nowrap; }
.nc-sub { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-state {
  margin-left: auto; flex: none; font-family: var(--font-head); font-size: 8.5px; letter-spacing: .12em;
  color: var(--dim); border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px;
}
.nc-state.st-active { color: currentColor; border-color: currentColor; animation: blink 1.4s infinite; }
.nc-state.st-done { color: currentColor; border-color: currentColor; }
.nc-state.st-err { color: var(--red); border-color: var(--red); }
.nc-close {
  flex: none; width: 22px; height: 22px; line-height: 1; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--dim);
  font-size: 14px; cursor: pointer;
}
.nc-close:hover { color: var(--text); border-color: var(--line); }
.nc-links { padding: 7px 12px 0; font-size: 10.5px; color: var(--dim); letter-spacing: .06em; }
.nc-links b { color: #9fd8ef; font-weight: 600; }
.nc-body { max-height: 252px; overflow-y: auto; padding: 6px 8px 8px; min-height: 44px;
  scrollbar-width: thin; scrollbar-color: var(--cyan-soft) transparent;
}
.nc-body::-webkit-scrollbar { width: 6px; }
.nc-body::-webkit-scrollbar-thumb { background: var(--cyan-soft); border-radius: 3px; }
.nc-empty { color: var(--dim); font-size: 11.5px; text-align: center; padding: 14px 6px; letter-spacing: .08em; }
.nc-ev {
  display: flex; align-items: baseline; gap: 7px;
  padding: 4px 6px; border-radius: 5px; font-size: 11.5px;
  border-left: 2px solid transparent;
}
.nc-ev:nth-child(odd) { background: rgba(25, 200, 255, .04); }
.nc-ev .t { color: var(--dim); font-family: var(--font-head); font-size: 9px; flex: none; }
.nc-ev .badge {
  flex: none; font-family: var(--font-head); font-size: 8px; letter-spacing: .1em;
  border: 1px solid; border-radius: 3px; padding: 1px 5px; color: var(--dim);
}
.nc-ev .tx { color: #b7d9ec; min-width: 0; }
.nc-foot {
  display: flex; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); padding: 6px 12px;
  font-size: 9.5px; color: var(--dim); letter-spacing: .08em;
}

/* ---------- мобильная версия ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; grid-template-rows: 50px auto auto auto; }
  main { grid-template-columns: 1fr; }
  #mapWrap { height: 300px; }
  #nowPanel, #chronPanel { min-height: 200px; }
  #chatPanel { min-height: 260px; height: 320px; }
  #chron { max-height: 190px; }
  .bub { max-width: 82%; }
  .brand-name { display: none; }
  .chip.ghost { display: none; }
  .now-stage { font-size: 17px; }
}

@media (max-width: 520px) {
  #app { padding: 8px; gap: 8px; }
  .clock { font-size: 12px; }
  .brand-sub { display: none; }
  #mapWrap { height: 260px; }
}

/* сокращение анимаций для доступности */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- баннер «выложена новая версия» ----------
   Дашборд не перезагружает себя сам: если вкладка открыта давно,
   она работает на старом hud.js. Раз в 5 минут сверяем свою версию
   с живой index.html и предлагаем обновление одной кнопкой. */
#verBanner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; align-items: center; gap: 14px;
  background: rgba(8, 20, 32, .92); border: 1px solid var(--cyan);
  border-radius: 10px; padding: 9px 16px; font-size: 13px;
  color: #cfeeff; letter-spacing: .04em;
  box-shadow: 0 0 18px rgba(25, 200, 255, .35);
  backdrop-filter: blur(4px);
}
#verBanner[hidden] { display: none; }
#verReload {
  font-family: var(--font-head); font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  color: #06121c; background: var(--cyan); border: none; border-radius: 7px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
#verReload:hover { filter: brightness(1.12); }
