* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: #000;
  background-image: url("/static/pattern_space.svg");
  background-repeat: repeat;
  background-size: 250px;
  color: #fff;
  font-family: Segoe UI, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  padding: 18px;
}
.site-header { width: 100%; padding-bottom: 18px; }
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  background: #1e1a2e;
  border-radius: 50px;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.header-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}
.header-logo-text {
  font-size: 22px;
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.3px;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  flex: 1;
  justify-content: center;
}
.header-nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
  transition: opacity 0.2s;
  cursor: pointer;
}
.header-nav-link:hover {
  opacity: 0.6;
}
.header-open-btn {
  color: #4d8cff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}
.auth-card {
  width: 100%;
  max-width: 430px;
  background: #151922;
  border-radius: 20px;
  padding: 30px 24px;
  border: 1px solid #2a3040;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.35);
}
.auth-step { display: none; }
.auth-step.active { display: block; }
.auth-header { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-title { font-size: 20px; font-weight: 600; color: #fff; }
.back-button {
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: transparent; color: #5c6a8a; cursor: pointer;
  font-size: 20px; line-height: 1;
}
.phone-input, .code-input, .password-input, .opt-input {
  width: 100%;
  padding: 15px 16px;
  background: #0a0c10;
  border: 1px solid #232830;
  border-radius: 14px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
  margin-bottom: 12px;
}
.phone-input:focus, .code-input:focus, .password-input:focus, .opt-input:focus {
  border-color: #5c66ff;
}
.btn {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(90deg, #2b7fff 0%, #a855f7 100%);
  color: #fff;
  margin-bottom: 14px;
}
.btn.secondary {
  background: transparent;
  border: 1px solid #2c3446;
  color: #a0a8c0;
}
.is-hidden { display: none !important; }
.btn:hover:not(:disabled) { opacity: 0.92; }
.btn-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.btn.secondary .btn-spinner {
  border-color: rgba(160, 168, 192, 0.35);
  border-top-color: #c8d0e8;
}
.btn.is-loading .btn-spinner {
  display: block;
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.88;
}
.btn.is-loading {
  pointer-events: none;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.terms {
  font-size: 13px;
  font-weight: 400;
  color: #5a6478;
  line-height: 1.5;
  text-align: center;
  margin-top: -4px;
}
.terms a {
  color: #4d8cff;
  text-decoration: none;
  transition: color 0.2s ease;
}
.terms a:hover {
  color: #66a3ff;
  text-decoration: underline;
}
.step-hint { font-size: 14px; color: #5a6478; line-height: 1.5; margin-bottom: 16px; }
.error-msg {
  font-size: 13px; color: #ff5f5f; min-height: 18px; margin-bottom: 10px; line-height: 1.4;
}
.status {
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid #2c3446;
  background: #0a0c10;
  color: #d7e0ff;
  padding: 11px 12px;
  white-space: pre-wrap;
  font-size: 14px;
}
.status.ok { border-color: rgba(53, 208, 127, 0.45); color: #d5ffe7; }
.status.err { border-color: rgba(255, 111, 111, 0.45); color: #ffd6d6; }
.row-label {
  margin-top: 2px;
  margin-bottom: 6px;
  color: #9aa4bf;
  font-size: 13px;
}
details.advanced {
  margin: 10px 0 12px;
  border: 1px solid #2c3446;
  border-radius: 12px;
  background: #0f131a;
  padding: 10px 12px;
}
details.advanced summary {
  cursor: pointer;
  color: #b3bfdc;
  font-size: 13px;
  margin-bottom: 8px;
  user-select: none;
}
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
  color: #b3bfdc;
  font-size: 13px;
}

.phone-input-lg {
  font-size: 19px;
  padding: 18px 18px;
  letter-spacing: 0.3px;
}

.status:empty {
  display: none;
}

.auth-card-done {
  padding-top: 36px;
  padding-bottom: 36px;
}
.auth-header-centered {
  justify-content: center;
  margin-bottom: 12px;
}
.auth-title-centered {
  text-align: center;
  width: 100%;
}
.step-hint-centered {
  text-align: center;
  margin-bottom: 8px;
}
.auth-again-link {
  color: #4d8cff;
  text-decoration: none;
  font-weight: 500;
}
.auth-again-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .site-header {
    padding-bottom: 12px;
  }

  .site-header-inner {
    border-radius: 20px;
    padding: 12px 14px;
  }

  .header-logo {
    font-size: 20px;
  }

  .header-open-btn {
    font-size: 14px;
  }
  .header-nav,
  .header-open-btn {
    display: none;
  }

  .main-content {
    align-items: flex-start;
    padding: 8px 0 20px;
  }

  .auth-card {
    max-width: 100%;
    border-radius: 16px;
    padding: 22px 16px;
  }

  .auth-header {
    margin-bottom: 16px;
  }

  .auth-title {
    font-size: 18px;
  }
  .header-logo-icon {
    width: 30px;
    height: 30px;
  }

  .phone-input,
  .code-input,
  .password-input,
  .opt-input,
  .btn {
    font-size: 16px;
    padding: 14px 14px;
  }

  .phone-input-lg {
    font-size: 21px;
    padding: 16px 14px;
  }

  details.advanced {
    padding: 8px 10px;
  }
}
