:root {
  --text: #eef2ff;
  --muted: #99a2b8;
  --line: #303a58;
  --ok: #3ad29f;
  --warn: #f6c85f;
  --err: #ff8c8c;
  --chat-background-base: rgb(20, 20, 21);
  --chat-pattern-color: rgb(39, 41, 78);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  position: relative;
  color: var(--text);
  font-family: "Segoe UI", "Inter", "Roboto", sans-serif;
  background: var(--chat-background-base);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: var(--chat-pattern-color);
  -webkit-mask-image: url("/assets/pattern_space.aFb4MW9l.svg");
  mask-image: url("/assets/pattern_space.aFb4MW9l.svg");
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: auto;
  mask-size: auto;
  -webkit-mask-position: 50% 50%;
  mask-position: 50% 50%;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: rgba(8, 10, 14, 0.24);
}

.auth-modal {
  position: relative;
  z-index: 2;
  width: min(400px, calc(100vw - 36px));
  min-height: 460px;
  border-radius: 28px;
  border: none;
  background: #17181c;
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.42),
    0 4px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  padding: 30px 28px 24px;
}

.auth-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.title {
  margin: 0;
  text-align: center;
  font-size: 33px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.block {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.auth-input {
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 31, 0.94);
  color: var(--text);
  padding: 0 16px;
  outline: none;
  font-size: 18px;
  text-align: center;
}

.auth-input:focus {
  border-color: #5887d4;
  box-shadow: 0 0 0 2px rgba(88, 135, 212, 0.24);
}

.primary-btn {
  height: 52px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 25px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(90deg, #3387ff 0%, #9450ec 100%);
  box-shadow: 0 8px 20px rgba(80, 99, 236, 0.35);
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.primary-btn:disabled,
.primary-btn:disabled:hover {
  cursor: default;
  filter: saturate(0.45) brightness(0.82);
  box-shadow: 0 4px 12px rgba(17, 25, 44, 0.38);
}

.link-btn {
  justify-self: center;
  border: none;
  background: transparent;
  color: #7da6ff;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px 0;
  min-height: 22px;
}

.link-btn:disabled {
  color: #5d78aa;
  opacity: 0.72;
  cursor: default;
  pointer-events: none;
}

.assist {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 42px;
  margin-top: 2px;
  align-content: start;
}

.resend-wrap {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resend-wrap.ghost {
  visibility: hidden;
}

.status {
  text-align: center;
  font-size: 14px;
  color: var(--err);
  line-height: 20px;
  min-height: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 120ms ease;
}

.status.err {
  visibility: visible;
  opacity: 1;
}

.terms {
  margin: 20px 0 0;
  text-align: center;
  color: #6f7f9f;
  font-size: 12px;
  line-height: 1.45;
}

.terms a {
  color: #5a97ff;
  text-decoration: none;
  font-weight: 600;
}

.terms a:hover {
  text-decoration: underline;
}

.success-message {
  margin: -24px 0 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #eef2ff;
}

@media (max-width: 620px) {
  .auth-modal {
    min-height: 400px;
    border-radius: 22px;
    padding: 24px 18px 18px;
  }

  .title {
    font-size: 28px;
  }

  .auth-input {
    font-size: 17px;
  }

  .primary-btn {
    font-size: 23px;
  }
}

/* Обычный экран (телефон/код) ниже */
#authBlock,
#assistBlock {
  transform: translateY(10px); /* больше => ниже */
}

/* Экран успеха выше */
#successView {
  transform: translateY(-18px); /* более минус => выше */
}
