/* ═══════════════════════════════════════════
   AUTH OVERLAY — Full-screen boot authentication screen
   ═══════════════════════════════════════════ */

.auth-overlay {
  position: fixed; inset: 0;
  background: var(--ink);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-overlay.auth-done {
  opacity: 0;
  pointer-events: none;
}

/* ── Atmospheric rings ── */
.auth-overlay::before,
.auth-overlay::after {
  content: '';
  position: absolute;
  top: 42%; left: 50%;
  border-radius: 50%;
  border: 1px solid var(--pitch-line);
  transform: translate(-50%, -50%);
  animation: authRingBreath 3.6s ease-in-out infinite;
}

.auth-overlay::before {
  width: 340px; height: 340px;
}

.auth-overlay::after {
  width: 560px; height: 560px;
  border-color: var(--pitch-faint);
  animation-delay: 0.6s;
}

@keyframes authRingBreath {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%, -50%) scale(1.04); }
}

/* Diagonal atmosphere slash */
.auth-atmo {
  position: absolute;
  top: -20%; right: -8%;
  width: 55%; height: 140%;
  background: linear-gradient(165deg, transparent 38%, var(--atmo) 50%, transparent 62%);
  pointer-events: none;
}

/* ── Loading state ── */
.auth-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 0;
  animation: authContentReveal 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes authContentReveal {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-logo {
  width: 76px; height: 76px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--blue), var(--blue-bright));
  display: grid; place-items: center;
  margin-bottom: 22px;
  box-shadow: 0 0 0 8px var(--blue-10), 0 0 48px var(--blue-20);
  animation: authLogoPulse 2.6s ease-in-out infinite;
}

.auth-logo img {
  width: 40px; height: 40px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

@keyframes authLogoPulse {
  0%, 100% { box-shadow: 0 0 0 8px var(--blue-10), 0 0 48px var(--blue-20); }
  50%       { box-shadow: 0 0 0 14px var(--blue-10), 0 0 72px var(--blue-15); }
}

.auth-app-name {
  font-size: 30px; font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--chalk);
  margin-bottom: 4px;
  line-height: 1;
}

.auth-tagline {
  font-size: 11.5px; font-weight: 500;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 40px;
}

/* Three pulsing dots */
.auth-dots {
  display: flex; gap: 8px;
  margin-bottom: 14px;
}

.auth-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  animation: authDotPop 1.2s ease-in-out infinite;
}

.auth-dots span:nth-child(2) { animation-delay: 0.15s; }
.auth-dots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes authDotPop {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.45; }
  40%            { transform: scale(1.25); opacity: 1; }
}

.auth-status {
  font-size: 13px; font-weight: 500;
  color: var(--ghost);
  letter-spacing: 0.2px;
}

/* ── Error state ── */
.auth-error {
  position: relative; z-index: 1;
  display: none;
  flex-direction: column; align-items: center;
  gap: 10px;
  padding: 0 40px;
  text-align: center;
  animation: authContentReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-error-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px solid var(--loss);
  display: grid; place-items: center;
  color: var(--loss);
  margin-bottom: 6px;
}

.auth-error-icon svg { width: 30px; height: 30px; }

.auth-error-msg {
  font-size: 18px; font-weight: 800;
  color: var(--chalk);
  letter-spacing: -0.2px;
}

.auth-error-hint {
  font-size: 13px; font-weight: 400;
  color: var(--ghost);
  line-height: 1.55;
  max-width: 260px;
}

.auth-retry-btn {
  margin-top: 10px;
  padding: 13px 36px;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-family: 'Barlow', sans-serif;
  font-size: 15px; font-weight: 700;
  border: none; cursor: pointer;
  letter-spacing: 0.2px;
  transition: opacity 0.2s, transform 0.15s;
}

.auth-retry-btn:active {
  opacity: 0.82;
  transform: scale(0.96);
}

.auth-retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Web login state (outside Telegram) ── */
.auth-login {
  position: relative; z-index: 1;
  display: none;
  flex-direction: column; align-items: center;
  gap: 0;
  padding: 0 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: authContentReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-login .auth-logo { margin-bottom: 22px; }
.auth-login .auth-tagline { margin-bottom: 32px; }

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

.auth-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--pitch-line);
  background: rgba(255,255,255,0.04);
  color: var(--chalk);
  font-family: 'Barlow', sans-serif;
  font-size: 15px; font-weight: 400;
  outline: none;
  transition: border-color 0.2s;
}

.auth-input:focus {
  border-color: var(--blue);
}

.auth-input::placeholder {
  color: var(--ghost);
  opacity: 0.55;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap .auth-input {
  padding-right: 48px;
}

.auth-pw-toggle {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--ghost);
  padding: 4px;
  display: grid; place-items: center;
  transition: color 0.2s;
}

.auth-pw-toggle:hover { color: var(--chalk); }

.auth-login-error {
  font-size: 13px; font-weight: 500;
  color: var(--loss);
  min-height: 18px;
  line-height: 1.4;
}

.auth-login-btn {
  width: 100%;
  margin-top: 4px;
}

/* ── OAuth divider ── */
.auth-divider {
  display: flex; align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--ghost);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

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

/* ── OAuth section label ── */
.auth-oauth-label {
  font-size: 12px; font-weight: 500;
  color: var(--ghost);
  text-align: center;
  line-height: 1.5;
  padding: 0 4px;
}

.auth-oauth-label-btn {
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.auth-oauth-label-btn:hover {
  color: var(--chalk);
}

/* ── Back button ── */
.auth-back-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--ghost);
  font-family: 'Barlow', sans-serif;
  font-size: 14px; font-weight: 600;
  padding: 0;
  align-self: flex-start;
  transition: color 0.2s;
}

.auth-back-btn:hover { color: var(--chalk); }

/* ── OAuth buttons ── */
.auth-oauth-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 14px;
  font-family: 'Barlow', sans-serif;
  font-size: 15px; font-weight: 600;
  border: 1px solid var(--pitch-line);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s, transform 0.15s;
}

.auth-oauth-btn:active {
  opacity: 0.82;
  transform: scale(0.97);
}

.auth-oauth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Google renders its own button into this container */
.auth-google-container {
  width: 100%;
  min-height: 44px;
  display: flex;
  justify-content: center;
}

/* Force Google's iframe button to fill the container width */
.auth-google-container > div,
.auth-google-container iframe {
  width: 100% !important;
  border-radius: 14px !important;
}

.auth-apple-btn {
  background: transparent;
  color: var(--chalk);
  border-color: var(--pitch-line);
}

.auth-apple-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
}

.auth-telegram-btn {
  background: #2AABEE;
  color: #fff;
  border-color: #2AABEE;
}

.auth-telegram-btn:hover:not(:disabled) {
  background: #229ED9;
  border-color: #229ED9;
}

/* ── Dev login state (localhost only) ── */
.auth-dev {
  position: relative; z-index: 1;
  display: none;
  flex-direction: column; align-items: center;
  gap: 10px;
  padding: 0 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: authContentReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-dev-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--blue-bright);
  background: var(--blue-10);
  border: 1px solid var(--blue-20);
  border-radius: 6px;
  padding: 3px 10px;
  margin-bottom: 4px;
}

.auth-dev-hint {
  font-size: 13px; font-weight: 400;
  color: var(--ghost);
  line-height: 1.55;
  margin: 0;
}

.auth-dev-how {
  font-size: 11.5px;
  color: var(--pitch-line);
  line-height: 1.55;
  max-width: 280px;
  margin: 0;
}

.auth-dev-hint code, .auth-dev-how code {
  font-size: 11px;
  background: var(--blue-10);
  color: var(--blue-bright);
  padding: 1px 5px;
  border-radius: 4px;
}

.auth-dev-input {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--pitch-line);
  background: rgba(255,255,255,0.04);
  color: var(--chalk);
  font-family: 'Space Mono', monospace;
  font-size: 10.5px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.auth-dev-input:focus {
  border-color: var(--blue);
}

.auth-dev-input::placeholder {
  color: var(--ghost);
  opacity: 0.45;
}
