/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #1a6bff;
  --accent-light: #4d90ff;
  --accent-dark:  #0047cc;
  --green:        #16a34a;
  --green-light:  #dcfce7;
  --bg:           #f0f4ff;
  --surface:      #ffffff;
  --text-main:    #0f172a;
  --text-muted:   #64748b;
  --border:       rgba(26, 107, 255, 0.15);
  --shadow-md:    0 8px 32px rgba(26, 107, 255, 0.14);
  --loader-dur:   3.2s;   /* время загрузки */
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   ЭКРАН ЗАГРУЗКИ
═══════════════════════════════════════════════════════════════════ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #f8faff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Карточка по центру */
.loader__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 48px 56px;
  background: #fff;
  border-radius: 24px;
  box-shadow:
    0 2px 8px rgba(26,107,255,0.06),
    0 16px 48px rgba(26,107,255,0.10);
  border: 1px solid rgba(26,107,255,0.08);
  animation: card-in 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Иконка с кольцом */
.loader__icon-wrap {
  position: relative;
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}

.loader__icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-light);
  animation: spin 1.4s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader__icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(26,107,255,0.35);
}
.loader__icon svg  { width: 24px; height: 24px; }

/* Кастомная иконка лоадера */
#loaderIconImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Тексты */
.loader__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.loader__sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* Прогресс-бар */
.loader__bar-wrap {
  width: 200px;
  height: 4px;
  background: rgba(26,107,255,0.10);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.loader__bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  animation: progress var(--loader-dur) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes progress {
  0%   { width: 0%;   }
  60%  { width: 75%;  }
  85%  { width: 90%;  }
  100% { width: 100%; }
}

/* Три точки */
.loader__dots {
  display: flex;
  gap: 7px;
  margin-top: 2px;
}
.loader__dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-light);
  animation: bounce 1.2s ease-in-out infinite;
}
.loader__dots span:nth-child(2) { animation-delay: 0.2s; }
.loader__dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* ═══════════════════════════════════════════════════════════════════
   ОСНОВНОЙ КОНТЕНТ (скрыт до завершения загрузки)
═══════════════════════════════════════════════════════════════════ */
.main-content {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease 0.1s, transform 0.6s ease 0.1s;
}

.main-content.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════
   БАННЕР
═══════════════════════════════════════════════════════════════════ */
.banner {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background-image:
    linear-gradient(135deg,
      rgba(26,107,255,0.04) 0%,
      rgba(255,255,255,1)   40%,
      rgba(255,255,255,1)   60%,
      rgba(77,144,255,0.06) 100%);
}

.banner__glow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 300px; height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.banner__glow--left  { left: -100px;  background: rgba(26,107,255,0.12); }
.banner__glow--right { right: -100px; background: rgba(77,144,255,0.10); }

.banner__dots {
  position: absolute;
  right: 32px; top: 50%;
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: repeat(3, 6px);
  gap: 5px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}
.banner__dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.banner__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
}

.banner__icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(26,107,255,0.35);
  animation: pulse-ring 2.4s ease-in-out infinite;
}
.banner__icon svg  { width: 24px; height: 24px; }

/* Кастомная иконка (загруженная через бот) */
#bannerIconImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 4px 16px rgba(26,107,255,0.35), 0 0 0 0   rgba(26,107,255,0.25); }
  50%       { box-shadow: 0 4px 16px rgba(26,107,255,0.35), 0 0 0 10px rgba(26,107,255,0);   }
}

.banner__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.banner__label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.banner__phone {
  font-size: clamp(22px, 3.5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-dark);
  text-decoration: none;
  line-height: 1.1;
  display: inline-block;
  transition: color 0.2s ease, transform 0.2s ease;
}
.banner__phone:hover { color: var(--accent); transform: scale(1.02); }

.banner__sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.banner__badge {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--green-light);
  border: 1.5px solid rgba(22,163,74,0.2);
  display: flex; align-items: center; gap: 6px;
}
.banner__badge::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
.banner__badge-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
}

@keyframes blink {
  0%, 100% { opacity: 1;    }
  50%       { opacity: 0.35; }
}

/* ─── MOBILE (≤ 640px) ───────────────────────────────────────────── */
@media (max-width: 640px) {

  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  /* ── Loader ── */
  .loader__card {
    padding: 28px 20px;
    border-radius: 18px;
    width: calc(100vw - 32px);
  }
  .loader__icon-wrap { width: 54px; height: 54px; }
  .loader__title { font-size: 16px; }
  .loader__sub   { font-size: 12px; }

  /* ── main-content: не растягивается ── */
  .main-content,
  .main-content.visible {
    flex-shrink: 0;
    position: static;
    transform: none;
    opacity: 1;
  }

  /* ── Баннер — горизонтальный, компактный (~65px) ── */
  .banner {
    padding: 10px 14px;
    position: static;
  }
  .banner__inner {
    flex-direction: row;          /* горизонтально */
    align-items: center;
    text-align: left;
    gap: 12px;
  }
  .banner__icon   { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; }
  .banner__icon svg { width: 20px; height: 20px; }
  .banner__content  { flex: 1; gap: 1px; }
  .banner__label    { font-size: 10px; letter-spacing: 0.05em; }
  .banner__phone    { font-size: 20px; font-weight: 900; letter-spacing: -0.01em; line-height: 1.1; }
  .banner__sub      { font-size: 10px; line-height: 1.2; }
  .banner__badge    { flex-shrink: 0; padding: 4px 10px; }
  .banner__badge-text { font-size: 11px; }
  .banner__dots     { display: none; }
  .banner__glow     { display: none; }

  /* ── Терминал — НЕ fixed, заполняет всё под баннером ── */
  .terminal {
    position: relative !important;
    top: auto !important; bottom: auto !important;
    left: auto !important; right: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    flex: 1;
    min-height: 0;
    height: auto !important;
    border-radius: 12px 12px 0 0;
    font-size: 11.5px;
    box-sizing: border-box;
  }
  .terminal.collapsed {
    flex: 0 0 var(--term-bar-h);
    height: var(--term-bar-h) !important;
  }

  /* Показываем titlebar на мобиле */
  .terminal__bar {
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: var(--term-bar-h);
    background: var(--term-bar);
    border-bottom: 1px solid var(--term-border);
    gap: 8px;
  }

  .terminal__body { min-height: 0; }

  .terminal__output {
    padding: 0 10px;
    font-size: 11.5px;
    line-height: 1.55;
  }

  /* Текст переносится, не уходит за экран */
  .t-line {
    word-break: break-word;
    white-space: pre-wrap;
  }

  /* Баннеры внутри терминала */
  .term-alert {
    margin: 6px 6px 3px;
    padding: 9px 12px 9px 10px;
    gap: 8px;
    border-radius: 10px;
  }
  .term-alert__icon { width: 26px; height: 26px; font-size: 14px; }
  .term-alert__text { font-size: 14px; }
  .term-alert--blue { margin-top: 3px; margin-bottom: 6px; }
}

/* ─── VERY SMALL (≤ 380px) ───────────────────────────────────────── */
@media (max-width: 380px) {
  .banner__phone { font-size: 17px; }
  .banner__icon  { width: 36px; height: 36px; }
  .terminal__output { font-size: 10.5px; }
}



/* ═══════════════════════════════════════════════════════════════════
   ТЕРМИНАЛ
═══════════════════════════════════════════════════════════════════ */
:root {
  --term-bg:       #0d1117;
  --term-bar:      #161b22;
  --term-border:   #30363d;
  --term-green:    #3fb950;
  --term-blue:     #58a6ff;
  --term-yellow:   #d29922;
  --term-red:      #f85149;
  --term-muted:    #8b949e;
  --term-white:    #e6edf3;
  --term-prompt:   #58a6ff;
  --term-height:   660px;
  --term-bar-h:    38px;
}

.terminal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 920px);
  z-index: 8000;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: 12px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.55),
    0 2px 8px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: height 0.3s cubic-bezier(0.4,0,0.2,1);
  height: calc(var(--term-bar-h) + var(--term-height));
}

.terminal.collapsed {
  height: var(--term-bar-h);
  transform: translate(-50%, -50%);
}


/* Анимация появления строки */
@keyframes line-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

.t-line {
  animation: line-in 0.18s ease both;
}

/* ── Заголовок (titlebar) ─────────────────────────────────────────── */
.terminal__bar {
  display: none;
}

.terminal__dots {
  display: flex;
  gap: 6px;
}
.terminal__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  cursor: default;
}
.terminal__dot--red    { background: #ff5f57; }
.terminal__dot--yellow { background: #ffbd2e; }
.terminal__dot--green  { background: #28c840; }

.terminal__title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--term-muted);
  letter-spacing: 0.02em;
}

.terminal__toggle {
  background: none;
  border: none;
  color: var(--term-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.terminal__toggle:hover { color: var(--term-white); background: rgba(255,255,255,0.06); }
.terminal.collapsed .terminal__toggle { transform: rotate(180deg); }

/* ── Тело терминала ──────────────────────────────────────────────── */
.terminal__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 0 4px;
}

.terminal__output {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  line-height: 1.65;
  scroll-behavior: smooth;
}
.terminal__output::-webkit-scrollbar { width: 4px; }
.terminal__output::-webkit-scrollbar-track { background: transparent; }
.terminal__output::-webkit-scrollbar-thumb { background: var(--term-border); border-radius: 4px; }

/* Строки вывода */
.t-line           { color: var(--term-white); word-break: break-all; }
.t-line.t-green   { color: var(--term-green);  }
.t-line.t-blue    { color: var(--term-blue);   }
.t-line.t-yellow  { color: var(--term-yellow); }
.t-line.t-red     { color: var(--term-red);    }
.t-line.t-muted   { color: var(--term-muted);  }
.t-line.t-cmd     { color: var(--term-prompt); }

.terminal__input-row {
  display: none;
}


.terminal__prompt {
  color: var(--term-green);
  white-space: nowrap;
  font-weight: 600;
}

.terminal__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--term-white);
  font-family: inherit;
  font-size: 13px;
  caret-color: var(--term-green);
}
.terminal__input::placeholder { color: var(--term-muted); opacity: 0.5; }

/* ── Курсор typewriter ───────────────────────────────────────────── */
.t-cursor {
  display: inline-block;
  color: var(--term-green);
  animation: blink-cursor 0.7s step-end infinite;
  margin-left: 1px;
  font-weight: 400;
}
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Алерт-баннер внутри терминала ──────────────────────────────── */
.term-alert {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 12px 6px;
  padding: 14px 24px 14px 16px;
  background: linear-gradient(135deg, #fffbe6 0%, #fef3c7 50%, #fde68a 100%);
  border: 2px solid #111;
  border-radius: 14px;
  box-shadow:
    0 0 0 3px rgba(220, 38, 38, 0.12),
    0 4px 20px rgba(0, 0, 0, 0.4);
  animation: banner-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes banner-in {
  from { opacity: 0; transform: scaleY(0.6) translateY(-10px); }
  to   { opacity: 1; transform: scaleY(1) translateY(0); }
}

.term-alert__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ef4444, #991b1b);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6), 0 2px 6px rgba(0,0,0,0.3);
  animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { box-shadow: 0 0 10px rgba(239,68,68,0.6), 0 2px 6px rgba(0,0,0,0.3); }
  50%       { box-shadow: 0 0 20px rgba(239,68,68,0.9), 0 2px 6px rgba(0,0,0,0.3); }
}

.term-alert__text {
  flex: 1;
  text-align: center;
  color: #b91c1c;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.04em;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  text-shadow: 0 1px 3px rgba(185, 28, 28, 0.25);
}

/* ── Нижний баннер — синие тона ──────────────────────────────────── */
.term-alert--blue {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #bfdbfe 100%);
  border-color: #1e3a8a;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.4);
  margin-top: 6px;
  margin-bottom: 10px;
}

.term-alert__icon--blue {
  background: radial-gradient(circle at 35% 35%, #3b82f6, #1e3a8a);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6), 0 2px 6px rgba(0,0,0,0.3);
  font-style: normal;
  font-weight: 900;
  font-size: 18px;
  animation: pulse-blue 2s ease-in-out infinite;
}

@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 10px rgba(59,130,246,0.6), 0 2px 6px rgba(0,0,0,0.3); }
  50%       { box-shadow: 0 0 22px rgba(59,130,246,0.95), 0 2px 6px rgba(0,0,0,0.3); }
}

.term-alert__text--blue {
  color: #1e40af;
  text-shadow: 0 1px 3px rgba(30, 64, 175, 0.2);
}




