.premium-auth {
  --pa-text: #0d1524;
  --pa-muted: #6b7280;
  --pa-border: #d9dee7;
  --pa-surface: #ffffff;
  --pa-accent: #00c2ff;
  --pa-accent-gradient: linear-gradient(90deg, #00ffa3 0%, #00c2ff 100%);
  --pa-error-bg: #fdecec;
  --pa-error-text: #b42318;
  --pa-success-text: #067647;

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: "Montserrat", sans-serif;
  color: var(--pa-text);
}

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

body.premium-auth-open {
  overflow: hidden;
}

.premium-auth__open {
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.premium-auth__overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 21, 36, 0.6);
}

.premium-auth__dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 32px 28px 28px;
  border-radius: 20px;
  background: var(--pa-surface);
  box-shadow: 0 24px 60px rgba(13, 21, 36, 0.25);
}

.premium-auth__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pa-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.premium-auth__close:hover,
.premium-auth__close:focus-visible {
  background: #f1f4f8;
  color: var(--pa-text);
}

.premium-auth__title {
  margin: 0 32px 20px 0;
  color: var(--pa-text);
  -webkit-text-fill-color: currentColor;
  text-align: left;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

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

.premium-auth__field {
  display: block;
  margin-bottom: 14px;
}

.premium-auth__field span {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.premium-auth__field input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--pa-border);
  border-radius: 10px;
  background: var(--pa-surface);
  color: var(--pa-text);
  font: inherit;
  font-size: 16px;
}

.premium-auth__field input:focus {
  outline: none;
  border-color: var(--pa-accent);
  box-shadow: 0 0 0 3px rgba(0, 194, 255, 0.2);
}

.premium-auth__error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--pa-error-bg);
  color: var(--pa-error-text);
  font-size: 14px;
  line-height: 1.4;
}

.premium-auth__submit {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--pa-accent-gradient);
  color: var(--pa-text);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms ease;
}

.premium-auth__submit:hover {
  opacity: 0.9;
}

.premium-auth__submit:active {
  transform: scale(0.99);
}

.premium-auth__submit:focus-visible,
.premium-auth__secondary:focus-visible,
.premium-auth__switch button:focus-visible,
.premium-auth__apple:focus-visible {
  outline: 2px solid var(--pa-accent);
  outline-offset: 2px;
}

/* !important: стили чата задают button:disabled { cursor: auto !important }. */
.premium-auth__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
}

.premium-auth__submit:disabled:hover {
  opacity: 0.6;
}

.premium-auth.is-pending .premium-auth__submit:disabled {
  cursor: progress !important;
}

.premium-auth__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 14px;
}

.premium-auth__links a {
  color: var(--pa-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.premium-auth__links a:hover {
  color: var(--pa-accent);
}

.premium-auth__rules {
  margin: -6px 0 14px;
  padding: 0;
  list-style: none;
  color: var(--pa-muted);
  font-size: 12px;
  line-height: 1.5;
}

.premium-auth__rules li.is-met {
  color: var(--pa-success-text);
}

.premium-auth__rules.is-invalid li:not(.is-met) {
  color: var(--pa-error-text);
}

.premium-auth__terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

/* Общие стили сайта сбрасывают appearance у input и делают ссылки блочными. */
.premium-auth__terms input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  -webkit-appearance: auto;
  appearance: auto;
  accent-color: var(--pa-accent);
  cursor: pointer;
}

.premium-auth__terms a {
  display: inline;
  color: var(--pa-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.premium-auth__terms a:hover {
  color: var(--pa-accent);
}

.premium-auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--pa-muted);
  font-size: 14px;
  font-weight: 600;
}

.premium-auth__divider::before,
.premium-auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--pa-border);
}

.premium-auth__social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 150ms ease;
}

/* Кнопка Google — iframe, поэтому блокируем клики на уровне контейнера. */
.premium-auth__social.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.premium-auth__social.is-disabled > * {
  pointer-events: none;
}

.premium-auth__google {
  min-width: 40px;
  min-height: 40px;
}

.premium-auth__apple {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.premium-auth__apple img {
  display: block;
}

.premium-auth__apple:hover {
  opacity: 0.8;
}

.premium-auth__switch {
  margin: 18px 0 0;
  color: var(--pa-muted);
  text-align: center;
  font-size: 14px;
}

.premium-auth__switch button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--pa-text);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.premium-auth__switch button:hover {
  color: var(--pa-accent);
}

.premium-auth__text {
  margin: 0 0 22px;
  color: var(--pa-text);
  font-size: 16px;
  line-height: 1.5;
}

.premium-auth__secondary {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border: 1px solid var(--pa-border);
  border-radius: 12px;
  background: var(--pa-surface);
  color: var(--pa-text);
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}

.premium-auth__secondary:hover {
  background: #f1f4f8;
}

.premium-auth__success p {
  margin: 0 0 12px;
  color: var(--pa-text);
  line-height: 1.5;
}

.premium-auth__hint {
  color: var(--pa-muted);
  font-size: 14px;
}

.premium-auth__success .premium-auth__submit {
  margin-top: 8px;
}

@media (max-width: 480px) {
  .premium-auth {
    align-items: flex-end;
    padding: 0;
  }

  .premium-auth__dialog {
    max-width: none;
    max-height: 100vh;
    padding: 28px 20px 24px;
    border-radius: 20px 20px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .premium-auth__social,
  .premium-auth__submit {
    transition: none;
  }
}
