/* ========== Auth Modal — GameFuse Glass Style ========== */

:root {
  /* используем общие токены, но даём fallback */
  --auth-bg: rgba(15, 23, 42, 0.40);
  --auth-card: rgba(255, 255, 255, 0.85);

  --auth-line: rgba(255, 255, 255, 0.38);
  --auth-line-light: rgba(255, 255, 255, 0.72);

  --auth-text: var(--gf-text-main, #0f172a);
  --auth-muted: var(--gf-text-muted, #6b7280);

  --auth-brand: var(--gf-brand-blue, #2563eb);
  --auth-brand-2: var(--gf-brand-violet, #4f46e5);
  --auth-accent: rgba(129, 140, 248, 0.10);

  --auth-danger: #ef4444;

  --code-pad: 18px;
  --code-gap: 12px;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background:
    radial-gradient(circle at top, rgba(129, 140, 248, 0.22), transparent 65%),
    radial-gradient(circle at bottom, rgba(56, 189, 248, 0.16), transparent 70%),
    var(--auth-bg);
  backdrop-filter: blur(10px);
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1001;
}

.auth-overlay[hidden],
.auth-modal[hidden] {
  display: none !important;
}

.auth-card {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  padding: 18px 18px 16px;
  border-radius: var(--gf-radius-xl, 16px);
  background-color: var(--auth-card);
  backdrop-filter: blur(18px);
  border: var(--gf-border-glass, 1px solid rgba(255, 255, 255, 0.32));
  box-shadow: var(
    --gf-shadow-soft,
    0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -4px rgba(0, 0, 0, 0.06)
  );
  animation: authPop 0.18s ease-out;
  overflow: hidden;
}

.auth-card p {
  margin: 0;
}

.auth-card--compact {
  width: min(345px, calc(100vw - 24px));
  padding: 14px 14px 14px;
}

.auth-card--success {
  width: min(360px, calc(100vw - 24px));
  padding: 16px 14px 14px;
}

@keyframes authPop {
  from { transform: scale(0.98); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.auth-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.auth-tab {
  border: 0;
  border-radius: 9px;
  height: 32px;
  cursor: pointer;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--auth-muted);
  transition: all var(--gf-transition-fast, 0.18s ease);
}

.auth-tab.is-active {
  background: rgba(255, 255, 255, 0.98);
  color: var(--auth-text); 
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.12);
  border: 0;
}

.auth-social {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0;
}
.auth-social-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  font-weight: 600;
  font-size: 12px;
  color: var(--auth-text);
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(148, 163, 253, 0.18);
  transition: all var(--gf-transition-fast, 0.18s ease);
}

.auth-social-btn:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.24);
  transform: translateY(-1px);
}

.auth-social-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-social-ico img {
  width: 16px;
  height: 16px;
  display: block;
}

.auth-divider {
  display: grid;
  place-items: center;
  margin-top: 6px;  
  margin-bottom: 0;  
}

.auth-divider::before {
  content: none;
}

.auth-divider span {
  padding: 0;
  background: transparent;
  font-size: 11px;
  color: var(--auth-muted);
}
/* Форма */

.auth-form {
  display: grid;
  gap: 10px;
  margin: 0;
}

.auth-label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--auth-text);
}

.auth-label input {
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 253, 0.32); 
  padding: 0 11px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.94); 
  transition: all var(--gf-transition-fast, 0.18s ease);
}

.auth-label input:focus {
  outline: none;
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.16);
  background: #ffffff;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--auth-text);
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--auth-text);
}

/* Сам квадратик */
.auth-check input {
  appearance: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;

  border-radius: 6px;
  border: 1px solid rgba(148, 163, 253, 0.32); /* как у поля ввода */
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.02);

  position: relative;
  cursor: pointer;
  transition: all var(--gf-transition-fast, 0.18s ease);
}

/* Активное состояние */
.auth-check input:checked {
  background: linear-gradient(90deg, var(--gf-brand-blue), var(--gf-brand));
  border-color: rgba(79, 70, 229, 0.9);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

/* Галочка */
.auth-check input::before {
  content: "";
  position: absolute;

  width: 9px;
  height: 6px;

  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  border-radius: 1px;

  /* центрируем внутри 16×16 */
  left: 3px;
  top: 4px;

  transform: rotate(-45deg);
  transform-origin: center;
  opacity: 0;
}

/* Показываем галочку только когда чекбокс включён */
.auth-check input:checked::before {
  opacity: 1;
}

.auth-submit {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 13px;
}

.auth-hint {
  font-size: 11px;
  color: var(--auth-muted);
}

.auth-error {
  font-size: 12px;
  color: var(--auth-danger);
  text-align: center;
}

.auth-field-error {
  font-size: 12px;
  color: var(--auth-danger);
  text-align: center;
  margin-top: 2px;
}

.auth-code-pad {
  padding-inline: 2;
}

.auth-topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: var(--code-gap);
}

.auth-topbar-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--auth-text);
}

.auth-topbar-spacer {
  display: none;
}

.auth-back {
  justify-self: end;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--auth-line);
  background: rgba(255, 255, 255, 0.98);
  font-weight: 600;
  font-size: 12px;
  color: var(--auth-muted);
  cursor: pointer;
  transition: all var(--gf-transition-fast, 0.18s ease);
}

.auth-back:hover {
  background: var(--auth-accent);
  box-shadow: 0 6px 12px rgba(148, 163, 253, 0.2);
}

.auth-stack {
  width: 100%;
  margin-inline: auto;
}

.auth-stack > * + * {
  margin-top: var(--code-gap);
}
.auth-stack.auth-stack--totp .auth-submit {
  margin-top: 20px;
  transition: background var(--gf-transition-fast), box-shadow var(--gf-transition-fast), transform var(--gf-transition-fast);
}

.auth-stack.auth-stack--totp.auth-stack--has-error .auth-submit {
  margin-top: 6px;
  transition: background var(--gf-transition-fast), box-shadow var(--gf-transition-fast), transform var(--gf-transition-fast);
}
.auth-otp {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min-content;
  justify-content: center;
  gap: 6px;
}

.auth-otp input {
  width: 46px;
  height: 46px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--auth-line-light);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.98);
  transition: all var(--gf-transition-fast, 0.18s ease);
}

.auth-otp input:focus {
  outline: none;
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.18);
}

.auth-resend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--auth-muted);
}

.auth-resend-btn {
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  color: var(--gf-primary, #2563eb);
  font-weight: 500;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    color 0.15s ease;
}

.auth-resend-btn:hover {
  opacity: 0.9;
  transform: translateY(-0.5px);
}

.auth-resend-btn:disabled,
.auth-resend-btn[hidden] {
  cursor: default;
  opacity: 0.5;
}
.auth-resend-wwait,
.auth-resend-wait span {
  font-size: 12px;
}

.auth-success {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 8px 4px 8px;
}

.auth-success-ico {
  width: 72px;
  height: 72px;
  margin: 8px auto 6px;
  display: grid;
  place-items: center;
  background: transparent;
}

.auth-success-ico img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.4);
  transform-origin: center;
}

.auth-title {
  margin: 4px 0 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--auth-text);
}

.auth-text {
  font-size: 13px;
  color: var(--auth-muted);
}

input.is-invalid {
  border-color: var(--auth-danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08);
}

.auth-otp input.is-invalid {
  border-color: var(--auth-danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08);
}

.auth-card [hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-card--social .auth-tabs {
  display: none;
}

.auth-topbar--social-signup {
  justify-content: center;
  text-align: center;
  padding-inline: 32px;
  align-items: flex-start;
}

.auth-topbar--social-signup .auth-close--topbar {
  align-self: flex-start;
  margin-top: -4px;  /* если всё ещё чуть ниже, можно сделать -6 */
}

.auth-topbar--social-signup .auth-topbar-spacer {
  display: none;
}

.auth-topbar--social-signup .auth-topbar-title {
  font-size: 18px;
  font-weight: 700;
}

.auth-topbar--social-signup .auth-topbar-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--gf-text-muted);
}

@media (max-width: 479px) {
  :root {
    --code-pad: 10px;
    --code-gap: 10px;
  }

  .auth-code-pad {
    padding-inline: var(--code-pad);
  }

  .auth-card--compact {
    width: 310px;  
    padding: 10px 10px 12px;
  }

  .auth-otp {
    gap: 4px;
  }

  .auth-otp input {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding: 14px 12px 14px;
  }

  .auth-card--success {
    width: calc(100vw - 24px);
  }

  .auth-social {
    grid-template-columns: 1fr 1fr;
  }
}
