/* ===== Auth modal ===== */

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(14px);
}

.auth-modal {
  position: relative;
  width: min(470px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(47, 129, 247, 0.2), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.18), transparent 28%),
    var(--surface);
  box-shadow: var(--shadow);
}

.auth-modal__body {
  padding: 28px;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.auth-close:hover {
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.14);
}

.auth-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 44px;
}

.auth-logo {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 18px;
  color: #fff;
  font-weight: 950;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  box-shadow: 0 16px 36px rgba(47, 129, 247, 0.22);
}

.auth-hero h2,
.account-card h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.auth-hero p,
.account-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 24px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.07);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.auth-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  box-shadow: 0 12px 26px rgba(47, 129, 247, 0.18);
}

.auth-mode {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.06);
  font-size: 13px;
}

.auth-mode b {
  color: var(--text);
}

.auth-message {
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: 14px;
  line-height: 1.4;
  font-size: 14px;
}

.auth-message--info {
  color: #bfdbfe;
  background: rgba(47, 129, 247, 0.12);
  border: 1px solid rgba(47, 129, 247, 0.24);
}

.auth-message--success {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.24);
}

.auth-message--error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.24);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  outline: none;
  border-radius: 16px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-2);
}

.auth-field input:focus {
  border-color: rgba(47, 129, 247, 0.65);
  box-shadow: 0 0 0 4px rgba(47, 129, 247, 0.14);
}

.auth-field--error input {
  border-color: rgba(239, 68, 68, 0.58);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.auth-field .auth-field__error {
  color: #fecaca;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

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

.auth-registration-result {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.auth-registration-result .auth-message,
.auth-registration-result .auth-submit,
.auth-registration-result .auth-links {
  margin-top: 0;
}

.auth-registration-email {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.06);
  overflow-wrap: anywhere;
}

.auth-registration-email span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-registration-email strong {
  color: var(--text);
  font-size: 14px;
}

:root[data-theme="light"] .auth-message--info {
  color: #1d4ed8;
}

:root[data-theme="light"] .auth-message--success {
  color: #15803d;
}

:root[data-theme="light"] .auth-message--error,
:root[data-theme="light"] .auth-field .auth-field__error {
  color: #b91c1c;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 13px;
}

.auth-links a {
  color: #bfdbfe;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-modal--account {
  width: min(410px, calc(100vw - 32px));
}

.account-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 34px 28px 28px;
  text-align: center;
}

.account-card__avatar {
  width: 76px;
  height: 76px;
  font-size: 28px;
  margin-bottom: 10px;
}

.account-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 18px;
}

.user-panel,
.user-mini {
  cursor: pointer;
}

@media (max-width: 560px) {
  .auth-backdrop {
    padding: 16px;
  }

  .auth-modal__body {
    padding: 24px 18px 20px;
  }

  .auth-hero {
    align-items: flex-start;
    padding-right: 42px;
  }

  .auth-hero h2,
  .account-card h2 {
    font-size: 23px;
  }
}

/* ===== Close button centering ===== */

.auth-close {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  font-size: 0;
}

.auth-close::before {
  content: "×";
  display: block;
  color: currentColor;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-1px);
}

/* ===== Frontend polish v1: auth details ===== */
.auth-modal {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.auth-modal::-webkit-scrollbar {
  width: 7px;
}

.auth-modal::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
}

.auth-links {
  justify-content: flex-start;
}

.auth-links--register {
  color: var(--muted);
  line-height: 1.45;
}

.auth-tab:focus-visible,
.auth-close:focus-visible,
.auth-field input:focus-visible,
.auth-links a:focus-visible {
  outline: 3px solid rgba(47, 129, 247, 0.35);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .auth-modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
  }

  .auth-backdrop {
    align-items: end;
    padding: 12px;
  }
}
