:root {
  --bg: #eceef3;
  --text: #191a26;
  --text-muted: #6b7280;
  --card: #ffffff;
  --stroke: #e4e7ef;
  --primary: #b13ff3;
  --primary-dark: #6b45d8;
  --gradient-btn: linear-gradient(135deg, #c850f2 0%, #8d4df0 48%, #4f8eff 100%);
  --shadow-card: none;
  --radius-card: 16px;
  --radius-btn: 12px;
}

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

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

body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.auth-page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 48px;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--stroke);
  box-shadow: none;
  padding: 28px 28px 24px;
  text-align: center;
}

.auth-card.is-phone-step {
  padding-top: 48px;
}

.auth-back {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #f7f8fb;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.auth-back:hover {
  background: #eef0f5;
}

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

.auth-step[hidden] {
  display: none !important;
}

.auth-card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 18px;
}

.auth-card-logo img {
  display: block;
  width: min(300px, 92%);
  height: auto;
  max-height: 72px;
  object-fit: contain;
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0 0 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 32ch;
  margin-inline: auto;
}

.auth-actions {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-privacy {
  margin: 0;
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.4;
}

.auth-oauth-actions {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.auth-oauth-wait {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-phone-title {
  margin: 0 0 10px;
  font-size: clamp(1.2rem, 4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.phone-form {
  display: grid;
  gap: 14px;
  text-align: left;
  margin-top: 8px;
}

.phone-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.phone-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.phone-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(155, 108, 244, 0.22);
}

.phone-input.is-error {
  border-color: #e55353;
  box-shadow: 0 0 0 3px rgba(229, 83, 83, 0.2);
}

.auth-sms-sent {
  margin: 0 0 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 34ch;
  margin-inline: auto;
}

.auth-sms-sent__phone {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.sms-form {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
  text-align: center;
}

.otp-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.otp-digit {
  width: 100%;
  aspect-ratio: 1;
  max-height: 56px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
  padding: 0;
}

.otp-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(155, 108, 244, 0.22);
}

.sms-timer {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sms-resend {
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #b8bcc8;
  cursor: not-allowed;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sms-resend.is-active {
  color: var(--primary-dark);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter 0.2s ease, transform 0.15s ease;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  background: var(--gradient-btn);
  color: #fff;
  box-shadow: none;
}

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

.btn-secondary {
  background: #f0f1f5;
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn-secondary:hover {
  background: #e8eaf0;
}

.btn-telegram {
  color: #229ed9;
}

.btn.btn-telegram {
  background: #eef8fd;
  color: #229ed9;
  border: 1px solid rgba(34, 158, 217, 0.28);
}

.btn.btn-telegram:hover {
  background: #e3f4fc;
  filter: none;
}

.btn-secondary.btn-telegram:hover {

.btn-max {
  background: linear-gradient(135deg, #4a90e2 0%, #6b5ce7 52%, #9b59d6 100%);
  color: #fff;
}

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

.btn-icon {
  flex-shrink: 0;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--gradient-btn);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 200;
}

@media (max-width: 380px) {
  .auth-card {
    padding: 24px 18px 20px;
  }
}

.mobile-id-widget-host {
  width: 100%;
  min-height: 280px;
  margin-top: 8px;
}

.mobile-id-widget-host:empty {
  min-height: 0;
}

.auth-card.is-phone-step .mobile-id-widget-host {
  text-align: left;
}
