[hidden] { display: none !important; }
body:has(dialog[open]) { overflow: hidden; }

#quit-quiz {
  position: absolute;
  inset: 3px auto auto 8px;
  width: 42px;
  margin: 0;
  padding: 0;
  color: #292e39;
  background: transparent;
}
#quit-quiz span {
  width: 11px;
  height: 11px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}

.flow-confirm {
  width: min(300px, calc(100% - 36px));
  max-width: unset;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #303133;
  text-align: center;
}
.flow-confirm::backdrop, .payment-dialog::backdrop { background: rgb(0 0 0 / 60%); }
.flow-confirm h2 { margin: 21px 0 10px; font-size: 16px; }
.flow-confirm p { margin: 0; padding: 10px 21px 23px; color: #606266; font-size: 14px; }
.flow-confirm-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #f0f0f0; }
.flow-confirm-actions button {
  min-height: 47px;
  margin: 0 !important;
  border: 0;
  border-radius: 0;
  background: white;
  color: #606266;
  font-size: 16px;
  font-weight: 400;
}
.flow-confirm-actions button + button { color: #2979ff; border-left: 1px solid #f0f0f0; }
.flow-confirm-actions button:focus-visible { outline-offset: -4px; }
.final-exit #final-offer-price { display: inline-block; margin-bottom: 6px; color: #cf4c40; font-size: 21px; }
.final-exit .final-offer-status { padding: 0 16px 11px; color: #a13735; }
.final-offer-status:empty { display: none; }

body:has(.preparation) { background: #f3f4f9; }
body:has(.preparation) > .top { background: #e0e5fa; border-color: transparent; }
main:has(.preparation) { max-width: none; padding: 0; }
.preparation {
  min-height: calc(100dvh - 48px);
  padding: 10px 12px 180px;
  background:
    url('./flow-assets/report-preparation-footer.png') center bottom / min(100%, 800px) auto no-repeat,
    linear-gradient(#e0e5fa, #f3f4f9);
  color: #303133;
  text-align: center;
}
.preparation-image { width: min(270px, 74vw); height: 145px; object-fit: contain; }
.preparation h1 { margin: 12px 0 25px; font-size: 22px; }
.preparation-panel {
  width: min(100%, 530px);
  margin: auto;
  padding: 17px 21px 13px;
  border-top: 8px solid #856398;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 6px #3332;
  text-align: left;
}
.preparation-tabs, .preparation-rows { padding: 0; margin: 0; list-style: none; }
.preparation-tabs { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.preparation-tabs li { position: relative; padding-bottom: 11px; }
.preparation-tabs .current { color: #856398; font-weight: 700; }
.preparation-tabs .current::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: calc(50% - 24px);
  width: 48px;
  height: 3px;
  border-radius: 2px;
  background: #856398;
}
.preparation-rows { margin-top: 17px; font-size: 14px; }
.preparation-rows li { margin: 0 0 16px; }
.preparation-track { height: 10px; margin-top: 5px; border-radius: 5px; overflow: hidden; background: #e9e9e9; }
.preparation-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(48deg, #87649c 0 12px, #9a78ae 12px 22px);
  transform-origin: left;
  animation: fill-preparation 2300ms ease both;
}
@keyframes fill-preparation { from { transform: scaleX(0); } to { transform: scaleX(1); } }

dialog.welcome-packet {
  width: 192px;
  max-width: calc(100vw - 32px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.welcome-packet::backdrop { background: rgb(0 0 0 / 80%); }
.welcome-packet form {
  position: relative;
  min-height: 214px;
  padding: 37px 10px 20px;
  background: url('./flow-assets/welcome-packet.png') center / 100% 100% no-repeat;
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  animation: packet-appear 450ms cubic-bezier(.19,.76,.31,1.24) both;
}
@keyframes packet-appear { from { transform: scale(.6); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.welcome-amount { height: 36px; line-height: 36px; }
.welcome-amount strong { font-size: 33px; }
.welcome-packet h2 { margin: 0 0 13px; color: #bb5520; font-size: 13px; }
.welcome-packet p { margin: 0 0 6px; line-height: 1.4; }
.welcome-packet small { color: #fdeb96; font-size: 11px; }
.welcome-packet button.welcome-claim {
  display: inline-flex;
  width: auto;
  min-height: 24px;
  padding: 1px 19px;
  margin: 2px 0 0;
  border-radius: 99px;
  background: #fddd19;
  color: #9d4319;
  font: inherit;
  box-shadow: 0 2px 4px #9b1a3e55;
}
dialog button.flow-dismiss {
  position: absolute;
  inset: 6px 9px auto auto;
  z-index: 1;
  width: 36px;
  height: 36px;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: #6b6974;
  font-size: 25px;
  font-weight: 400;
}
.welcome-packet button.flow-dismiss { top: -24px; right: -20px; color: #fff; }

dialog.payment-dialog {
  inset: auto 0 0;
  width: min(100%, 520px);
  max-width: none;
  max-height: min(85dvh, 740px);
  margin: 0 auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: #303133;
  border: 0;
  border-radius: 10px 10px 0 0;
  background: #fff;
  text-align: center;
}
.payment-dialog[open] { animation: open-cashier 220ms ease-out both; }
@keyframes open-cashier { from { transform: translateY(32px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.payment-surface { position: relative; padding: 13px 18px max(14px, env(safe-area-inset-bottom)); }
.payment-title { margin: 3px 0 4px; font-size: 16px; font-weight: 650; }
.payment-countdown, .payment-description { margin: 0 0 2px; font-size: 13px; }
.payment-countdown strong { color: #db6360; font-variant-numeric: tabular-nums; }
.payment-plans {
  display: flex;
  justify-content: center;
  gap: 12px;
  max-width: 324px;
  margin: 11px auto;
}
.payment-plan {
  position: relative;
  width: min(206px, 100%);
  padding: 12px 8px 10px;
  border: 1px solid #e5c676;
  border-radius: 5px;
  background: #fff7ec;
}
.payment-plans:has(.sample-plan) .payment-plan { width: 50%; }
.sample-plan { color: #5b5252; border-color: #e9d09a; background: #fbf5ec; }
.plan-badge {
  position: absolute;
  top: -10px;
  right: -5px;
  padding: 2px 8px;
  border-radius: 12px 12px 0;
  background: linear-gradient(110deg, #e27a60, #cf4270);
  color: #fff;
  font-size: 10px;
}
.payment-plan h3 { margin: 0; font-size: 19px; color: #59441f; }
.plan-price { margin: 0; color: #59441f; }
.plan-price strong { margin-right: 2px; font-size: 23px; }
.plan-price span, .plan-price del { font-size: 12px; }
.plan-price del { margin-left: 5px; color: #8c7e79; }
.plan-description { margin: 0; color: #7b736d; font-size: 13px; }
.payment-method { width: min(232px, 100%); margin: auto; }
.payment-method .checkout-qr {
  display: block;
  width: min(220px, 100%);
  aspect-ratio: 1;
  margin: 7px auto 4px;
  padding: 5px;
  min-height: 0;
  border: 1px solid #e1e1e1;
  background: white;
  object-fit: contain;
}
.payment-instructions { margin: 0; color: #333; font-size: 15px; font-weight: 650; }
.payment-device { margin: 0; color: #666; font-size: 12px; }
.payment-message { margin: 6px 0; color: #a13735; font-size: 13px; }
.payment-message:empty { display: none; }
.payment-dialog button.payment-check, .payment-dialog button.payment-refresh,
.payment-dialog button.payment-leave {
  width: 100%;
  min-height: 35px;
  margin: 7px 0 0;
  padding: 4px 11px;
  border: 0;
  border-radius: 99px;
  font-size: 13px;
}
.payment-dialog button.payment-check { color: #34333a; background: #eeedf0; }
.payment-dialog button.payment-refresh { background: #1677ff; }
.payment-dialog button.payment-leave { background: #777680; }
.payment-number { margin: 8px 0 0; font-size: 11px; color: #777680; overflow-wrap: anywhere; }

.review-scenes {
  position: fixed;
  z-index: 2;
  bottom: 0;
  left: 0;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 0 9px 0 0;
  background: #fff1c9;
  color: #242943;
  font-size: 12px;
}
.review-scenes summary { cursor: pointer; }
.review-scenes nav { display: grid; gap: 4px; padding: 7px 0; }
.review-scenes a { padding: 3px 6px; color: #37318f; }

@media (prefers-reduced-motion: reduce) {
  .preparation-track span, .welcome-packet form, .payment-dialog[open] { animation: none; }
}
