/* ── Shared styles for login and profile pages ─────────────────────────── */
:root {
  --bg-a: #0f1720;
  --bg-b: #223344;
  --panel: rgba(247, 249, 250, 0.95);
  --ink: #14212e;
  --muted: #44586a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #274357 0%, transparent 35%),
              radial-gradient(circle at 85% 15%, #4d2f3f 0%, transparent 30%),
              linear-gradient(160deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 16px 16px;
}

.auth-shell {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px;
}

.auth-hero {
  margin-bottom: 24px;
}

.auth-hero h1 {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: clamp(2rem, 5vw, 3rem);
  color: #f3f8ff;
  letter-spacing: 0.04em;
}

.auth-hero p {
  margin: 6px 0 0;
  color: #d2dde9;
  font-size: 0.95rem;
}

.auth-hero nav {
  margin-top: 10px;
}

.auth-hero nav a {
  color: #7fb8d8;
  font-size: 0.88rem;
  text-decoration: none;
}

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

.auth-card {
  background: var(--panel);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  margin-bottom: 20px;
}

.auth-card h2 {
  margin: 0 0 18px;
  font-family: "Space Mono", monospace;
  font-size: 1.15rem;
  color: var(--ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="password"] {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #8ba0b3;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: #1a5276;
  box-shadow: 0 0 0 2px #9ecae1;
}

.btn-primary {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(120deg, #2a95b6, #2f6ea4);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 120ms ease;
  margin-top: 4px;
}

.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(120deg, #6f8293, #516475);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease;
}

.btn-secondary:hover { transform: translateY(-1px); }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.error-msg {
  color: #b52b2b;
  font-size: 0.88rem;
  margin: 8px 0 0;
  min-height: 1.2em;
}

.success-msg {
  color: #1f6e2e;
  font-size: 0.88rem;
  margin: 8px 0 0;
  min-height: 1.2em;
}

.invite-only-wrap {
  margin: 14px 0 0;
  text-align: center;
}

.invite-only-link {
  color: #5f7486;
  font-size: 0.86rem;
  text-decoration: none;
}

.invite-only-link:hover {
  text-decoration: underline;
  color: #34495d;
}

/* ── Avatar section ─────────────────────────────────────────────────────── */
.avatar-section {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #c9d9e8;
  border: 3px solid #4a7fa5;
  flex-shrink: 0;
}

.avatar-section .upload-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.avatar-section .upload-area p {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
}

input[type="file"] { display: none; }

/* ── User chip (shown in game header) ───────────────────────────────────── */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  text-decoration: none;
  transition: background 150ms;
}

.user-chip:hover { background: rgba(255,255,255,0.19); }

.user-chip .chip-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #4a7fa5;
}

.user-chip .chip-name {
  color: #e8f1f8;
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-link {
  display: inline-block;
  margin-left: 8px;
  color: #8ba0b3;
  font-size: 0.8rem;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.logout-link:hover { color: #d2dde9; text-decoration: underline; }
