:root {
  color-scheme: only light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 620px;
  overflow-x: hidden;
  font-family: "Montserrat", sans-serif;
  background-color: #8d79fc;
  color: #111111;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  outline: none;
  border: 0;
  box-shadow: none;
  caret-color: #111111;
  -webkit-appearance: none;
  appearance: none;
}

button,
input,
[role="button"] {
  touch-action: manipulation;
}

button {
  background: none;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background-color: #8d79fc;
}

.auth-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-stage__logo {
  position: absolute;
  top: 50%;
  left: calc(50% - 0.5px);
  width: 341px;
  height: 196px;
  transform: translate(-50%, -50%);
  filter: blur(18px);
  opacity: 0.72;
}

.auth-telegram-preflight-pending body {
  background-color: #8d79fc;
}

.auth-telegram-preflight-pending .auth-stage {
  display: none;
}

.auth-panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: min(620px, 100vw);
  min-height: 100vh;
  background: #ffffff;
}

.auth-telegram-preflight-pending .auth-panel {
  right: auto;
  left: 0;
  width: 100%;
  background: transparent;
}

.auth-telegram-preflight-pending .auth-panel__viewport {
  background: transparent;
}

.auth-panel__viewport {
  position: relative;
  min-height: 100vh;
  padding: 48px 0;
}

.auth-panel__content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(382px, calc(100vw - 48px));
  transform: translate(-50%, -50%);
}

.auth-telegram-preflight {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(240px, calc(100vw - 48px));
  transform: translate(-50%, -50%);
  text-align: center;
}

.auth-telegram-preflight-pending .auth-telegram-preflight {
  display: flex;
}

.auth-telegram-preflight-pending .auth-panel__content,
.auth-telegram-preflight-pending .auth-consent {
  visibility: hidden;
  pointer-events: none;
}

.auth-telegram-preflight__loader {
  width: 18px;
  height: 18px;
}

.auth-telegram-preflight__title {
  margin: 0;
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  color: #ffffff;
}

.auth-step {
  width: 100%;
}

.auth-step--methods {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.auth-step--phone,
.auth-step--code {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.auth-step__copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-step__title {
  margin: 0;
  width: 100%;
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 30px;
  color: #000000;
}

.auth-step__title--centered {
  text-align: center;
}

.auth-step__text {
  margin: 0;
  width: 100%;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  color: #2b2b2b;
}

.auth-step__phone {
  margin: 0;
  width: 100%;
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 24px;
  color: #2b2b2b;
}

.auth-actions-stack,
.auth-form,
.auth-code-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-form--code {
  gap: 24px;
}

.auth-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 16px 32px;
  border-radius: 12px;
  background: linear-gradient(180deg, #8b76ff 0%, #6b1385 100%);
  color: #ffffff;
  transition: opacity 0.2s ease;
}

.auth-button--dimmed:disabled {
  opacity: 0.5;
}

.auth-button:disabled {
  cursor: default;
}

.auth-button--loading {
  pointer-events: none;
}

.auth-button__label {
  display: block;
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-align: center;
}

.auth-button__loader {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.auth-button--loading .auth-button__label {
  visibility: hidden;
}

.auth-button--loading .auth-button__loader {
  position: absolute;
  inset: 0;
  margin: auto;
}

.auth-field {
  width: 100%;
}

.auth-input {
  width: 100%;
  height: 50px;
  padding: 14px 16px;
  border: 0.5px solid rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  background: #ffffff;
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #000000;
}

.auth-input::placeholder {
  color: #494949;
  opacity: 1;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -7px 0 -5px -7px;
}

.auth-code-grid {
  --auth-code-length: 4;
  --auth-code-box-size: 54px;
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.auth-code-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 66px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  appearance: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 24px;
  line-height: 30px;
  outline: none;
}

.auth-code-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--auth-code-box-size);
  width: var(--auth-code-box-size);
  height: 66px;
  padding: 10px;
  border: 0.5px solid rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  background: #ffffff;
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 400;
  line-height: 30px;
  text-align: center;
  color: #494949;
  pointer-events: none;
  user-select: none;
}

.auth-code-grid--error .auth-code-cell {
  border-color: rgba(255, 0, 0, 0.7);
}

.auth-code-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-code-resend-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

.auth-text-button {
  width: fit-content;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: #5e00df;
  text-align: left;
}

.auth-text-button:disabled {
  cursor: default;
  color: #2b2b2b;
  opacity: 0.7;
}

.auth-help-text {
  margin: 0;
  width: 100%;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #515151;
}

.auth-error-message {
  margin: 0;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 0, 0, 0.08);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: #c91f37;
}

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

.auth-inline-link {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: #7c47c5;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.auth-consent {
  position: absolute;
  bottom: 46px;
  left: 50%;
  width: min(382px, calc(100vw - 48px));
  margin: 0;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  color: #515151;
  text-align: center;
}

.loader {
  display: block;
  object-fit: contain;
  animation: loader-spin 0.85s linear infinite;
  transform-origin: center;
}

@keyframes loader-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 979.98px) {
  body {
    min-width: 0;
    min-height: 100dvh;
    background: #ffffff;
  }

  .auth-shell {
    min-height: 100dvh;
    padding: 0;
    overflow-y: auto;
  }

  .auth-shell::before,
  .auth-stage {
    display: none;
  }

  .auth-panel {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    background: #ffffff;
  }

  .auth-panel__viewport {
    width: min(390px, 100%);
    min-height: max(700px, 100dvh);
    margin: 0 auto;
    padding: 0;
    position: relative;
    background: #ffffff;
  }

  .auth-panel__content {
    position: static;
    width: 100%;
    transform: none;
  }

  .auth-telegram-preflight {
    top: 50%;
    width: min(240px, calc(100vw - 28px));
    transform: translate(-50%, -50%);
  }

  .auth-step {
    position: absolute;
    top: 48px;
    left: 50%;
    width: min(362px, calc(100vw - 28px));
    transform: translateX(-50%);
  }

  .auth-step--methods {
    gap: 16px;
  }

  .auth-step--phone,
  .auth-step--code {
    gap: 20px;
    align-items: flex-start;
  }

  .auth-step__copy {
    gap: 10px;
  }

  .auth-step__title {
    font-size: 16px;
    line-height: 22px;
  }

  .auth-step__text {
    font-size: 14px;
    line-height: 1.2;
  }

  .auth-step__phone {
    font-size: 14px;
    line-height: 20px;
  }

  .auth-actions-stack,
  .auth-form,
  .auth-code-group {
    gap: 10px;
  }

  .auth-form--code {
    gap: 20px;
  }

  .auth-button {
    min-height: 50px;
    padding: 16px 32px;
    border-radius: 12px;
  }

  .auth-button__label {
    font-size: 12px;
    line-height: 18px;
  }

  .auth-field {
    width: 100%;
  }

  .auth-input {
    height: 50px;
    padding: 14px 16px;
    font-size: 16px;
    line-height: 22px;
    border-radius: 12px;
  }

  .auth-back {
    width: 40px;
    height: 40px;
    margin: -7px 0 -7px -7px;
  }

  .auth-back img {
    width: 26px;
    height: 26px;
  }

  .auth-code-grid {
    gap: 12px;
  }

  .auth-code-input,
  .auth-code-cell {
    height: 66px;
    border-radius: 12px;
    font-size: 24px;
    line-height: 30px;
  }

  .auth-code-cell {
    padding: 10px;
  }

  .auth-code-meta {
    gap: 10px;
  }

  .auth-text-button {
    font-size: 14px;
    line-height: 1.2;
  }

  .auth-help-text {
    font-size: 12px;
    line-height: 1.2;
  }

  .auth-consent {
    position: absolute;
    left: 50%;
    bottom: 21px;
    width: min(362px, calc(100vw - 28px));
    transform: translateX(-50%);
    font-size: 12px;
    line-height: 1.4;
  }

  .auth-shell[data-auth-step="code"] .auth-consent {
    display: none;
  }
}
