/* =====================================================
   LEADERBOARD.CSS — shared leaderboard panel + overlay
   Used by all games on samed.peteja.de
   ===================================================== */

/* ── Side panel (always visible on desktop ≥ 1100px) ── */
#leaderboardPanel {
  display: none;
  flex-direction: column;
  width: 300px;
  flex-shrink: 0;
  z-index: 1;
}
@media (min-width: 1100px) {
  #leaderboardPanel { display: flex; height: 90vh; max-height: 850px; }
}

.lb-card {
  background: rgba(10,10,15,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
  height: 100%;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 40px rgba(131,58,180,0.1);
  overflow: hidden;
}

/* ── Header ── */
.lb-header {
  display: flex; align-items: center; justify-content: space-between;
}
.lb-title {
  font-size: 18px; font-weight: 900; letter-spacing: -0.5px;
  background: linear-gradient(270deg, #833ab4, #fd1d1d, #fcb045);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  display: flex; align-items: center; gap: 7px;
}
.lb-icon {
  width: 18px; height: 18px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.lb-title .lb-icon {
  color: #fcb045;
  -webkit-text-fill-color: initial;
}
.lb-subtitle {
  font-size: 10px; color: rgba(255,255,255,0.4);
  font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px;
}
.lb-close-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6); width: 32px; height: 32px; border-radius: 10px;
  font-size: 14px; display: none;
  align-items: center; justify-content: center;
  cursor: pointer; transition: 0.2s;
}
.lb-close-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Mode tabs (Normal / Advanced) ── */
.lb-tabs { display: flex; gap: 6px; }
.lb-tab {
  flex: 1; padding: 8px 4px; font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
  cursor: pointer; transition: 0.2s; text-align: center;
}
.lb-tab.active {
  color: #fff; background: rgba(131,58,180,0.3);
  border-color: #833ab4; box-shadow: 0 0 12px rgba(131,58,180,0.3);
}
.lb-tab:hover:not(.active) { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); }

/* ── Time filters (Week / Month / Year / All) ── */
.lb-time-filters { display: flex; gap: 4px; }
.lb-time-btn {
  flex: 1; padding: 6px 2px; font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.35); background: transparent;
  border: 1px solid rgba(255,255,255,0.06); border-radius: 8px;
  cursor: pointer; transition: 0.2s; text-align: center; letter-spacing: 0.3px;
}
.lb-time-btn.active {
  color: #fcb045; border-color: rgba(252,176,69,0.4);
  background: rgba(252,176,69,0.1);
}
.lb-time-btn:hover:not(.active) { color: rgba(255,255,255,0.6); }

/* ── Column headers ── */
.lb-col-headers {
  display: grid;
  grid-template-columns: 28px 1fr 52px 36px;
  gap: 6px; padding: 0 10px 4px;
}
.lb-col-h {
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.25);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.lb-col-h:nth-child(3),
.lb-col-h:nth-child(4) { text-align: right; }

/* ── Scrollable list ── */
.lb-list-wrapper {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.lb-list-wrapper::-webkit-scrollbar { width: 3px; }
.lb-list-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.lb-list { display: flex; flex-direction: column; gap: 5px; }

/* ── Individual row ── */
.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr 52px 36px;
  align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 11px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  transition: background 0.2s;
}
.lb-row:hover  { background: rgba(255,255,255,0.06); }
.lb-row.is-you { background: rgba(131,58,180,0.15); border-color: rgba(131,58,180,0.35); }
.lb-row.top-1  { background: rgba(252,176,69,0.1);  border-color: rgba(252,176,69,0.25); }
.lb-row.top-2  { background: rgba(192,192,192,0.07); border-color: rgba(192,192,192,0.2); }
.lb-row.top-3  { background: rgba(205,127,50,0.08);  border-color: rgba(205,127,50,0.2); }

.lb-rank { font-size: 13px; font-weight: 900; text-align: center; color: rgba(255,255,255,0.35); }
.lb-row.top-1 .lb-rank { color: #fcb045; }
.lb-row.top-2 .lb-rank { color: #c0c0c0; }
.lb-row.top-3 .lb-rank { color: #cd7f32; }

.lb-name {
  font-size: 13px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-you-tag { color: #833ab4; font-size: 10px; }
.lb-date    { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 1px; }

.lb-score { font-size: 14px; font-weight: 900; color: #fff; text-align: right; }
.lb-row.top-1 .lb-score { color: #fcb045; }
.lb-floor { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.35); text-align: right; }

/* ── Your rank footer ── */
.lb-your-rank {
  padding: 10px 12px;
  background: rgba(131,58,180,0.12);
  border: 1px solid rgba(131,58,180,0.25);
  border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.lb-your-rank-label { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 700; }
.lb-your-rank-val   { font-size: 13px; color: #fff; font-weight: 900; }
.lb-your-rank-val span { color: #833ab4; }

/* ── Empty / loading states ── */
.lb-empty {
  text-align: center; padding: 30px 10px;
  color: rgba(255,255,255,0.25); font-size: 13px; font-weight: 600;
}
.lb-empty-icon {
  display: flex; justify-content: center; margin-bottom: 8px;
  color: #fcb045;
}
.lb-empty-icon .lb-icon { width: 22px; height: 22px; }
.lb-loading {
  text-align: center; padding: 30px 10px;
  color: rgba(255,255,255,0.3); font-size: 12px;
  animation: pulse 1.5s infinite;
}

/* ── Mobile overlay (slide-up sheet) ── */
#leaderboardOverlay {
  position: fixed; inset: 0;
  background: rgba(5,5,9,0.92); backdrop-filter: blur(10px);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
#leaderboardOverlay.show { opacity: 1; pointer-events: auto; }

.lb-sheet {
  width: 100%; max-width: 500px;
  background: #0d0d14;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 40px;
  max-height: 85vh;
  display: flex; flex-direction: column; gap: 14px;
  transform: translateY(30px);
  transition: transform 0.3s ease;
}
#leaderboardOverlay.show .lb-sheet { transform: translateY(0); }

/* On wide screens the overlay is never needed */
@media (min-width: 1100px) {
  #leaderboardOverlay { display: none !important; }
}
