/* ═══════════════════════════════════════════
   SpaceGuessr — Auth Page Styles
   ═══════════════════════════════════════════ */

/* ── Layout ── */
.auth-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
  gap: 28px;
}

/* ── Hero ── */
.auth-hero {
  text-align: center;
}

.auth-hero .logo {
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 900;
  background: linear-gradient(135deg, #c4baff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.02em;
}

.auth-hero .tagline {
  margin-top: 6px;
  color: var(--muted);
  font-size: .95rem;
}

/* ── Card ── */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 28px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

/* ── Tabs ── */
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
  gap: 2px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: background .2s, color .2s;
}

.auth-tab.active {
  background: var(--surface2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.auth-tab:hover:not(.active) {
  color: var(--text);
}

/* ── Message banner ── */
.auth-message {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 18px;
  line-height: 1.4;
}

.auth-message.error {
  background: rgba(231,76,60,.18);
  border: 1px solid rgba(231,76,60,.4);
  color: #ff8a7a;
}

.auth-message.success {
  background: rgba(46,204,113,.15);
  border: 1px solid rgba(46,204,113,.35);
  color: #6effa8;
}

/* ── Forms ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form.hidden {
  display: none;
}

/* ── Field ── */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.auth-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: .95rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}

.auth-field input::placeholder {
  color: var(--muted);
  opacity: .7;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,111,255,.2);
}

.auth-field input:invalid:not(:placeholder-shown) {
  border-color: var(--wrong);
}

.auth-field-hint {
  font-size: .75rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Password toggle ── */
.auth-password-wrap {
  position: relative;
  display: flex;
}

.auth-password-wrap input {
  padding-right: 44px;
}

.auth-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: .5;
  transition: opacity .15s;
  padding: 4px;
  line-height: 1;
}

.auth-pw-toggle:hover { opacity: 1; }

/* ── Submit button ── */
.auth-submit {
  width: 100%;
  margin-top: 4px;
}

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted);
  font-size: .8rem;
}

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

/* ── Guest button ── */
.auth-guest-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: left;
}

.auth-guest-btn:hover {
  border-color: var(--muted);
  background: rgba(255,255,255,.04);
}

.auth-guest-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.auth-guest-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-guest-label {
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
}

.auth-guest-note {
  color: var(--muted);
  font-size: .75rem;
}

/* ── Auth loading overlay (shown on index/game while checking auth state) ── */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: .9rem;
}

.auth-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ── User bar (top of home page) ── */
.user-bar {
  width: 100%;
  max-width: 700px;
  display: flex;
  justify-content: flex-end;
  padding: 0 4px;
}

.user-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 8px 5px 12px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-avatar.guest-avatar {
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 1rem;
}

.user-bar-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-bar-btn {
  padding: 6px 14px;
  font-size: .78rem;
  min-height: unset;
  border-radius: var(--radius-pill);
}

/* Guest banner inside modes section */
.guest-banner {
  background: rgba(124,111,255,.12);
  border: 1px solid rgba(124,111,255,.3);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: .85rem;
  color: var(--galaxy-fg);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.guest-banner a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  margin-left: auto;
  white-space: nowrap;
}

.guest-banner a:hover { text-decoration: underline; }

/* ── Mode-locked category cards (e.g. Beginner mode active) ── */
.category-card.mode-locked {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Guest-locked mode cards ── */
.mode-card.guest-locked {
  opacity: .55;
  cursor: not-allowed;
  position: relative;
}

.mode-card.guest-locked::after {
  content: '🔒 Login required';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,6,15,.55);
  border-radius: inherit;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ── Game page user badge (top-bar) ── */
.game-user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  flex-shrink: 0;
}

.game-user-badge .user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  cursor: default;
}

.game-user-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide name on narrow screens, keep avatar */
@media (max-width: 600px) {
  .game-user-name { display: none; }
}

/* ── Responsive ── */
@media (max-width: 460px) {
  .auth-card {
    padding: 22px 18px 20px;
  }
}
