/* Login / Sign-up split screen. Reuses the color variables and button
   classes defined in styles.css so this page matches the rest of the
   site instead of drifting into its own palette. */

.auth-body {
  background: var(--bg);
}

.auth-body::before {
  display: none;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ---------- Left: dark showcase ---------- */

.auth-showcase {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 48px;
  background: linear-gradient(160deg, #04070d 0%, #0a1120 55%, #050810 100%);
}

.showcase-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
}

.showcase-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 185, 66, 0.16), transparent 70%);
  filter: blur(10px);
}

.showcase-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  max-width: 420px;
  text-align: center;
}

/* Same rim/fill mask trick used for the board pieces — a solid-color
   SVG silhouette recolored via a CSS gradient on the background. */
.showcase-king {
  width: min(52%, 240px);
  aspect-ratio: 1;
  background: linear-gradient(180deg, #ffe9b8 0%, var(--accent) 45%, var(--accent-strong) 100%);
  -webkit-mask-image: url("../assets/pieces/original/K.svg");
  mask-image: url("../assets/pieces/original/K.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  filter: drop-shadow(0 30px 55px rgba(0, 0, 0, 0.6));
}

.showcase-tagline {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Right: form card ---------- */

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.2rem;
  font-family: "Manrope", Inter, "Segoe UI", Roboto, Arial, sans-serif;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.auth-brand .brand-gold {
  color: var(--text);
  text-transform: none;
  font-size: 0.7em;
  font-weight: 600;
}

.auth-brand .brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #111;
}

.auth-brand .brand-mark img {
  width: 27px;
  height: 27px;
  object-fit: contain;
  display: block;
}

.auth-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 26px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
}

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

.toggle-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.toggle-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #111;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

/* [hidden] on its own loses to ".field { display: flex }" because both
   have equal specificity and the class rule comes later in the sheet —
   this reasserts it so the JS-driven show/hide actually hides. */
.field[hidden] {
  display: none;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.field input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
}

.field.has-error input {
  border-color: #f87171;
}

.field-error {
  min-height: 15px;
  font-size: 0.76rem;
  color: #f87171;
}

.form-error {
  min-height: 18px;
  margin: 0 0 6px;
  font-size: 0.85rem;
  color: #f87171;
  text-align: center;
}

.auth-submit {
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  border: none;
  font-size: 0.98rem;
  cursor: pointer;
}

.auth-submit[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

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

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.oauth-btn:hover {
  background: color-mix(in srgb, var(--panel) 80%, white 8%);
}

/* Google and Apple buttons stack directly on top of each other in plain
   block flow (.auth-card has no flex/gap of its own) -- a gap between
   them only, not above the first one (which already gets its own space
   from .auth-divider just above it). */
.oauth-btn + .oauth-btn {
  margin-top: 10px;
}

.auth-switch {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-btn[disabled] {
  color: var(--muted);
  cursor: not-allowed;
  text-decoration: none;
}

.field-forgot {
  margin: -6px 0 14px;
  text-align: right;
}

.field-forgot .link-btn {
  font-size: 0.83rem;
}

/* ---------- Forgot-password panel ---------- */

.forgot-panel {
  display: flex;
  flex-direction: column;
}

.forgot-panel[hidden] {
  display: none;
}

.back-link {
  align-self: flex-start;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.forgot-title {
  margin: 0 0 18px;
  font-size: 1.25rem;
}

.forgot-step[hidden] {
  display: none;
}

.forgot-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.resend-row {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
  opacity: 0;
  z-index: 20;
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast[hidden] {
  display: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    min-height: 240px;
    padding: 32px;
  }

  .showcase-king {
    width: min(34%, 140px);
  }

  .showcase-tagline {
    font-size: 1.1rem;
  }

  .auth-form-side {
    padding: 32px 20px 48px;
  }
}
