:root {
  --auth-primary: #5cb8b2;
  --auth-text: #000;
  --auth-muted: #5b5b5b;
  --auth-border: #b2b2b2;
  --auth-field: #f8f8f8;
}

body.auth-modal-open {
  overflow: hidden;
}

.auth-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  font-family: "HarmonyOS Sans", Arial, sans-serif;
}

.auth-modal-layer[hidden] {
  display: none;
}

.auth-modal-layer--apple {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px calc(60px + env(safe-area-inset-bottom));
}

.auth-modal-layer--welcome .auth-modal {
  width: min(331px, calc(100vw - 36px));
  min-height: 0;
  padding: 30px 24px 26px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .49);
}

.auth-modal {
  position: relative;
  z-index: 1;
  width: min(366px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 33px 32px 32px;
  border-radius: 20px;
  background: #fff;
  color: var(--auth-text);
  box-shadow: 0 14px 42px rgba(0, 0, 0, .16);
}

.auth-view {
  display: block;
}

.auth-view[hidden] {
  display: none;
}

.auth-view h2 {
  margin: 0 auto 24px;
  max-width: 284px;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 700;
  text-align: center;
}

.auth-register-title--split .auth-register-title__top,
.auth-register-title--split .auth-register-title__bottom {
  display: block;
  text-align: center;
  white-space: nowrap;
}

.auth-register-title--split {
  width: calc(100% + 24px);
  max-width: none;
  margin-right: -12px;
  margin-left: -12px;
  font-size: 18px;
  line-height: 1.2;
}

@media (max-width: 360px) {
  .auth-register-title--split {
    font-size: 17px;
  }
}

.auth-view--welcome {
  min-height: 0;
  padding-top: 3px;
  text-align: center;
}

.auth-view--welcome h2 {
  margin-bottom: 22px;
}

.auth-subtitle {
  margin: 0 0 21px;
  color: var(--auth-text);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 700;
  text-align: center;
}

.auth-close {
  position: absolute;
  top: 13px;
  right: 17px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d2d2d2;
  font-size: 25px;
  line-height: 22px;
  cursor: pointer;
}

.auth-back {
  position: absolute;
  top: 13px;
  left: 17px;
  z-index: 2;
  display: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #222;
  font: 400 30px/24px Arial, sans-serif;
  cursor: pointer;
}

.auth-modal-layer[data-view]:not([data-view="welcome"]) .auth-back {
  display: block;
}

.auth-back:hover {
  color: var(--auth-primary);
}

.auth-primary-button,
.auth-apple-button,
.auth-google-button,
.auth-link-button,
.auth-forgot {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.auth-primary-button {
  display: block;
  width: 227px;
  max-width: 100%;
  height: 48px;
  margin: 25px auto 16px;
  padding: 0 16px;
  border-radius: 28.5px;
  background: var(--auth-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.auth-view--welcome .auth-primary-button {
  margin-top: 0;
}

.auth-primary-button--small {
  width: 80px;
  height: 24px;
  margin-top: 18px;
  font-size: 10px;
}

.auth-primary-button:disabled,
.auth-apple-button:disabled,
.auth-google-button:disabled {
  cursor: wait;
  opacity: .65;
}

.auth-google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 227px;
  max-width: 100%;
  height: 48px;
  margin: 0 auto;
  padding: 0 16px;
  border: 1px solid #c8c8c8;
  border-radius: 28.5px;
  background: #fff;
  color: #3c4043;
  font-size: 14px;
  font-weight: 700;
}

.auth-google-button-host {
  display: flex;
  justify-content: center;
  width: 227px;
  max-width: 100%;
  min-height: 48px;
  margin: 0 auto;
}

.auth-google-button:hover {
  background: #f8fafd;
}

.auth-google-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #4285f4;
  font: 700 18px/20px Arial, sans-serif;
}

.auth-apple-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 227px;
  max-width: 100%;
  height: 48px;
  margin: 0 auto;
  border-radius: 28.5px;
  background: #dfdfdf;
  color: #000;
  font-size: 14px;
  font-weight: 700;
}

.auth-apple-icon {
  display: block;
  width: 18px !important;
  height: 18px !important;
  max-width: 18px;
  max-height: 18px;
  color: #000;
  fill: currentColor;
  flex: 0 0 18px;
}

.auth-link-button {
  display: block;
  margin: 19px auto 0;
  padding: 0;
  background: transparent;
  color: var(--auth-primary);
  font-size: 14px;
  text-decoration: underline;
}

.auth-field {
  display: block;
  margin: 0 0 20px;
}

.auth-field > span,
.auth-personality > span {
  display: block;
  margin: 0 0 7px 2px;
  font-size: 12px;
  line-height: 20px;
}

.auth-field input,
.auth-field select {
  display: block;
  width: 100%;
  height: 38px;
  box-sizing: border-box;
  padding: 0 12px;
  border: .3px solid var(--auth-border);
  border-radius: 7px;
  background: var(--auth-field);
  color: #222;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.auth-field select {
  background: #fff;
}

.auth-field input::placeholder {
  color: #d3d3d3;
}

.auth-field input:focus,
.auth-field select:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 2px rgba(92, 184, 178, .16);
}

.auth-error {
  margin: -6px 0 0;
  color: #b42318;
  font-size: 12px;
  line-height: 18px;
}

/* Keep profile validation text below the phone row instead of overlapping it. */
.auth-view[data-auth-view="profile"] form > .auth-error {
  display: block;
  min-height: 24px;
  margin: 16px 2px 0;
  padding: 7px 0 0;
  box-sizing: border-box;
  line-height: 19px;
}

.auth-view[data-auth-view="profile"] .auth-form .auth-primary-button,
.auth-view[data-auth-view="profile"] form .auth-primary-button {
  margin-top: 18px;
}

.auth-form .auth-primary-button,
.auth-view form .auth-primary-button {
  margin-top: 27px;
}

.auth-personality {
  margin-top: 1px;
}

.auth-profile-extra {
  margin-top: 2px;
}

.auth-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 14px;
  align-items: start;
}

.auth-choice-group > span {
  display: block;
  margin: 0 0 7px 2px;
  font-size: 12px;
  line-height: 20px;
}

.auth-choice-row {
  display: flex;
  gap: 6px;
  min-height: 38px;
}

.auth-choice {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 9px;
  border: 1px solid #e1e1e1;
  border-radius: 20px;
  background: #fff;
  color: #999;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.auth-choice.is-selected {
  border-color: var(--auth-primary);
  background: rgba(92, 184, 178, .08);
  color: var(--auth-primary);
}

.auth-age-field {
  margin-bottom: 0;
}

.auth-phone-field {
  margin-top: 15px;
  margin-bottom: 0;
}

.auth-phone-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 8px;
}

.auth-phone-row input,
.auth-phone-row select {
  min-width: 0;
}

.auth-phone-country {
  position: relative;
  min-width: 0;
}

.auth-phone-country-native {
  display: none !important;
}

.auth-phone-country-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 38px;
  padding: 0 10px 0 12px;
  border: .3px solid var(--auth-border);
  border-radius: 7px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.auth-phone-country-trigger:focus,
.auth-phone-country-trigger[aria-expanded="true"] {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 2px rgba(92, 184, 178, .16);
}

.auth-phone-country-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.auth-phone-country-chevron {
  margin-left: 5px;
  color: #777;
  font-size: 15px;
  line-height: 1;
}

.auth-phone-country-menu {
  position: fixed;
  z-index: 11001;
  display: none;
  min-width: 104px;
  max-height: min(360px, calc(100dvh - 24px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0;
  border: 1px solid #d8d8d8;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
  box-sizing: border-box;
}

.auth-phone-country-menu.is-open {
  display: block;
}

.auth-phone-country-option {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: #222;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}

.auth-phone-country-option:hover,
.auth-phone-country-option:focus {
  background: #f1f1f1;
  outline: none;
}

.auth-phone-country-option.is-selected {
  background: #686868;
  color: #fff;
}

.auth-phone-country-menu::-webkit-scrollbar {
  width: 8px;
}

.auth-phone-country-menu::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 8px;
}

.auth-phone-country-menu::-webkit-scrollbar-track {
  background: #f3f3f3;
}

.auth-avatars {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 4px;
}

.auth-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #ffd9ce;
  color: #ff7568;
  font-size: 28px;
  cursor: pointer;
}

.auth-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.auth-avatar--add {
  border: 2px dashed #c6c6c6;
  background: #fff;
  color: #c6c6c6;
  font-size: 26px;
}

.auth-avatar--gold {
  background: #ffe4c1;
  color: #f0a04b;
}

.auth-avatar--pink {
  background: #ffd0df;
  color: #f194b6;
}

.auth-avatar.is-selected {
  border-color: var(--auth-primary);
}

@media (max-width: 360px) {
  .auth-profile-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .auth-age-field {
    margin-bottom: 0;
  }
}

.auth-forgot {
  display: none;
  padding: 0;
  background: transparent;
  color: #000;
  font-size: 12px;
  text-decoration: underline;
}

.auth-view--login h2 {
  margin-bottom: 34px;
  text-align: left;
}

.auth-view--login .auth-field {
  margin-bottom: 20px;
}

.auth-view--login .auth-primary-button {
  margin-top: 29px;
}

.auth-view--apple {
  min-height: 0;
}

.auth-modal-layer--apple .auth-modal {
  width: min(344px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  min-height: 0;
  margin: 0;
  padding: 24px 18px 18px;
  border-radius: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
}

.auth-view--apple h2 {
  margin: 0 0 6px;
  text-align: left;
  font-size: 17px;
  line-height: 1.2;
}

.auth-apple-description {
  margin: 0 0 13px;
  color: var(--auth-muted);
  font-size: 9px;
  line-height: 14px;
}

.auth-apple-options {
  padding: 0 12px;
  border-radius: 17px;
  background: #f2f2f2;
}

.auth-apple-options label {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 36px;
  padding: 6px 0 5px 28px;
  border-bottom: 1px solid #d2d2d2;
  font-size: 10px;
  line-height: 12px;
}

.auth-apple-options label:last-child {
  padding-top: 5px;
  border-bottom: 0;
}

.auth-apple-option-icon {
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  transform: translateY(-50%);
  border-radius: 6px;
  background: #e4e4e4;
  color: #111;
  font-size: 11px;
  line-height: 1;
}

.auth-apple-options strong {
  color: #939393;
  font-size: 8px;
  line-height: 10px;
  font-weight: 400;
}

.auth-view--apple .auth-primary-button--small {
  width: 73px;
  height: 23px;
  margin-top: 12px;
  margin-bottom: 0;
  border-radius: 14px;
  font-size: 9px;
}

.auth-modal.is-loading {
  cursor: wait;
}

@media (max-width: 430px) {
  .auth-modal-layer {
    padding: 18px;
  }

  .auth-modal {
    width: min(366px, calc(100vw - 36px));
  }
}

@media (max-height: 600px) {
  .auth-modal-layer {
    align-items: start;
    padding-top: 18px;
  }

  .auth-modal {
    max-height: calc(100dvh - 36px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-modal {
    animation: auth-modal-in .18s ease-out;
  }
}

@keyframes auth-modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
