/* ---- Accounts, high scores, and leaderboards ---- */

/* Account bar at the top of the card */
.account-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  min-height: 2rem;
}
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--panelBgAlt);
  border: 1px solid var(--border);
  color: var(--textMain);
  border-radius: 0.75rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.account-btn:hover { border-color: var(--accent); }
.account-btn:active { transform: scale(0.96); }
.account-btn .avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1205;
  font-size: 0.65rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--textMuted);
  border-radius: 0.75rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.ghost-btn:hover { color: var(--textMain); border-color: var(--accent); }
.ghost-btn:active { transform: scale(0.96); }

/* My High Scores panel (inside the card, shown when signed in) */
.my-scores {
  display: none;
  margin: 0 0 1.25rem;
}
.my-scores.active { display: block; }
.my-scores .kicker { margin-bottom: 0.5rem; }
.score-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.score-tile {
  background: var(--panelBgAlt);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
}
.score-tile .game { font-size: 1.1rem; line-height: 1; }
.score-tile .game-name {
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--textMuted);
  margin: 0.35rem 0 0.15rem;
}
.score-tile .best {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Modal shell (auth + leaderboards) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 6, 15, 0.72);
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: var(--panelBg);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  animation: modalpop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes modalpop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-head h2 {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.modal-close {
  background: var(--panelBgAlt);
  border: 1px solid var(--border);
  color: var(--textMuted);
  border-radius: 0.6rem;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--textMain); }

/* Tabs (Login / Register, and game tabs) */
.tab-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.tab-row button {
  flex: 1;
  background: var(--panelBgAlt);
  border: 1px solid var(--border);
  color: var(--textMuted);
  border-radius: 0.7rem;
  padding: 0.5rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-row button.on {
  color: #1a1205;
  background: var(--accent);
  border-color: var(--accent);
}

/* Forms */
.form-field { margin-bottom: 0.85rem; }
.form-field label {
  display: block;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--textMuted);
  margin-bottom: 0.35rem;
}
.form-field input {
  width: 100%;
  background: #1e293b;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.7rem 0.8rem;
  color: var(--textMain);
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  transition: all 0.2s;
}
.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accentGlow);
}

.password-warning {
  display: flex;
  gap: 0.5rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: 0.85rem;
  padding: 0.7rem 0.8rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #fecdd3;
  margin-bottom: 0.9rem;
}
.password-warning strong { color: #fff; font-weight: 900; }

.primary-btn {
  width: 100%;
  background: var(--accent);
  color: #1a1205;
  border: none;
  border-radius: 0.85rem;
  padding: 0.8rem;
  font-size: 0.85rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.5; cursor: default; }

.form-error {
  display: none;
  color: #fda4af;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.7rem;
  text-align: center;
}
.form-error.active { display: block; }

/* Signed-in menu inside the auth modal */
.account-menu .whoami {
  text-align: center;
  margin-bottom: 1rem;
}
.account-menu .whoami .big-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1205;
  font-size: 1.4rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.6rem;
}
.account-menu .whoami .dn { font-size: 1.1rem; font-weight: 900; }
.account-menu .whoami .un { font-size: 0.78rem; color: var(--textMuted); }

/* Leaderboard */
.lb-list { display: flex; flex-direction: column; gap: 0.3rem; }
.lb-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  background: var(--panelBgAlt);
  border: 1px solid transparent;
  border-radius: 0.7rem;
  padding: 0.55rem 0.7rem;
}
.lb-row.me { border-color: var(--accent); background: rgba(245, 158, 11, 0.1); }
.lb-row .rank {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--textMuted);
  font-variant-numeric: tabular-nums;
}
.lb-row.top1 .rank { color: #fbbf24; }
.lb-row .who { min-width: 0; }
.lb-row .who .dn {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--textMain);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-row .who .un { font-size: 0.68rem; color: var(--textMuted); }
.lb-row .score {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.lb-empty, .lb-loading {
  text-align: center;
  color: var(--textMuted);
  font-size: 0.8rem;
  padding: 1.5rem 0;
}
.lb-myrank {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.lb-myrank .kicker { margin-bottom: 0.4rem; }
