/* ─── Sign in button (header) ─────────────────────────────── */
.btn-signin {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-signin:hover { border-color: var(--muted); color: var(--text); }

/* ─── Leaderboard nav button ──────────────────────────────── */
.btn-leaderboard {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  background: transparent;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.btn-leaderboard:hover { color: var(--accent); border-color: var(--accent); }

/* ─── User chip ───────────────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #0c0c0c;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.user-name {
  font-size: 11px;
  color: var(--text);
  letter-spacing: 0.1em;
  cursor: pointer;
}
.user-name:hover { color: var(--accent); }

/* ─── Dev badge ───────────────────────────────────────────── */
.dev-badge {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  letter-spacing: 0.2em;
  font-weight: 500;
  color: #0c0c0c;
  background: var(--accent);
  padding: 2px 7px;
  border-radius: 2px;
  text-transform: lowercase;
  flex-shrink: 0;
}

/* Inline variant (used in leaderboard table) */
.dev-badge-inline {
  display: inline-flex;
  align-items: center;
  font-size: 7px;
  letter-spacing: 0.15em;
  font-weight: 500;
  color: #0c0c0c;
  background: var(--accent);
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.btn-profile {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}
.btn-profile:hover { color: var(--accent); border-color: var(--accent); }

/* ─── Auth Overlay ────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlay-in 0.3s var(--ease-out) both;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.auth-modal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 48px 52px;
  max-width: 420px;
  width: 90%;
  animation: modal-in 0.4s var(--ease-spring) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.auth-logo { font-size: 11px; letter-spacing: 0.22em; color: var(--accent); margin-bottom: 28px; }
.auth-title { font-size: 24px; font-weight: 300; color: var(--text); line-height: 1.4; margin-bottom: 10px; }
.auth-sub { font-size: 11px; color: var(--text-dim); letter-spacing: 0.08em; margin-bottom: 32px; }

.auth-field-wrap { width: 100%; position: relative; margin-bottom: 16px; }

.auth-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 13px 16px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 0.2s;
  caret-color: var(--accent);
}
.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--text-faint); }

.auth-btn {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: #0c0c0c;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 13px 24px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.auth-btn:hover { background: transparent; color: var(--accent); }
.auth-arrow { font-size: 14px; opacity: 0.7; }

.auth-skip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: center;
  transition: color 0.2s;
}
.auth-skip:hover { color: var(--text); }

/* ─── History Panel (old, kept for compat) ────────────────── */
.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12,12,12,0.5);
  z-index: 600;
  backdrop-filter: blur(4px);
}
.history-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 340px; max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 700;
  display: flex; flex-direction: column;
  animation: panel-in 0.35s var(--ease-out) both;
}
@keyframes panel-in  { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes panel-out { from { transform: translateX(0); }    to { transform: translateX(100%); } }
.history-panel.closing { animation: panel-out 0.3s var(--ease-out) both; }
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.history-title { font-size: 11px; letter-spacing: 0.2em; color: var(--text); }
.history-close {
  font-family: var(--mono); font-size: 18px; color: var(--text-dim);
  background: transparent; border: none; cursor: pointer; transition: color 0.2s; padding: 0 4px;
}
.history-close:hover { color: var(--text); }
.history-body { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.history-empty { font-size: 11px; color: var(--text-dim); letter-spacing: 0.1em; text-align: center; margin-top: 40px; }

/* ─── Leaderboard Overlay ─────────────────────────────────── */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 750;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 24px 40px;
  overflow-y: auto;
  animation: overlay-in 0.3s var(--ease-out) both;
}

.lb-modal {
  width: 100%;
  max-width: 720px;
  animation: modal-in 0.4s var(--ease-spring) both;
}

.lb-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.lb-title {
  font-size: 22px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}

.lb-sub {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

.lb-close {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0 4px;
  line-height: 1;
  margin-left: auto;
}
.lb-close:hover { color: var(--text); }

/* Table */
.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table-head th {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  font-weight: 400;
  text-align: left;
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--border);
}
.lb-table-head th:first-child { padding-left: 0; width: 40px; text-align: center; }
.lb-table-head th.align-right { text-align: right; }

.lb-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: lb-row-in 0.4s var(--ease-out) both;
}
.lb-row:hover { background: var(--surface2); }
.lb-row:last-child { border-bottom: none; }

@keyframes lb-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lb-row td {
  padding: 16px;
  font-variant-numeric: tabular-nums;
}
.lb-row td:first-child { padding-left: 0; text-align: center; }
.lb-row td.align-right { text-align: right; }

/* Rank cell */
.lb-rank {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lb-rank.gold   { color: #f5c542; border: 1px solid rgba(245,197,66,0.35); }
.lb-rank.silver { color: #aaa;    border: 1px solid rgba(170,170,170,0.3); }
.lb-rank.bronze { color: #cd7f32; border: 1px solid rgba(205,127,50,0.3); }

/* User cell */
.lb-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--subtle);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lb-avatar.is-current {
  background: var(--accent);
  color: #0c0c0c;
}

.lb-username {
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.04em;
}

.lb-value {
  font-size: 13px;
  font-weight: 300;
  color: var(--text);
}

.lb-value-unit {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 3px;
}

.lb-when {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.lb-empty {
  text-align: center;
  padding: 60px 0;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ─── Profile Overlay ─────────────────────────────────────── */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 760;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 24px 60px;
  overflow-y: auto;
  animation: overlay-in 0.3s var(--ease-out) both;
}

.profile-modal {
  width: 100%;
  max-width: 600px;
  animation: modal-in 0.4s var(--ease-spring) both;
  position: relative;
}

.profile-close {
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--mono);
  font-size: 20px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  padding: 0 4px;
}
.profile-close:hover { color: var(--text); }

/* Profile header row */
.profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
}

.profile-avatar-big {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #0c0c0c;
  font-size: 26px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-username-big {
  font-size: 24px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.01em;
}

.profile-joined {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-top: 4px;
}

/* Stats grid */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 32px;
}

.profile-stat {
  background: var(--surface);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ps-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  text-transform: lowercase;
}

.ps-value {
  font-size: 22px;
  font-weight: 300;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ps-value.accent { color: var(--accent); }

.ps-unit {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* History section */
.profile-section-title {
  font-size: 9px;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.profile-history-table {
  width: 100%;
  border-collapse: collapse;
}

.profile-history-table thead th {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  font-weight: 400;
  text-align: left;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
.profile-history-table thead th:first-child { padding-left: 0; }
.profile-history-table thead th.ar { text-align: right; }

.profile-history-table tbody tr {
  border-bottom: 1px solid var(--border);
  animation: lb-row-in 0.35s var(--ease-out) both;
}
.profile-history-table tbody tr:last-child { border-bottom: none; }

.profile-history-table tbody td {
  padding: 13px 12px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.profile-history-table tbody td:first-child { padding-left: 0; color: var(--text-dim); font-size: 10px; }
.profile-history-table tbody td.ar { text-align: right; }

.ph-quality-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.ph-quality-dot.good { background: var(--accent); }
.ph-quality-dot.ok   { background: var(--warn);   }
.ph-quality-dot.bad  { background: var(--danger);  }

.profile-no-history {
  text-align: center;
  padding: 40px 0;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

@media (max-width: 520px) {
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .lb-row td { padding: 12px 8px; }
}
