/* AI 수량산출 진행 화면: 기존 대화 흐름 위에 무대(진행 단계, 안내 원, 자막, 음성)를 입힌다. */
#cblQuantityMessengerModal.qty-stage {
  --qs-stage: linear-gradient(125deg, #0f766e 0%, #1d5f8f 46%, #4b3fc4 100%);
  padding: 0 !important;
  background: #123a4a !important;
  backdrop-filter: none !important;
}
#cblQuantityMessengerModal.qty-stage .qty-backdrop { display: none; }
#cblQuantityMessengerModal.qty-stage .qty-wrap {
  position: fixed !important;
  inset: 0 !important;
  left: 0 !important;
  transform: none !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100dvh !important;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0 !important;
}
#cblQuantityMessengerModal.qty-stage .qty-screen {
  position: relative;
  isolation: isolate;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--qs-stage);
  overflow: hidden;
  overflow: clip; /* not a scroll container: focusing or scrolling a card never shifts the stage */
}
/* the glows stay inside the screen so they never widen or lengthen it */
#cblQuantityMessengerModal.qty-stage .qty-screen::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 60%;
  z-index: -1;
  background: radial-gradient(48% 80% at 26% 118%, rgba(167, 139, 250, .6), transparent 70%);
  pointer-events: none;
}
#cblQuantityMessengerModal.qty-stage .qty-screen::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 50%;
  height: 60%;
  z-index: -1;
  background: radial-gradient(60% 60% at 80% 20%, rgba(94, 234, 212, .25), transparent);
  pointer-events: none;
}

/* header */
#cblQuantityMessengerModal.qty-stage .qty-header {
  gap: 12px;
  padding: 14px 24px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}
#cblQuantityMessengerModal.qty-stage .qty-header-title { font-size: 15px; font-weight: 800; }
#cblQuantityMessengerModal.qty-stage .qty-header-sub { color: rgba(255, 255, 255, .7); font-size: 11.5px; }
#cblQuantityMessengerModal.qty-stage .qty-close { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.qty-voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
.qty-voice-toggle svg { width: 16px; height: 16px; }
.qty-voice-toggle[aria-pressed="false"] { opacity: .75; }
.qty-voice-toggle:focus-visible, .qty-stage-start:focus-visible { outline: 3px solid rgba(255, 255, 255, .6); outline-offset: 2px; }

/* steps, orb and caption */
.qty-stage-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  padding: 14px 24px 18px;
  color: #fff;
}
.qty-stage-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.qty-stage-steps li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .72);
  font-size: 12.5px;
  font-weight: 700;
}
.qty-stage-steps b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  font-size: 11px;
}
.qty-stage-steps li.is-done { color: #ccfbf1; }
.qty-stage-steps li.is-done b { background: #5eead4; color: #0f766e; }
.qty-stage-steps li.is-current { background: #fff; color: #0f766e; }
.qty-stage-steps li.is-current b { background: #0f766e; color: #fff; }

.qty-stage-talk { display: flex; align-items: center; gap: 16px; width: min(860px, 100%); }
.qty-stage-caption {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: -.01em;
  text-shadow: 0 1px 12px rgba(15, 23, 42, .25);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
}

.qty-stage-orb {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8be3d6, #8b7cf6);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .08);
}
.qty-stage-orb > span {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #f8fbfb;
  overflow: hidden;
}
.qty-stage-orb > span::before,
.qty-stage-orb > span::after {
  content: "";
  position: absolute;
  left: -50%;
  top: 60%;
  width: 200%;
  height: 200%;
  border-radius: 42%;
  animation: qs-wave 9s linear infinite;
  transition: top .6s ease;
}
.qty-stage-orb > span::before { background: rgba(125, 211, 252, .5); }
.qty-stage-orb > span::after { top: 66%; border-radius: 45%; background: rgba(103, 232, 249, .55); animation-duration: 12s; }
.qty-stage-orb.is-speaking { animation: qs-pulse 1.1s ease-in-out infinite; }
.qty-stage-orb.is-speaking > span::before { top: 46%; animation-duration: 3.2s; }
.qty-stage-orb.is-speaking > span::after { top: 52%; animation-duration: 4.4s; }
@keyframes qs-wave { to { transform: rotate(360deg); } }
@keyframes qs-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255, 255, 255, .1); }
  50% { box-shadow: 0 0 0 16px rgba(255, 255, 255, .18); }
}

/* the conversation sits on a light sheet so every existing card stays readable */
#cblQuantityMessengerModal.qty-stage .qty-body {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 26px 48px;
  border-radius: 22px 22px 0 0;
  background: #f4f6f8;
  box-shadow: 0 -10px 40px rgba(15, 23, 42, .18);
}
#cblQuantityMessengerModal.qty-stage .bubble { font-size: 14.5px; line-height: 1.65; }
#cblQuantityMessengerModal.qty-stage .sender-name { font-size: 11.5px; }
#cblQuantityMessengerModal.qty-stage .qty-choice-btn { font-size: 14px; }

/* intro: "안녕하세요. 지금부터 저와 함께 …" */
.qty-stage-intro {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 24px;
  background: var(--qs-stage);
  color: #fff;
  text-align: center;
  transition: opacity .45s ease;
}
.qty-stage-intro[hidden] { display: none; }
.qty-stage-intro.is-leaving { opacity: 0; pointer-events: none; }
.qty-stage-intro .qty-stage-intro-text { margin: 0; font-size: clamp(19px, 2.2vw, 24px); font-weight: 600; line-height: 1.6; word-break: keep-all; }
.qty-stage-intro .qty-stage-orb { width: clamp(150px, 20vw, 210px); height: clamp(150px, 20vw, 210px); padding: 16px; box-shadow: 0 0 0 18px rgba(255, 255, 255, .08); }
.qty-stage-start {
  min-width: 190px;
  min-height: 54px;
  padding: 0 32px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #0f3d4a;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}
.qty-stage-start[disabled] { opacity: .6; cursor: default; }
.qty-stage-intro-hint { margin: -18px 0 0; color: rgba(255, 255, 255, .78); font-size: 13px; }

@media (max-width: 640px) {
  #cblQuantityMessengerModal.qty-stage .qty-header { padding: 10px 12px; gap: 8px; }
  #cblQuantityMessengerModal.qty-stage .qty-header-sub,
  #cblQuantityMessengerModal.qty-stage .qty-user-badge { display: none; }
  .qty-voice-toggle span { display: none; }
  .qty-voice-toggle { padding: 0 9px; }
  .qty-stage-head { gap: 10px; padding: 10px 12px 12px; }
  .qty-stage-steps li { padding: 4px 8px 4px 4px; font-size: 0; gap: 0; }
  .qty-stage-steps li.is-current { font-size: 12px; gap: 6px; }
  .qty-stage-orb { width: 46px; height: 46px; padding: 4px; }
  .qty-stage-caption { font-size: 15px; -webkit-line-clamp: 2; }
  #cblQuantityMessengerModal.qty-stage .qty-body { width: 100%; padding: 18px 12px 32px; border-radius: 18px 18px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .qty-stage-orb.is-speaking,
  .qty-stage-orb > span::before,
  .qty-stage-orb > span::after { animation: none; }
}
