/* Power-user survey modal on /create: 5 questions for a 100-coin reward. */
.survey-overlay[hidden],
.survey-error[hidden],
.survey-progress[hidden] {
  display: none !important;
}

body.survey-open {
  overflow: hidden;
}

.survey-overlay {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: grid;
  place-items: start center;
  overflow-y: auto;
  padding: 24px;
  background: rgba(3, 7, 15, 0.82);
  backdrop-filter: blur(10px);
}

.survey-dialog {
  position: relative;
  width: min(100%, 560px);
  margin-block: auto;
  overflow: hidden;
  border-radius: 26px;
  padding: 30px 34px 26px;
  color: #eaf2ff;
  text-align: center;
  background:
    radial-gradient(circle at 85% -12%, rgba(63, 134, 199, 0.3), transparent 42%),
    radial-gradient(circle at -10% 8%, rgba(24, 116, 217, 0.24), transparent 38%),
    linear-gradient(160deg, #13203a 0%, #0d1730 55%, #091022 100%);
  box-shadow:
    0 0 0 1px rgba(105, 168, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 34px 90px rgba(0, 0, 0, 0.66),
    0 0 64px rgba(38, 118, 222, 0.28);
  animation: survey-dialog-enter 340ms cubic-bezier(0.2, 0, 0, 1) both;
}

/* Halftone comic texture over the card's top half. */
.survey-dialog::before {
  position: absolute;
  inset: 0 0 auto;
  height: 190px;
  pointer-events: none;
  content: "";
  background-image: radial-gradient(rgba(160, 200, 255, 0.16) 1px, transparent 1.5px);
  background-size: 14px 14px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
}

.survey-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 13px;
  padding: 0;
  color: rgba(214, 230, 255, 0.68);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 1px rgba(126, 178, 255, 0.16);
  cursor: pointer;
  transition-property: color, background-color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.survey-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
}

.survey-close:active {
  scale: 0.94;
}

.survey-close svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.survey-close:focus-visible,
.survey-option:focus-visible,
.survey-primary:focus-visible,
.survey-custom-input:focus-visible,
.survey-custom-textarea:focus-visible {
  outline: 2px solid #7db4ff;
  outline-offset: 2px;
}

.survey-progress {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  padding-right: 44px;
  text-align: left;
}

.survey-progress-label {
  color: #8fbcff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.survey-progress-track {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(126, 178, 255, 0.12);
}

.survey-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1874d9, #53a4ff 78%, #8fd0ff);
  box-shadow: 0 0 14px rgba(83, 164, 255, 0.65);
  transition: width 420ms cubic-bezier(0.2, 0, 0, 1);
}

.survey-mascot {
  display: block;
  width: 140px;
  height: 140px;
  margin: 2px auto 10px;
  object-fit: contain;
  filter: drop-shadow(0 14px 26px rgba(9, 22, 46, 0.55));
  animation: survey-mascot-float 3.6s ease-in-out infinite;
  transition: width 260ms cubic-bezier(0.2, 0, 0, 1), height 260ms cubic-bezier(0.2, 0, 0, 1);
}

.survey-dialog.is-question .survey-mascot {
  width: 92px;
  height: 92px;
  margin-bottom: 6px;
}

.survey-mascot.is-popping {
  animation: survey-mascot-pop 460ms cubic-bezier(0.2, 0, 0, 1), survey-mascot-float 3.6s ease-in-out 460ms infinite;
}

.survey-step-inner {
  animation: survey-step-in 300ms cubic-bezier(0.2, 0, 0, 1) both;
}

.survey-kicker {
  width: fit-content;
  margin: 0 auto 12px;
  border-radius: 999px;
  padding: 7px 13px;
  color: #9fd0ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  background: rgba(24, 116, 217, 0.16);
  box-shadow: inset 0 0 0 1px rgba(126, 178, 255, 0.3);
}

.survey-title {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* Интро: награда — главный заголовок. */
.survey-intro-coins {
  margin: 2px 0 2px;
  color: #ffd76a;
  font-size: clamp(40px, 6vw, 54px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 28px rgba(255, 197, 66, 0.45);
  animation: survey-coins-pop 560ms cubic-bezier(0.2, 0, 0.2, 1.35) both;
}

.survey-intro-sub {
  margin: 0 0 12px;
  color: #ffffff;
  font-size: clamp(18px, 2.8vw, 22px);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.survey-subtitle {
  margin: 0 auto 4px;
  max-width: 400px;
  color: rgba(214, 230, 255, 0.78);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

.survey-hint {
  margin: 2px 0 12px;
  color: rgba(178, 205, 244, 0.6);
  font-size: 12.5px;
  font-weight: 700;
}

/* Единый грид всех элементов ответа: варианты, textarea и «свой вариант»
   лежат внутри и разделяются одним и тем же gap. */
.survey-options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  text-align: left;
}

.survey-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 15px;
  padding: 12px 15px;
  color: rgba(228, 240, 255, 0.92);
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(126, 178, 255, 0.17);
  cursor: pointer;
  transition-property: background-color, box-shadow, color, transform;
  transition-duration: 160ms;
  transition-timing-function: ease-out;
}

.survey-option:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(148, 193, 255, 0.34);
  transform: translateY(-1px);
}

.survey-option:active {
  transform: scale(0.98);
}

.survey-option-box {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1.5px rgba(148, 193, 255, 0.4);
  transition: background-color 160ms ease-out, box-shadow 160ms ease-out;
}

.survey-option-box svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 140ms ease-out, transform 180ms cubic-bezier(0.2, 0, 0.2, 1.4);
}

.survey-option[aria-pressed="true"] {
  color: #ffffff;
  background: rgba(24, 116, 217, 0.22);
  box-shadow:
    inset 0 0 0 1.5px rgba(96, 165, 255, 0.85),
    0 6px 18px rgba(18, 84, 168, 0.28);
  animation: survey-option-pop 240ms cubic-bezier(0.2, 0, 0.2, 1.3);
}

.survey-option[aria-pressed="true"] .survey-option-box {
  background: linear-gradient(180deg, #3f93ec, #1874d9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 0 12px rgba(63, 147, 236, 0.55);
}

.survey-option[aria-pressed="true"] .survey-option-box svg {
  opacity: 1;
  transform: scale(1);
}

.survey-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 15px;
  padding: 5px 5px 5px 15px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(126, 178, 255, 0.17);
  transition: box-shadow 160ms ease-out, background-color 160ms ease-out;
}

.survey-custom:focus-within,
.survey-custom.has-value {
  background: rgba(24, 116, 217, 0.13);
  box-shadow: inset 0 0 0 1.5px rgba(96, 165, 255, 0.75);
}

.survey-custom-label {
  flex: 0 0 auto;
  color: rgba(178, 205, 244, 0.75);
  font-size: 13.5px;
  font-weight: 800;
}

.survey-custom-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 11px;
  padding: 10px 12px;
  color: #f2f7ff;
  font: inherit;
  font-size: 14px;
  background: rgba(6, 12, 26, 0.55);
  box-shadow: inset 0 0 0 1px rgba(126, 178, 255, 0.14);
}

.survey-custom-input::placeholder,
.survey-custom-textarea::placeholder {
  color: rgba(164, 190, 228, 0.5);
}

.survey-custom-textarea {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 15px;
  padding: 13px 15px;
  color: #f2f7ff;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  resize: none;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(126, 178, 255, 0.17);
  transition: box-shadow 160ms ease-out, background-color 160ms ease-out, opacity 160ms ease-out;
}

.survey-custom-textarea:focus {
  background: rgba(24, 116, 217, 0.13);
  box-shadow: inset 0 0 0 1.5px rgba(96, 165, 255, 0.75);
}

.survey-custom-textarea:disabled {
  opacity: 0.45;
}

.survey-error {
  margin: 12px 0 -2px;
  color: #ffb1a8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.survey-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

/* Кнопки под своим ответом появляются и исчезают — пустой блок не должен
   оставлять за собой отступ. */
.survey-actions:empty {
  display: none;
}

.survey-primary {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  padding: 0 22px;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition-property: background-color, box-shadow, color, opacity, scale, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.survey-primary {
  color: #ffffff;
  background: linear-gradient(180deg, #3f93ec 0%, #1465c4 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 14px 30px rgba(18, 84, 168, 0.42);
}

.survey-primary:hover {
  background: linear-gradient(180deg, #55a2f2 0%, #1a70d4 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 16px 34px rgba(18, 84, 168, 0.5);
  transform: translateY(-1px);
}

.survey-primary:active {
  scale: 0.97;
  transform: none;
}

.survey-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.survey-primary.is-busy {
  cursor: progress;
}

.survey-reward-note {
  margin: 14px auto 0;
  color: rgba(178, 205, 244, 0.66);
  font-size: 12.5px;
  font-weight: 700;
}

.survey-reward-note strong {
  color: #ffd76a;
  font-weight: 900;
}

/* Success screen */
.survey-success-coins {
  margin: 6px 0 4px;
  color: #ffd76a;
  font-size: clamp(38px, 6vw, 52px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 28px rgba(255, 197, 66, 0.45);
  animation: survey-coins-pop 560ms cubic-bezier(0.2, 0, 0.2, 1.35) both;
}

/* Confetti burst: pieces are laid out by JS with inline --dx/--rot/--delay. */
.survey-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.survey-burst i {
  position: absolute;
  top: -14px;
  left: var(--x, 50%);
  width: 9px;
  height: 14px;
  border-radius: 3px;
  background: var(--c, #53a4ff);
  opacity: 0;
  animation: survey-confetti-fall 1.7s cubic-bezier(0.24, 0.4, 0.6, 1) var(--delay, 0s) both;
}

@keyframes survey-dialog-enter {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes survey-step-in {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes survey-mascot-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -7px;
  }
}

@keyframes survey-mascot-pop {
  0% {
    scale: 0.82;
    rotate: -5deg;
  }
  60% {
    scale: 1.07;
    rotate: 2.5deg;
  }
  100% {
    scale: 1;
    rotate: 0deg;
  }
}

@keyframes survey-option-pop {
  0% {
    scale: 0.97;
  }
  60% {
    scale: 1.015;
  }
  100% {
    scale: 1;
  }
}

@keyframes survey-coins-pop {
  0% {
    opacity: 0;
    scale: 0.4;
  }
  65% {
    opacity: 1;
    scale: 1.12;
  }
  100% {
    opacity: 1;
    scale: 1;
  }
}

@keyframes survey-confetti-fall {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  8% {
    opacity: 1;
  }
  100% {
    opacity: 0.9;
    transform: translate(var(--dx, 0px), 108vh) rotate(var(--rot, 420deg));
  }
}

/* Light theme */
html[data-theme="light"] .survey-overlay {
  background: rgba(38, 44, 58, 0.42);
}

html[data-theme="light"] .survey-dialog {
  color: var(--ink, #222326);
  background:
    radial-gradient(circle at 88% -10%, rgba(63, 134, 199, 0.14), transparent 40%),
    radial-gradient(circle at -8% 6%, rgba(24, 116, 217, 0.1), transparent 36%),
    linear-gradient(165deg, #fffdfc 0%, #f4f6fb 60%, #e9eef8 100%);
  box-shadow:
    0 0 0 1px rgba(24, 116, 217, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 30px 80px rgba(37, 48, 73, 0.28),
    0 0 54px rgba(24, 116, 217, 0.14);
}

html[data-theme="light"] .survey-dialog::before {
  background-image: radial-gradient(rgba(24, 116, 217, 0.14) 1px, transparent 1.5px);
}

html[data-theme="light"] .survey-close {
  color: #5f6a7e;
  background: rgba(24, 47, 84, 0.05);
  box-shadow: 0 0 0 1px rgba(24, 116, 217, 0.16);
}

html[data-theme="light"] .survey-close:hover {
  color: #17181b;
  background: rgba(24, 47, 84, 0.09);
}

html[data-theme="light"] .survey-progress-label {
  color: #0d5fc7;
}

html[data-theme="light"] .survey-progress-track {
  background: rgba(24, 47, 84, 0.1);
  box-shadow: inset 0 0 0 1px rgba(24, 116, 217, 0.12);
}

html[data-theme="light"] .survey-mascot {
  filter: drop-shadow(0 12px 22px rgba(37, 48, 73, 0.24));
}

html[data-theme="light"] .survey-kicker {
  color: #0d5fc7;
  background: rgba(24, 116, 217, 0.1);
  box-shadow: inset 0 0 0 1px rgba(24, 116, 217, 0.26);
}

html[data-theme="light"] .survey-title {
  color: #17181b;
}

html[data-theme="light"] .survey-subtitle {
  color: #565d6b;
}

html[data-theme="light"] .survey-hint {
  color: #7d8494;
}

html[data-theme="light"] .survey-option {
  color: #2b2d33;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(24, 116, 217, 0.2);
}

html[data-theme="light"] .survey-option:hover {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(24, 116, 217, 0.4);
}

html[data-theme="light"] .survey-option-box {
  background: rgba(24, 47, 84, 0.06);
  box-shadow: inset 0 0 0 1.5px rgba(24, 116, 217, 0.4);
}

html[data-theme="light"] .survey-option[aria-pressed="true"] {
  color: #10345e;
  background: rgba(24, 116, 217, 0.1);
  box-shadow:
    inset 0 0 0 1.5px rgba(24, 116, 217, 0.75),
    0 6px 16px rgba(24, 116, 217, 0.16);
}

html[data-theme="light"] .survey-custom,
html[data-theme="light"] .survey-custom-textarea {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(24, 116, 217, 0.2);
}

html[data-theme="light"] .survey-custom:focus-within,
html[data-theme="light"] .survey-custom.has-value,
html[data-theme="light"] .survey-custom-textarea:focus {
  background: #ffffff;
  box-shadow: inset 0 0 0 1.5px rgba(24, 116, 217, 0.65);
}

html[data-theme="light"] .survey-custom-label {
  color: #565d6b;
}

html[data-theme="light"] .survey-custom-input {
  color: #17181b;
  background: rgba(24, 47, 84, 0.05);
  box-shadow: inset 0 0 0 1px rgba(24, 116, 217, 0.1);
}

html[data-theme="light"] .survey-custom-textarea {
  color: #17181b;
}

html[data-theme="light"] .survey-custom-input::placeholder,
html[data-theme="light"] .survey-custom-textarea::placeholder {
  color: #9aa2b1;
}

html[data-theme="light"] .survey-error {
  color: #c23c2e;
}

html[data-theme="light"] .survey-reward-note {
  color: #7d8494;
}

html[data-theme="light"] .survey-reward-note strong,
html[data-theme="light"] .survey-success-coins,
html[data-theme="light"] .survey-intro-coins {
  color: #c98a00;
  text-shadow: none;
}

html[data-theme="light"] .survey-intro-sub {
  color: #17181b;
}

@media (max-width: 780px) {
  /* Модалка остаётся карточкой: вокруг всегда видны поля оверлея,
     по вертикали центрируется, пока помещается. */
  .survey-overlay {
    padding: 28px 16px;
  }

  .survey-dialog {
    width: min(100%, 400px);
    border-radius: 24px;
    padding: 26px 20px 22px;
  }

  .survey-progress {
    margin-bottom: 16px;
    padding-right: 40px;
  }

  .survey-mascot {
    width: 108px;
    height: 108px;
    margin-bottom: 8px;
  }

  .survey-dialog.is-question .survey-mascot {
    width: 72px;
    height: 72px;
  }

  .survey-title {
    font-size: clamp(20px, 6vw, 24px);
  }

  .survey-intro-coins {
    font-size: clamp(36px, 11vw, 44px);
  }

  .survey-intro-sub {
    font-size: 17px;
  }

  .survey-subtitle {
    font-size: 14px;
  }

  .survey-options {
    gap: 9px;
    margin-top: 14px;
  }

  .survey-option {
    border-radius: 13px;
    padding: 12px 13px;
    font-size: 14px;
  }

  .survey-custom {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 13px;
  }

  .survey-custom-input {
    flex-basis: 100%;
    padding: 10px 12px;
  }

  .survey-actions {
    margin-top: 16px;
  }

  .survey-primary {
    min-height: 48px;
  }

  .survey-reward-note {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .survey-dialog,
  .survey-step-inner,
  .survey-mascot,
  .survey-mascot.is-popping,
  .survey-option[aria-pressed="true"],
  .survey-success-coins,
  .survey-intro-coins,
  .survey-burst i {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }

  .survey-close,
  .survey-option,
  .survey-option-box,
  .survey-option-box svg,
  .survey-custom,
  .survey-custom-textarea,
  .survey-primary,
  .survey-progress-fill,
  .survey-mascot {
    transition-duration: 0.01ms;
  }
}
