/* ── Auth overlay ─────────────────────────────────────────────────────────────
   Full-screen login / register / reset overlay.
   Sits above everything (z-index 9999) and is removed after auth.
   Matches the site's dark retro-terminal aesthetic.
───────────────────────────────────────────────────────────────────────────── */

#auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  font-family: 'Courier New', Courier, monospace;
  /* Subtle starfield-ish noise background */
  background-image:
    radial-gradient(ellipse at 20% 50%, #00ffcc06 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, #00ffcc04 0%, transparent 55%);
  overflow-y: auto;
  padding: 1rem;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */

.auth-card {
  position: relative;
  background: #060d0a;
  border: 1px solid rgba(0, 255, 204, 0.18);
  box-shadow:
    0 0 28px rgba(0, 255, 204, 0.10),
    0 0 70px rgba(0, 255, 204, 0.05),
    inset 0 0 28px rgba(0, 255, 204, 0.04);
  border-radius: 3px;
  width: 100%;
  max-width: 400px;
  padding: 2.4rem 2.4rem 2rem;
  overflow: hidden;
  /* Subtle animate-in */
  animation: auth-card-appear 0.35s ease-out both;
}

@keyframes auth-card-appear {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* CRT scanlines overlay — decorative only */
.auth-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent            0px,
    transparent            3px,
    rgba(0, 0, 0, 0.16)   3px,
    rgba(0, 0, 0, 0.16)   4px
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Branding ───────────────────────────────────────────────────────────────── */

.auth-logo {
  position: relative;
  z-index: 1;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: rgba(0, 255, 204, 0.45);
  margin-bottom: 0.9rem;
  text-transform: uppercase;
}

.auth-title {
  position: relative;
  z-index: 1;
  font-size: 1.55rem;
  font-weight: bold;
  color: #00ffcc;
  text-shadow: 0 0 14px rgba(0, 255, 204, 0.60);
  letter-spacing: 0.10em;
  margin-bottom: 1.6rem;
}

.auth-subtitle {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.50);
  line-height: 1.55;
  margin-bottom: 1.2rem;
}

.auth-dim { opacity: 0.55; }

/* ── Banner (success / info messages) ───────────────────────────────────────── */

.auth-banner {
  position: relative;
  z-index: 1;
  font-size: 0.73rem;
  padding: 0.50rem 0.75rem;
  border-radius: 2px;
  margin-bottom: 1.1rem;
  line-height: 1.4;
}

.auth-banner-success {
  border: 1px solid rgba(0, 255, 204, 0.30);
  background: rgba(0, 255, 204, 0.06);
  color: #00ffcc;
}

/* ── Form fields ────────────────────────────────────────────────────────────── */

.auth-field {
  position: relative;
  z-index: 1;
  margin-bottom: 1.05rem;
}

.auth-label {
  display: block;
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 0.32rem;
  text-transform: uppercase;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 20, 12, 0.90);
  border: 1px solid rgba(0, 255, 204, 0.28);
  border-radius: 2px;
  color: #00ffcc;
  font-family: inherit;
  font-size: 0.87rem;
  padding: 0.55rem 0.80rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  /* Prevent autofill from changing the background */
  -webkit-text-fill-color: #00ffcc;
}

.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #060d0a inset !important;
  -webkit-text-fill-color: #00ffcc !important;
}

.auth-input::placeholder { color: rgba(0, 255, 204, 0.28); }

.auth-input:focus {
  border-color: #00ffcc;
  box-shadow: 0 0 0 2px rgba(0, 255, 204, 0.18), 0 0 10px rgba(0, 255, 204, 0.15);
}

.auth-input[readonly] {
  opacity: 0.60;
  cursor: default;
  border-style: dashed;
}

/* Password reveal toggle */
.auth-pw-wrap { position: relative; }
.auth-pw-wrap .auth-input { padding-right: 2.6rem; }

.auth-pw-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.30);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.15s;
}
.auth-pw-toggle:hover { color: #00ffcc; }

/* ── Password strength meter ─────────────────────────────────────────────────── */

.auth-strength-bar-wrap {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-top: 0.42rem;
  overflow: hidden;
}

.auth-strength-bar {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.30s ease, background-color 0.30s ease;
}

.auth-strength-bar.pw-very-weak  { background: #ff2244; }
.auth-strength-bar.pw-weak       { background: #ff7722; }
.auth-strength-bar.pw-fair       { background: #ffcc00; }
.auth-strength-bar.pw-strong     { background: #88ff44; }
.auth-strength-bar.pw-very-strong{ background: #00ffcc; }

.auth-strength-label {
  font-size: 0.62rem;
  letter-spacing: 0.10em;
  margin-top: 0.24rem;
  min-height: 0.9em;
}
.auth-strength-label.pw-very-weak  { color: #ff2244; }
.auth-strength-label.pw-weak       { color: #ff7722; }
.auth-strength-label.pw-fair       { color: #ffcc00; }
.auth-strength-label.pw-strong     { color: #88ff44; }
.auth-strength-label.pw-very-strong{ color: #00ffcc; }

/* Password requirements list */
.auth-pw-reqs {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  margin-top: 0.38rem;
  font-size: 0.63rem;
  line-height: 1.65;
}
.auth-req-fail { color: #ff4466; }
.auth-req-ok   { color: #00ffcc; }

/* ── Inline hints (username / confirm-match) ─────────────────────────────────── */

.auth-hint {
  font-size: 0.66rem;
  margin-top: 0.22rem;
  min-height: 0.9em;
  transition: color 0.15s;
}
.auth-hint-error { color: #ff4466; }
.auth-hint-ok    { color: #00ffcc; }

/* ── Error message ─────────────────────────────────────────────────────────── */

.auth-error {
  position: relative;
  z-index: 1;
  font-size: 0.74rem;
  color: #ff4466;
  min-height: 1.1em;
  margin-bottom: 0.65rem;
  line-height: 1.35;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.auth-btn {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0.70rem 1rem;
  background: transparent;
  border: 1px solid rgba(0, 255, 204, 0.40);
  border-radius: 2px;
  color: #00ffcc;
  font-family: inherit;
  font-size: 0.80rem;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s, border-color 0.18s, opacity 0.18s;
  margin-top: 0.20rem;
}

.auth-btn:hover:not(:disabled) {
  background: rgba(0, 255, 204, 0.10);
  border-color: #00ffcc;
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.28);
}

.auth-btn.primary {
  background: rgba(0, 255, 204, 0.09);
  border-color: rgba(0, 255, 204, 0.75);
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.18);
}

.auth-btn.primary:hover:not(:disabled) {
  background: rgba(0, 255, 204, 0.18);
  box-shadow: 0 0 18px rgba(0, 255, 204, 0.40);
}

.auth-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ── Footer links ───────────────────────────────────────────────────────────── */

.auth-links {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin-top: 1.05rem;
}

.auth-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.38);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0.18rem 0;
  transition: color 0.15s;
}
.auth-link:hover { color: #00ffcc; text-decoration: underline; }

/* ── Email-sent screen ─────────────────────────────────────────────────────── */

.auth-email-display {
  position: relative;
  z-index: 1;
  font-size: 0.85rem;
  color: #00ffcc;
  background: rgba(0, 255, 204, 0.07);
  border: 1px solid rgba(0, 255, 204, 0.22);
  border-radius: 2px;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.7rem;
  word-break: break-all;
}

.auth-email-sent-icon {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 2.8rem;
  margin: 0.6rem 0 0.8rem;
  opacity: 0.65;
  filter: drop-shadow(0 0 8px rgba(0, 255, 204, 0.40));
}

/* ── Header user display (in the 3D world header) ──────────────────────────── */

.header-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: 'Courier New', monospace;
  pointer-events: auto;   /* re-enable clicks inside the otherwise inert header */
}

#header-username {
  font-size: 0.68rem;
  letter-spacing: 0.10em;
  color: rgba(0, 255, 204, 0.65);
  text-transform: uppercase;
}

#header-signout {
  font-family: inherit;
  font-size: 0.60rem;
  letter-spacing: 0.10em;
  color: rgba(255, 255, 255, 0.28);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  padding: 0.22rem 0.50rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
#header-signout:hover { color: #ff4466; border-color: rgba(255, 68, 102, 0.50); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .auth-card   { padding: 1.6rem 1.4rem; }
  .auth-title  { font-size: 1.25rem; }
  .auth-input  { font-size: 0.82rem; }
}
