@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800;900&display=swap");

:root {
  --bg: #030712;
  --panel: rgba(12, 18, 32, 0.82);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: #07111f;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-card {
  width: min(100%, 448px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 24px;
  border-radius: 8px;
  background: #fff;
  color: #020617;
  font-size: 26px;
  font-weight: 900;
}

.auth-title {
  margin: 0;
  text-align: center;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-sub {
  margin: 10px 0 24px;
  text-align: center;
  color: var(--muted);
}

.auth-sub a,
.check a,
.terms a,
.auth-row a,
.back-link {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(3, 7, 18, 0.78);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
}

.field input::placeholder {
  color: #64748b;
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 2px 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.auth-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #020617;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.telegram-login-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.telegram-login-fallback {
  display: block;
  margin-top: 12px;
  color: #93c5fd;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.telegram-login-fallback[hidden] {
  display: none;
}

.telegram-auth-button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: #229ed9;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.telegram-auth-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.telegram-auth-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #1879aa;
  font-size: 13px;
  font-weight: 900;
}

.bot-login-state {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.08);
}

.bot-login-state[hidden] {
  display: none;
}

.bot-login-state.is-error {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(248, 113, 113, 0.08);
}

.bot-login-state strong,
.bot-login-state p {
  display: block;
  margin: 0;
}

.bot-login-state p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-top-color: #86efac;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.email-login {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.email-login summary {
  padding: 15px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.email-login form {
  padding: 4px 16px 16px;
}

.notice {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: #93c5fd;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.form-message.error {
  color: #fca5a5;
}

.form-message.success {
  color: #86efac;
}

.back-link {
  display: block;
  margin-top: 22px;
  text-align: center;
}

.auth-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  text-decoration: none;
}

.lang-floating {
  position: fixed;
  right: 18px;
  top: auto;
  bottom: 16px;
  z-index: 20;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 900;
  box-shadow: none;
}

@media (max-width: 520px) {
  .auth-card {
    padding: 26px 18px;
    border-radius: 8px;
  }

  .auth-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
