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

html.auth-modal-open,
html.auth-modal-open body {
  overflow: hidden;
}

.auth-modal-root {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--ink, #0a1f2a);
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 31, 42, 0.62);
}

.auth-modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--surface, #f8fbfd);
  box-shadow: 10px 10px 0 var(--line, #0a1f2a);
  padding: clamp(22px, 4vw, 34px);
  animation: auth-pop 180ms ease-out;
}

@keyframes auth-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  color: var(--ink, #0a1f2a);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
  transition: color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.auth-modal-close:hover {
  color: var(--accent, #ef5f4b);
  opacity: 1;
  transform: scale(1.12);
}

.auth-modal-close:active {
  transform: scale(0.92);
}

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

.auth-kicker {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 9px;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--accent-2, #2aabee);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-title {
  margin: 0 42px 12px 0;
  font-family: 'Oswald', sans-serif;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.auth-copy {
  max-width: 560px;
  margin: 0 0 20px;
  color: var(--muted-text, #5b6e78);
  font-size: 15px;
  line-height: 1.48;
}

.auth-provider-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.auth-telegram-widget {
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 18px;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--paper, #eef4f7);
  box-shadow: 4px 4px 0 var(--line, #0a1f2a);
  padding: 10px;
}

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

.auth-loading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-auth-modal="login"].is-profile {
  background: var(--accent-3, #a0d8f1);
  color: var(--ink, #0a1f2a);
}

.auth-provider,
.auth-primary,
.auth-secondary,
.auth-switch {
  min-height: 44px;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--surface, #f8fbfd);
  color: var(--ink, #0a1f2a);
  box-shadow: 4px 4px 0 var(--line, #0a1f2a);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, color 140ms ease;
}

.auth-provider:hover,
.auth-primary:hover,
.auth-secondary:hover,
.auth-switch:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--line, #0a1f2a);
  background: var(--accent-2, #2aabee);
}

.auth-provider:active,
.auth-primary:active,
.auth-secondary:active,
.auth-switch:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--line, #0a1f2a);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted-text, #5b6e78);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-email-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: -4px 0 12px;
}

.auth-email-tabs button {
  min-height: 38px;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--surface, #f8fbfd);
  color: var(--ink, #0a1f2a);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-email-tabs button.active {
  background: var(--accent-2, #2aabee);
}

.auth-label {
  display: grid;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-input {
  width: 100%;
  min-height: 46px;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--paper, #eef4f7);
  color: var(--ink, #0a1f2a);
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.auth-input:focus {
  background: var(--accent-2, #2aabee);
}

.auth-primary {
  background: var(--accent, #ef5f4b);
}

.auth-secondary {
  background: var(--accent-2, #2aabee);
}

.auth-modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.auth-note {
  margin-top: 12px;
  min-height: 18px;
  color: var(--muted-text, #5b6e78);
  font-size: 12px;
  font-weight: 800;
}

.auth-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--paper, #eef4f7);
  box-shadow: 5px 5px 0 var(--line, #0a1f2a);
  padding: 14px;
}

.auth-profile-avatar,
.auth-profile-initials {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 2px solid var(--line, #0a1f2a);
  background: var(--accent-2, #2aabee);
  object-fit: cover;
}

.auth-profile-initials {
  display: grid;
  place-items: center;
  font-family: 'Oswald', sans-serif;
  font-size: 24px;
  font-weight: 900;
}

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

.auth-profile-details {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.auth-profile-details strong {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(26px, 5vw, 42px);
  line-height: 0.95;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.auth-profile-details span {
  color: var(--muted-text, #5b6e78);
  font-weight: 900;
}

.premium-price {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 16px 0 18px;
}

.premium-price strong {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(56px, 9vw, 92px);
  line-height: 0.9;
}

.premium-price span {
  margin-bottom: 10px;
  color: var(--muted-text, #5b6e78);
  font-weight: 900;
}

.premium-perks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.premium-perk {
  border: 2px solid var(--line, #0a1f2a);
  background: var(--paper, #eef4f7);
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
}

.premium-perk b {
  display: block;
  margin-bottom: 4px;
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  text-transform: uppercase;
}

html.theme-dark .auth-modal-root,
body.theme-ink .auth-modal-root {
  color: #e6f1f6;
}

html.theme-dark .auth-modal-card,
body.theme-ink .auth-modal-card {
  background: #17222e;
  color: #e6f1f6;
  border-color: #02101a;
  box-shadow: 10px 10px 0 #02101a;
}

html.theme-dark .auth-copy,
html.theme-dark .auth-note,
html.theme-dark .auth-profile-details span,
html.theme-dark .premium-price span,
body.theme-ink .auth-copy,
body.theme-ink .auth-note,
body.theme-ink .auth-profile-details span,
body.theme-ink .premium-price span {
  color: #95a8b3;
}

html.theme-dark .auth-modal-close,
body.theme-ink .auth-modal-close {
  color: #e6f1f6;
}

html.theme-dark .auth-provider,
html.theme-dark .auth-secondary,
html.theme-dark .auth-switch,
html.theme-dark .auth-input,
html.theme-dark .auth-telegram-widget,
html.theme-dark .auth-profile-card,
html.theme-dark .premium-perk,
body.theme-ink .auth-provider,
body.theme-ink .auth-secondary,
body.theme-ink .auth-switch,
body.theme-ink .auth-input,
body.theme-ink .auth-email-tabs button,
body.theme-ink .auth-telegram-widget,
body.theme-ink .auth-profile-card,
body.theme-ink .premium-perk {
  background: #1f2d3a;
  color: #e6f1f6;
  border-color: #02101a;
  box-shadow: 4px 4px 0 #02101a;
}

html.theme-dark .auth-primary,
html.theme-dark .auth-kicker,
html.theme-dark [data-auth-modal="login"].is-profile,
body.theme-ink .auth-primary,
body.theme-ink .auth-kicker,
body.theme-ink .auth-email-tabs button.active,
body.theme-ink [data-auth-modal="login"].is-profile {
  background: #2aabee;
  color: #fffaf4;
  border-color: #02101a;
}

html.theme-dark .auth-profile-avatar,
html.theme-dark .auth-profile-initials,
body.theme-ink .auth-profile-avatar,
body.theme-ink .auth-profile-initials {
  border-color: #02101a;
}

@media (max-width: 680px) {
  .auth-modal-root {
    padding: 12px;
  }

  .auth-provider-grid,
  .premium-perks {
    grid-template-columns: 1fr;
  }
}
