:root {
  --configurator-header-height: 96px;
  --configurator-shell-height: 660px;
}

.configurator-page {
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 18% 14%, rgba(130, 0, 255, 0.22) 0%, rgba(130, 0, 255, 0) 68%),
    radial-gradient(900px 580px at 88% 82%, rgba(154, 51, 255, 0.18) 0%, rgba(154, 51, 255, 0) 66%),
    linear-gradient(180deg, #09041d 0%, #060313 100%);
}

.configurator-page #wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.configurator-page #goTop {
  display: none;
}

.configurator-page header {
  position: static !important;
  top: auto !important;
}

.configurator-page .tf-header {
  flex-shrink: 0;
  padding-top: 22px;
  margin-bottom: 0;
  transition: opacity 0.34s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.configurator-page .tf-header .header-inner {
  background: rgba(255, 255, 255, 0.9);
}

.configurator-fullscreen {
  position: relative;
  flex: 1;
  min-height: 0;
  padding-top: 30px;
  padding-bottom: 26px;
  overflow: hidden;
  background: transparent;
}

.configurator-fullscreen .container {
  height: 100%;
}

.configurator-glow {
  position: absolute;
  pointer-events: none;
  filter: blur(18px);
}

.configurator-glow.glow-1 {
  width: 460px;
  height: 460px;
  border-radius: 50%;
  left: -140px;
  top: 110px;
  background: radial-gradient(circle, rgba(130, 0, 255, 0.35) 0%, rgba(130, 0, 255, 0) 72%);
}

.configurator-glow.glow-2 {
  width: 560px;
  height: 560px;
  border-radius: 50%;
  right: -220px;
  bottom: -120px;
  background: radial-gradient(circle, rgba(154, 51, 255, 0.33) 0%, rgba(154, 51, 255, 0) 74%);
}

.configurator-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 680px);
  gap: 26px;
  height: 100%;
  min-height: 0;
  align-items: center;
  position: relative;
  z-index: 2;
}

.configurator-intro {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 10, 42, 0.6);
  backdrop-filter: blur(12px);
  padding: 34px 30px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: opacity 0.3s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.configurator-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.configurator-title {
  font-size: clamp(34px, 4.2vw, 66px);
  line-height: 1.02;
  margin: 0 0 14px;
  color: #fff;
}

.configurator-subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.6;
}

.configurator-points {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.configurator-points span {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #f4f4f5;
}

.configurator-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  width: 100%;
  height: var(--configurator-shell-height);
  max-height: 100%;
  min-height: 520px;
  border-radius: 28px;
  border: 1px solid #d4d4d8;
  background: #f4f4f5;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  transition:
    top 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: top, left, width, height, border-radius;
}

.configurator-shell-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.mobile-chat-exit {
  display: none;
}

.mobile-chat-enter {
  display: none;
}

.configurator-progress {
  height: 6px;
  width: 100%;
  background: rgba(24, 24, 27, 0.14);
}

#configurator-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8200ff 0%, #9a33ff 100%);
  transition: width 0.4s ease;
}

.chat-feed {
  flex: 1;
  min-height: 0;
  padding: 22px 20px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.chat-feed::-webkit-scrollbar {
  width: 8px;
}

.chat-feed::-webkit-scrollbar-track {
  background: transparent;
}

.chat-feed::-webkit-scrollbar-thumb {
  background: rgba(82, 82, 91, 0.45);
  border-radius: 999px;
}

.chat-row {
  display: flex;
  margin-bottom: 14px;
}

.chat-row.ai {
  justify-content: flex-start;
}

.chat-row.user {
  justify-content: flex-end;
}

.chat-ai-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 92%;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3d0671 0%, #9a33ff 100%);
  box-shadow: 0 8px 20px rgba(130, 0, 255, 0.25);
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(1);
}

.chat-bubble {
  border-radius: 20px;
  border: 1px solid #d4d4d8;
  background: #fff;
  padding: 13px 15px;
  color: #18181b;
  line-height: 1.56;
  font-size: 16px;
  font-weight: 500;
}

.chat-row.user .chat-bubble {
  background: linear-gradient(180deg, #3d0671 0%, #9a33ff 100%);
  border-color: #6d1ae5;
  color: #fff;
  box-shadow: 0 12px 24px rgba(130, 0, 255, 0.22);
}

.chat-enter {
  opacity: 0;
  transform: translateY(16px);
  animation: chatFadeSlide 0.38s ease forwards;
}

@keyframes chatFadeSlide {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8200ff;
  opacity: 0.3;
  animation: dotPulse 0.8s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.12s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes dotPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.chat-composer {
  padding: 14px 20px 20px;
  border-top: 1px solid #dedee3;
  background: linear-gradient(180deg, rgba(244, 244, 245, 0.86) 0%, rgba(244, 244, 245, 1) 34%);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.option-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid #d7d7df;
  background: linear-gradient(180deg, #ffffff 0%, #f7f7fb 100%);
  color: #18181b;
  padding: 14px 14px;
  min-height: 86px;
  text-align: left;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.34;
  letter-spacing: 0.01em;
  cursor: pointer;
  transform: translateY(10px);
  opacity: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 3px 10px rgba(15, 23, 42, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.option-card.show {
  opacity: 1;
  transform: translateY(0);
}

.option-card:hover {
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px) scale(1.015);
  border-color: #b4b4c3;
}

.option-card.selected {
  background: linear-gradient(180deg, #3d0671 0%, #9a33ff 100%);
  border-color: #6d1ae5;
  color: #fff;
  box-shadow: 0 16px 28px rgba(130, 0, 255, 0.34);
}

.option-card.multi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.option-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid #a1a1aa;
  flex: 0 0 18px;
  position: relative;
  transition: all 0.3s ease;
}

.option-check::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg);
  position: absolute;
  left: 3px;
  top: 4px;
  transition: border-color 0.3s ease;
}

.option-card.selected .option-check {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.12);
}

.option-card.selected .option-check::after {
  border-left-color: #fff;
  border-bottom-color: #fff;
}

.input-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-wrap input,
.input-wrap textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #d4d4d8;
  background: #fff;
  color: #18181b;
  min-height: 50px;
  padding: 11px 14px;
  font-size: 16px;
  font-weight: 500;
}

.input-wrap textarea {
  resize: vertical;
  min-height: 120px;
}

.input-wrap input:focus,
.input-wrap textarea:focus {
  border-color: #8200ff;
}

.configurator-submit {
  width: fit-content;
  min-width: 190px;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #3d0671 0%, #9a33ff 100%);
  box-shadow: 0 10px 18px rgba(130, 0, 255, 0.25);
  transition: transform 0.24s ease, box-shadow 0.24s ease, opacity 0.24s ease;
}

.configurator-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(130, 0, 255, 0.32);
}

.configurator-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.error-text {
  color: #dc2626;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.success-card {
  margin-top: 8px;
  border-radius: 24px;
  border: 1px solid #d4d4d8;
  background: #ffffff;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.success-icon-wrap {
  width: 92px;
  height: 92px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(34, 197, 94, 0.24) 0%, rgba(34, 197, 94, 0.12) 36%, rgba(34, 197, 94, 0.04) 64%, transparent 100%);
}

.success-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 16px 30px rgba(34, 197, 94, 0.35);
  animation: successPulse 1.7s ease-in-out infinite;
}

@keyframes successPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.success-title {
  text-align: center;
  margin-bottom: 8px;
  color: #18181b;
  font-size: 32px;
  line-height: 1.06;
  font-weight: 700;
}

.success-text {
  text-align: center;
  color: #52525b;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
  margin-bottom: 18px;
}

.success-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #d4d4d8;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 700;
  color: #18181b;
  background: #fff;
  transition: all 0.24s ease;
}

.success-link:hover {
  border-color: #8200ff;
  color: #8200ff;
  transform: translateY(-1px);
}

.success-cta-wrap {
  text-align: center;
}

.confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti span {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confettiFall var(--dur) ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--x), 290px, 0) rotate(var(--rot));
    opacity: 0;
  }
}

@media (max-width: 1199px) {
  :root {
    --configurator-shell-height: 540px;
  }

  .configurator-fullscreen {
    padding-top: 24px;
  }

  .configurator-layout {
    grid-template-columns: 1fr;
    gap: 14px;
    align-content: start;
  }

  .configurator-intro {
    padding: 20px 18px;
  }

  .configurator-shell {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  :root {
    --configurator-shell-height: 54svh;
  }

  .configurator-page .tf-header {
    padding-top: 14px;
  }

  .configurator-page .tf-header .header-inner {
    margin: 0 16px;
  }

  .configurator-page.mobile-chat-expanded .tf-header {
    opacity: 0;
    transform: translateY(-18px);
    pointer-events: none;
  }

  .configurator-fullscreen {
    padding-top: 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .configurator-page.mobile-chat-expanded .configurator-fullscreen {
    padding-top: 0;
    padding-bottom: 0;
  }

  .configurator-page.mobile-chat-expanded .configurator-glow {
    opacity: 0;
  }

  .configurator-intro {
    border-radius: 18px;
    padding: 14px 14px 10px;
  }

  .configurator-page.mobile-chat-expanded .configurator-intro {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
  }

  .configurator-chip {
    margin-bottom: 8px;
    font-size: 12px;
    padding: 6px 11px;
  }

  .configurator-title {
    font-size: clamp(27px, 8vw, 36px);
    margin-bottom: 7px;
    line-height: 1.04;
  }

  .configurator-subtitle {
    font-size: 14px;
    line-height: 1.4;
  }

  .configurator-points {
    display: none;
  }

  .configurator-shell {
    border-radius: 18px;
    min-height: 390px;
  }

  .configurator-page.mobile-chat-expanded .configurator-shell {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  .chat-feed {
    padding: 14px 12px 10px;
  }

  .chat-composer {
    padding: 10px 12px 12px;
  }

  .chat-bubble {
    font-size: 14px;
    border-radius: 15px;
    padding: 11px 12px;
  }

  .chat-avatar {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    padding: 7px;
  }

  .option-grid {
    gap: 8px;
  }

  .option-card {
    border-radius: 13px;
    min-height: 80px;
    padding: 11px 10px;
    font-size: 13px;
    line-height: 1.3;
  }

  .input-wrap input,
  .input-wrap textarea {
    min-height: 48px;
    font-size: 15px;
  }

  .configurator-submit {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    font-size: 14px;
  }

  .success-title {
    font-size: 24px;
  }

  .success-text {
    font-size: 14px;
    margin-bottom: 14px;
  }

  .mobile-chat-exit {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(24, 24, 27, 0.72);
    color: #fff;
    font-size: 14px;
    z-index: 6;
    opacity: 0;
    transform: translateY(-10px) scale(0.94);
    pointer-events: none;
    transition: opacity 0.26s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .mobile-chat-exit svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
  }

  .configurator-page.mobile-chat-expanded .mobile-chat-exit {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .mobile-chat-enter {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(24, 24, 27, 0.82);
    color: #fff;
    z-index: 128;
    opacity: 0;
    transform: translateY(10px) scale(0.94);
    pointer-events: none;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
    transition: opacity 0.25s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .mobile-chat-enter svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .configurator-page.mobile-chat-can-expand:not(.mobile-chat-expanded) .mobile-chat-enter {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .configurator-page.mobile-chat-expanded .configurator-progress {
    margin-top: 48px;
  }

  .configurator-page.mobile-chat-expanded .chat-feed {
    padding-top: 12px;
  }
}

@media (max-width: 420px) {
  :root {
    --configurator-shell-height: 52svh;
  }

  .configurator-shell {
    min-height: 360px;
  }

  .option-card {
    min-height: 74px;
    font-size: 12px;
    line-height: 1.28;
  }
}
