.portal-stage3 .portal-stage2__nav-label,
.portal-stage3 .portal-stage2__eyebrow {
  font-size: 13px;
}

.portal-stage3 .portal-stage2__profile-trigger {
  min-width: 44px;
  min-height: 44px;
}

.portal-stage3__mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 360px);
  min-width: 0;
  gap: 4px;
  margin: -8px 0 20px;
  padding: 4px;
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: #edf1f7;
}

.portal-stage3__mode-switch form {
  min-width: 0;
  margin: 0;
}

.portal-stage3__mode-button {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  color: #526078;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.portal-stage3__mode-button.is-active {
  color: #0758d5;
  background: var(--portal-surface);
  box-shadow: 0 4px 12px rgba(18, 36, 68, .09);
}

.portal-stage3__stepper-input[type="number"] {
  appearance: textfield;
}

.portal-stage3__stepper-input[type="number"]::-webkit-inner-spin-button,
.portal-stage3__stepper-input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.portal-stage3__stepper-actions {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  display: none;
  height: 44px;
  align-items: stretch;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: transparent;
}

.portal-stage3.has-stage3-js .portal-stage3__stepper-actions {
  display: flex;
}

.portal-stage3.has-stage3-js .portal-stage3__stepper-input {
  padding-right: 106px;
}

.portal-stage3__stepper-button {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid #d7deea;
  color: #526078;
  background: var(--portal-surface-soft);
  cursor: pointer;
}

.portal-stage3__stepper-button + .portal-stage3__stepper-button {
  border-left: 0;
}

.portal-stage3__stepper-button:disabled {
  color: #a3adbc;
  background: #f2f4f8;
  cursor: not-allowed;
}

.portal-stage3__stepper-icon {
  width: 20px;
  height: 20px;
}

.portal-stage3__choice-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 14px;
}

.portal-stage3__choice-group {
  min-width: 0;
  margin: 0 0 21px;
  padding: 0;
  border: 0;
}

.portal-stage3__choice-columns .portal-stage3__choice-group {
  margin-bottom: 21px;
}

.portal-stage3__choice-group legend {
  margin-bottom: 10px;
  color: #24334e;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.portal-stage3__choice-grid {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.portal-stage3__choice-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-stage3__choice-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-stage3__choice-grid--7 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.portal-stage3__choice-grid label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.portal-stage3__choice-option {
  position: relative;
  display: grid;
  min-height: 50px;
  place-items: center;
  padding: 9px 28px 9px 8px;
  border: 1px solid var(--portal-border-strong);
  border-radius: var(--portal-control-radius);
  color: #526078;
  background: var(--portal-surface);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  transition: border-color .16s ease, color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.portal-stage3__choice-check {
  position: absolute;
  top: 50%;
  right: 7px;
  display: none;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--portal-primary);
  transform: translateY(-50%);
}

.portal-stage3__choice-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.portal-stage3__choice-label-icon {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  color: var(--portal-primary);
}

.portal-stage3__choice-check-icon {
  width: 12px;
  height: 12px;
}

.portal-stage3__choice-grid input:checked + .portal-stage3__choice-option {
  border-color: var(--portal-primary);
  color: #0758d5;
  background: var(--portal-primary-soft);
  box-shadow: inset 0 0 0 1px rgba(18, 104, 244, .08);
}

.portal-stage3__choice-grid input:checked + .portal-stage3__choice-option .portal-stage3__choice-check {
  display: grid;
}

.portal-stage3__choice-grid input:focus-visible + .portal-stage3__choice-option {
  outline: 3px solid var(--portal-focus);
  outline-offset: 3px;
}

.portal-stage3__info-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  margin: -1px 0 21px;
  padding: 12px 14px;
  border: 1px solid #cfdcf1;
  border-radius: var(--portal-control-radius);
  color: #40516e;
  background: #f4f7fc;
}

.portal-stage3__info-row p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.portal-stage3__info-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: var(--portal-primary);
}

.portal-stage3__submit--tariff:disabled {
  min-height: 56px;
  padding-right: 14px;
  padding-left: 14px;
  color: #53617a;
  border: 1px solid #d8e0eb;
  background: #e9eef5;
  box-shadow: none;
  cursor: not-allowed;
}

.portal-stage3__submit--tariff .portal-stage2__submit-idle {
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.portal-stage3__price-copy {
  max-width: 142px;
  overflow-wrap: anywhere;
}

.portal-stage3__summary-tariff dd {
  color: #0758d5;
}


.portal-stage3__choice-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portal-stage3__reaction-picker {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.portal-stage3__reaction-picker legend,
.portal-stage3__random-range legend,
.portal-stage3__reaction-duration legend {
  color: #24334e;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.portal-stage3__reaction-picker > p {
  margin: 5px 0 12px;
  color: var(--portal-text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.portal-stage3__reaction-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  min-width: 0;
  gap: 8px;
}

.portal-stage3__reaction-grid label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.portal-stage3.has-stage3-js .portal-stage3__reaction-picker:not(.is-expanded) .portal-stage3__reaction-item--extra {
  display: none;
}

.portal-stage3__reaction-toggle {
  display: none;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 10px;
  padding: 9px 14px;
  border: 1px solid var(--portal-border-strong);
  border-radius: var(--portal-control-radius);
  color: #34435d;
  background: var(--portal-surface);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.portal-stage3.has-stage3-js .portal-stage3__reaction-toggle {
  display: flex;
}

.portal-stage3__reaction-toggle:focus-visible {
  outline: 3px solid var(--portal-focus);
  outline-offset: 3px;
}

.portal-stage3__reaction-toggle-preview {
  display: inline-flex;
  align-items: center;
  padding-left: 4px;
}

.portal-stage3__reaction-toggle-preview[hidden] {
  display: none;
}

.portal-stage3__reaction-toggle-preview img {
  display: block;
  width: 24px;
  height: 24px;
  margin-left: -5px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(21, 44, 81, .08));
}

.portal-stage3__reaction-toggle-count {
  display: inline-grid;
  min-width: 34px;
  min-height: 24px;
  place-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  color: #0758d5;
  background: var(--portal-primary-soft);
  font-size: 12px;
  font-weight: 700;
}

.portal-stage3__reaction-toggle-chevron {
  width: 16px;
  height: 16px;
  transition: transform .16s ease;
}

.portal-stage3__reaction-toggle[aria-expanded="true"] .portal-stage3__reaction-toggle-chevron {
  transform: rotate(180deg);
}

.portal-stage3__reaction-option {
  position: relative;
  display: grid;
  min-height: 56px;
  place-items: center;
  padding: 8px;
  border: 1px solid var(--portal-border-strong);
  border-radius: var(--portal-control-radius);
  background: var(--portal-surface);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.portal-stage3__reaction-art {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.portal-stage3__reaction-check {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--portal-primary);
}

.portal-stage3__reaction-check-icon {
  width: 11px;
  height: 11px;
}

.portal-stage3__reaction-grid input:checked + .portal-stage3__reaction-option {
  border-color: var(--portal-primary);
  background: var(--portal-primary-soft);
  box-shadow: inset 0 0 0 1px rgba(18, 104, 244, .08);
}

.portal-stage3__reaction-grid input:checked + .portal-stage3__reaction-option .portal-stage3__reaction-check {
  display: grid;
}

.portal-stage3__reaction-grid input:focus-visible + .portal-stage3__reaction-option {
  outline: 3px solid var(--portal-focus);
  outline-offset: 3px;
}

.portal-stage3__reaction-quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(270px, .95fr);
  min-width: 0;
  align-items: start;
  gap: 14px;
  margin-bottom: 21px;
}

.portal-stage3__reaction-base-quantity,
.portal-stage3__random-range {
  min-width: 0;
}

.portal-stage3__reaction-base-quantity .portal-stage2__field {
  margin-bottom: 0;
}

.portal-stage3__random-range {
  margin: 0;
  padding: 0;
  border: 0;
}

.portal-stage3__random-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 8px;
  margin-top: 8px;
}

.portal-stage3__random-bound {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.portal-stage3__random-prefix {
  color: var(--portal-text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.portal-stage3__random-prefix strong {
  color: #24334e;
  font-weight: 700;
}

.portal-stage3__random-inputs input {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 13px 14px;
  border: 1px solid var(--portal-border-strong);
  border-radius: var(--portal-control-radius);
  color: var(--portal-text);
  background: var(--portal-surface);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  outline: none;
  appearance: textfield;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.portal-stage3__random-inputs input::-webkit-inner-spin-button,
.portal-stage3__random-inputs input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.portal-stage3__random-inputs input:focus {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 4px var(--portal-focus);
}

.portal-stage3__random-range small {
  display: block;
  margin-top: 7px;
  color: var(--portal-text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.portal-stage3__reaction-duration {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.portal-stage3__reaction-duration-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .8fr);
  min-width: 0;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}

.portal-stage3__reaction-duration-value {
  margin-bottom: 0;
}

.portal-stage3__reaction-duration-units {
  align-items: stretch;
}

.portal-stage3__reaction-duration-units .portal-stage3__choice-option {
  min-height: 54px;
}

.portal-stage3__summary-reactions {
  display: flex;
  max-width: 145px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  line-height: 1 !important;
}

.portal-stage3__summary-reactions img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

@media (hover: hover) {
  .portal-stage3__mode-button:hover {
    color: #0758d5;
    background: rgba(255, 255, 255, .7);
  }

  .portal-stage3__stepper-button:hover:not(:disabled) {
    color: #0758d5;
    background: var(--portal-primary-soft);
  }

  .portal-stage3__choice-grid label:hover .portal-stage3__choice-option {
    border-color: #6f8fbe;
    color: #0758d5;
  }

  .portal-stage3__reaction-grid label:hover .portal-stage3__reaction-option {
    border-color: #6f8fbe;
    transform: translateY(-1px);
  }

  .portal-stage3__reaction-toggle:hover {
    border-color: #6f8fbe;
    color: #0758d5;
    background: #f8fbff;
  }
}

@media (max-width: 1099px) {
  .portal-stage3__choice-grid--7 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .portal-stage3__reaction-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .portal-stage3__reaction-quantity-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .portal-stage3__mode-switch {
    width: 100%;
    margin-top: -5px;
    margin-bottom: 18px;
  }

  .portal-stage3__choice-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .portal-stage3__choice-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-stage3__reaction-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .portal-stage3__reaction-duration-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-stage3__choice-grid--7 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .portal-stage3__choice-option {
    min-height: 50px;
  }

  .portal-stage3__price-copy {
    max-width: 155px;
  }
}

@media (max-width: 360px) {
  .portal-stage3__choice-grid--3,
  .portal-stage3__choice-grid--7 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-stage3__reaction-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .portal-stage3.has-stage3-js .portal-stage3__stepper-input {
    padding-right: 98px;
  }

  .portal-stage3__stepper-button {
    flex-basis: 40px;
    width: 40px;
    min-width: 40px;
  }

  .portal-stage3__price-copy {
    max-width: 126px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-stage3__mode-button,
  .portal-stage3__choice-option,
  .portal-stage3__reaction-option,
  .portal-stage3__reaction-toggle,
  .portal-stage3__reaction-toggle-chevron {
    transition-duration: .01ms !important;
  }
}

/* Reaction picker UX v2: selected-first ordering and consistent Twemoji artwork. */
.portal-stage3__reaction-picker-heading {
  display: flex;
  width: 100%;
  float: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
}

.portal-stage3__reaction-selected-count {
  color: var(--portal-text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
}

.portal-stage3__reaction-selected-count.has-selection {
  color: #0758d5;
}

.portal-stage3__reaction-option {
  min-height: 58px;
  padding: 7px;
  border-color: #cbd6e5;
  border-radius: 10px;
  box-shadow: 0 1px 1px rgba(25, 47, 84, .025);
}

.portal-stage3__reaction-art {
  width: 40px;
  height: 40px;
  image-rendering: -webkit-optimize-contrast;
  filter: none;
  transform: none;
}

.portal-stage3__reaction-check {
  top: 4px;
  right: 4px;
  width: 17px;
  height: 17px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(18, 76, 159, .22);
}

.portal-stage3__reaction-check-icon {
  width: 10px;
  height: 10px;
}

.portal-stage3__reaction-grid input:checked + .portal-stage3__reaction-option {
  border-color: #1683ed;
  background: #eef7ff;
  box-shadow: inset 0 0 0 1px #1683ed, 0 5px 14px rgba(18, 104, 244, .10);
}

.portal-stage3__reaction-toggle {
  border-radius: 10px;
}

@media (max-width: 640px) {
  .portal-stage3__reaction-picker-heading {
    align-items: baseline;
  }

  .portal-stage3__reaction-selected-count {
    font-size: 11px;
  }

  .portal-stage3__reaction-option {
    min-height: 55px;
    padding: 6px;
  }

  .portal-stage3__reaction-art {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-stage3__reaction-art {
    transition-duration: .01ms !important;
  }
}

@media (max-width: 480px) {
  .portal-stage3__subscriber-gender .portal-stage3__choice-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-stage3__subscriber-gender .portal-stage3__choice-grid--3 > label:first-child {
    grid-column: 1 / -1;
  }
}

/* Surgical alignment with the Stage 2 duration-button reference. */
.portal-stage3__mode-button {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.portal-stage3__duration-grid--gender {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-stage3__duration-grid--gender label:nth-child(n) {
  grid-column: auto;
}

.portal-choice-reference-grid {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.portal-choice-reference-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-choice-reference-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portal-choice-reference {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 50px;
  place-items: center;
  padding: 9px 29px 9px 8px;
  border: 1px solid var(--portal-border-strong);
  border-radius: var(--portal-control-radius);
  color: #526078;
  background: var(--portal-surface);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: border-color .16s ease, color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.portal-choice-reference.is-active {
  border-color: var(--portal-primary);
  color: #0758d5;
  background: var(--portal-primary-soft);
  box-shadow: inset 0 0 0 1px rgba(18, 104, 244, .08);
}

.portal-choice-reference.is-active .portal-stage2__duration-check {
  display: grid;
}

.portal-choice-reference:focus-visible {
  outline: 3px solid var(--portal-focus);
  outline-offset: 3px;
}

.portal-bot-activity__mode-switch {
  width: min(100%, 360px);
  margin: -8px 0 24px;
}

.portal-bot-activity__star-note {
  margin: 14px 0 24px;
  color: #60708a;
  font-size: 13px;
  line-height: 1.45;
}

.portal-bot-active-users {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--portal-border);
  border-radius: 14px;
  background: #f8fbff;
}

.portal-bot-active-users h3 {
  margin: 0 0 10px;
  color: #17233a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.portal-bot-active-users dl {
  margin: 0;
}

.portal-bot-active-users dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid rgba(130, 151, 184, .22);
}

.portal-bot-active-users dl > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.portal-bot-active-users dl > div:last-child {
  padding-bottom: 0;
}

.portal-bot-active-users dt,
.portal-bot-active-users dd {
  margin: 0;
}

.portal-bot-active-users dt {
  min-width: 0;
  color: #526078;
  font-size: 13px;
  line-height: 1.4;
}

.portal-bot-active-users dd {
  color: #0758d5;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (hover: hover) {
  .portal-choice-reference:hover {
    border-color: #9ebcf0;
    color: #0758d5;
  }
}

@media (max-width: 640px) {
  .portal-choice-reference-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-bot-activity__mode-switch {
    width: 100%;
    margin-top: -5px;
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  .portal-stage3__duration-grid--gender {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-stage3__duration-grid--gender > label:first-child {
    grid-column: 1 / -1;
  }

  .portal-bot-active-users dl > div {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-choice-reference {
    transition-duration: .01ms !important;
  }
}
