:root {
  --bg: #17212b;
  --bg-glow: #1f2b38;
  --surface: rgba(23, 33, 43, 0.88);
  --surface-strong: #17212b;
  --text: #f2f4ff;
  --muted: #b8bfd6;
  --accent: #7177f8;
  --accent-strong: #5d63dd;
  --warn: #f3c26b;
  --error: #ff7990;
  --shadow: 0 24px 60px rgba(7, 10, 14, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  font-family: 'Manrope', 'Segoe UI', 'Helvetica Neue', sans-serif;
  background:
    radial-gradient(1000px 520px at -8% -15%, rgba(113, 119, 248, 0.22) 0%, transparent 62%),
    radial-gradient(920px 420px at 110% 115%, rgba(113, 119, 248, 0.18) 0%, transparent 58%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-glow) 100%);
  color: var(--text);
}

.agent-frame {
  position: relative;
  width: min(1100px, calc(100% - 28px));
  height: min(92vh, 920px);
  margin: 14px auto;
  border: 1px solid rgba(113, 119, 248, 0.22);
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(9px);
  box-shadow: var(--shadow);
}

.agent-inner {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.agent-inner.is-ready {
  opacity: 1;
}

.loader {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0;
  padding: 28px;
  background:
    radial-gradient(circle at center, rgba(113, 119, 248, 0.24), transparent 62%),
    linear-gradient(180deg, rgba(23, 33, 43, 0.96), rgba(31, 43, 56, 0.96));
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

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

.loader__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 24px;
}

.loader__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 0 0 rgba(113, 119, 248, 0.34);
  animation: dotPulse 1.45s cubic-bezier(0.42, 0, 0.2, 1) infinite;
  will-change: transform, opacity, box-shadow;
}

.loader__dot:nth-child(2) {
  animation-delay: 0.18s;
}

.loader__dot:nth-child(3) {
  animation-delay: 0.36s;
}

.loader__action {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #f7f8ff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 22px rgba(113, 119, 248, 0.28);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.loader__action.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.loader__action:active {
  transform: translateY(1px);
}

.noscript-message {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #291f2b;
  border: 1px solid #4d3240;
  color: #ffd4dd;
  font-size: 14px;
}

@keyframes dotPulse {
  0%,
  70%,
  100% {
    transform: translateY(0) scale(0.86);
    opacity: 0.45;
    box-shadow: 0 0 0 0 rgba(113, 119, 248, 0.22);
  }

  35% {
    transform: translateY(-3px) scale(1);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(113, 119, 248, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader,
  .agent-inner {
    transition: none;
  }

  .loader__dot {
    animation: none;
  }
}

@media (max-width: 768px) {
  .agent-frame {
    width: calc(100% - 16px);
    height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 18px;
  }

  .loader {
    padding: 20px;
  }
}
