/* ============================================================
   Rickyedit Games — Leaderboard Styles v2
   ============================================================ */

/* ── Icon images ──────────────────────────────────────────── */
.rlb-icon-img { width: 2em; height: 2em; object-fit: contain; vertical-align: middle; }
.rlb-medal { width: 2em; height: 2em; object-fit: contain; vertical-align: middle; }
.rlb-title .rlb-icon-img { width: 2.2em; height: 2.2em; }
.rlb-name-icon .rlb-icon-img { width: 3rem; height: 3rem; border-radius: 12px; }

/* ── Button icons ─────────────────────────────────────────── */
.mode-diff-btn img { width: 2em; height: 2em; object-fit: contain; vertical-align: middle; margin-right: 4px; pointer-events: none; }

/* ── Panel ─────────────────────────────────────────────────── */
.leaderboard-panel {
  display: none;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  animation: rlbSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.leaderboard-panel.visible { display: block; }

.rlb-header {
  width: 100%;
  box-sizing: border-box;
}
.rlb-table-wrap {
  width: 100%;
  box-sizing: border-box;
}

@keyframes rlbSlideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ────────────────────────────────────────────────── */
.rlb-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255, 51, 204, 0.04), transparent), var(--card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 50;
}
.rlb-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  margin: 0;
}
.rlb-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Custom Dropdown ──────────────────────────────────────────── */
.rlb-dropdown {
  position: relative;
  min-width: 100px;
  z-index: 100;
}
.rlb-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.rlb-dropdown-btn:hover { border-color: var(--pink); color: #fff; }
.rlb-dropdown-btn.open { border-color: var(--pink); color: #fff; }
.rlb-dropdown-btn .rlb-dropdown-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform 0.2s ease;
}
.rlb-dropdown-btn.open .rlb-dropdown-arrow {
  transform: rotate(180deg);
  border-top-color: var(--pink);
}
.rlb-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #1e1f23;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  max-height: 200px;
  overflow-y: auto;
}
.rlb-dropdown-list.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.rlb-dropdown-item {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.rlb-dropdown-item:hover {
  background: rgba(255, 51, 204, 0.1);
  color: #fff;
}
.rlb-dropdown-item.selected {
  color: var(--pink);
  background: rgba(255, 51, 204, 0.15);
}

/* Legacy filter styles (hidden but accessible) */
.rlb-filter {
  display: none;
}

/* ── Empty state ───────────────────────────────────────────── */
.rlb-empty {
  text-align: center;
  padding: 40px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
}
.rlb-empty-icon { font-size: 2.5rem; margin-bottom: 8px; }
.rlb-empty-text { color: #fff; font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.rlb-empty-sub { color: var(--muted); font-size: 0.85rem; }

/* ── Table ─────────────────────────────────────────────────── */
.rlb-table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 370px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 51, 204, 0.04), transparent), var(--card);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 51, 204, 0.4) transparent;
}
.rlb-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.rlb-table-wrap::-webkit-scrollbar-track { background: transparent; }
.rlb-table-wrap::-webkit-scrollbar-thumb { background: rgba(255, 51, 204, 0.4); border-radius: 3px; }
.rlb-table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255, 51, 204, 0.6); }
.rlb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.rlb-table th {
  padding: 10px 10px;
  text-align: left;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.72rem;
  color: var(--muted);
  background: #18191c;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
.rlb-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}
.rlb-table tr:last-child td { border-bottom: none; }
.rlb-table tr:hover td { background: rgba(255, 51, 204, 0.06); }

/* ── Top 3 highlights ──────────────────────────────────────── */
.rlb-top-1 td { color: #ffd700; font-weight: 700; }
.rlb-top-2 td { color: #c0c0c0; font-weight: 700; }
.rlb-top-3 td { color: #cd7f32; font-weight: 700; }
.rlb-top-1 td.rlb-col-score,
.rlb-top-2 td.rlb-col-score,
.rlb-top-3 td.rlb-col-score { font-size: 1rem; }

/* ── Column widths ─────────────────────────────────────────── */
.rlb-col-rank     { width: 36px; min-width: 36px; text-align: center; }
.rlb-col-name     { min-width: 80px; }
.rlb-col-score    { width: 55px; text-align: right; font-weight: 700; color: var(--pink); }
.rlb-col-difficulty { width: 70px; }
.rlb-col-channel  { width: 70px; }
.rlb-col-round    { width: 40px; text-align: center; }
.rlb-col-time     { width: 50px; text-align: center; }
.rlb-col-date     { width: 70px; }
.rlb-col-streak   { width: 36px; text-align: center; }
.rlb-col-correct  { width: 40px; text-align: center; color: var(--green); }
.rlb-col-total    { width: 36px; text-align: center; }
.rlb-col-percent  { width: 40px; text-align: center; font-weight: 700; color: var(--yellow); }
.rlb-col-lives    { width: 40px; text-align: center; color: var(--cyan); }
.rlb-col-report { width: 30px; text-align: center; }

/* ── Name Input Modal ──────────────────────────────────────── */
.rlb-name-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.rlb-name-modal.show {
  opacity: 1;
  visibility: visible;
}

.rlb-name-card {
  width: min(420px, 100%);
  background: linear-gradient(135deg, rgba(255, 51, 204, 0.12), rgba(241, 196, 15, 0.08)), #18191c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.rlb-name-modal.show .rlb-name-card {
  transform: translateY(0) scale(1);
}

.rlb-name-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  animation: rlbBounce 0.6s ease;
}
@keyframes rlbBounce {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.rlb-name-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 6px;
}
.rlb-name-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.rlb-name-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid rgba(255, 51, 204, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.rlb-name-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(255, 51, 204, 0.25);
}
.rlb-name-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-weight: 600;
}

.rlb-name-error {
  color: #e74c3c;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 10px 0 0;
  animation: rlbShake 0.3s ease;
}
@keyframes rlbShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.rlb-name-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.rlb-name-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.rlb-name-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
}
.rlb-name-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.rlb-name-btn-confirm {
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  color: #0d0d10;
  box-shadow: 0 8px 24px rgba(255, 51, 204, 0.35);
}
.rlb-name-btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 51, 204, 0.5);
}

/* ── Jan password step ──────────────────────────────────────── */
.rlb-jan-password-step {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  margin-top: 16px;
  text-align: center;
}
.rlb-jan-pw-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  animation: rlbBounce 0.4s ease;
}

/* ── Report button ─────────────────────────────────────────── */
.rlb-report-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 8px;
  opacity: 0.4;
  transition: all 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;
}
.rlb-report-btn:hover {
  opacity: 1;
  background: rgba(231, 76, 60, 0.15);
}
.rlb-report-btn:hover .rlb-icon-img {
  transform: scale(1.15);
}
.rlb-report-btn.rlb-reported {
  opacity: 1;
  cursor: default;
}

/* ── Report Confirm Modal ──────────────────────────────────── */
.rlb-report-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.rlb-report-modal.show {
  opacity: 1;
  visibility: visible;
}

.rlb-report-card {
  width: min(400px, 100%);
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.12), rgba(255, 51, 204, 0.08)), #18191c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.rlb-report-modal.show .rlb-report-card {
  transform: translateY(0) scale(1);
}

.rlb-report-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  animation: rlbBounce 0.6s ease;
}

.rlb-report-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 8px;
}
.rlb-report-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #e74c3c;
  margin: 0 0 8px;
}
.rlb-report-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 24px;
}
.rlb-report-actions {
  display: flex;
  gap: 12px;
}
.rlb-report-btn-modal {
  flex: 1;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.rlb-report-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
}
.rlb-report-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.rlb-report-btn-confirm {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  box-shadow: 0 8px 24px rgba(231, 76, 60, 0.35);
}
.rlb-report-btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(231, 76, 60, 0.5);
}
.rlb-report-btn-delete {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  color: #fff;
  box-shadow: 0 8px 24px rgba(142, 68, 173, 0.35);
}
.rlb-report-btn-delete:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(142, 68, 173, 0.5);
}

/* ── Admin panel ──────────────────────────────────────────── */
.rlb-admin-list {
  max-height: 340px;
  overflow-y: auto;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rlb-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.2);
  border-radius: 12px;
}
.rlb-admin-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rlb-admin-name {
  font-weight: 800;
  color: #e74c3c;
  font-size: 1rem;
  word-break: break-word;
}
.rlb-admin-meta {
  font-size: 0.75rem;
  color: var(--muted);
}
.rlb-admin-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.rlb-admin-btn {
  padding: 6px 14px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.rlb-admin-delete {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}
.rlb-admin-delete:hover {
  background: rgba(231, 76, 60, 0.4);
  transform: translateY(-1px);
}
.rlb-admin-keep {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}
.rlb-admin-keep:hover {
  background: rgba(46, 204, 113, 0.3);
  transform: translateY(-1px);
}

/* ── Save Toast ────────────────────────────────────────────── */
.rlb-save-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 99999;
  background: linear-gradient(135deg, #1a1b1e, #23242a);
  color: #fff;
  padding: 14px 28px;
  border-radius: 14px;
  border: 1px solid rgba(46, 204, 113, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
.rlb-save-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Exit Confirm Modal ─────────────────────────────────────── */
.rlb-exit-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.rlb-exit-modal.show {
  opacity: 1;
  visibility: visible;
}
.rlb-exit-card {
  width: min(400px, 100%);
  background: linear-gradient(135deg, rgba(255, 51, 204, 0.12), rgba(241, 196, 15, 0.08)), #18191c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.rlb-exit-modal.show .rlb-exit-card {
  transform: translateY(0) scale(1);
}
.rlb-exit-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.rlb-exit-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 24px;
}
.rlb-exit-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rlb-exit-btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
.rlb-exit-btn-sure {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.24);
  color: #e74c3c;
}
.rlb-exit-btn-sure:hover {
  background: rgba(231, 76, 60, 0.18);
  color: #ff5e4d;
}
.rlb-exit-btn-finalize {
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  color: #0d0d10;
  box-shadow: 0 8px 24px rgba(255, 51, 204, 0.35);
}
.rlb-exit-btn-finalize:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 51, 204, 0.5);
}
.rlb-exit-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
}
.rlb-exit-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Finalize Confirm Modal */
.rlb-finalize-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.rlb-finalize-modal.show {
  opacity: 1;
  visibility: visible;
}
.rlb-finalize-card {
  width: min(400px, 100%);
  background: linear-gradient(135deg, rgba(255, 51, 204, 0.12), rgba(241, 196, 15, 0.08)), #18191c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.rlb-finalize-modal.show .rlb-finalize-card {
  transform: translateY(0) scale(1);
}
.rlb-finalize-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.rlb-finalize-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 8px;
}
.rlb-finalize-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 24px;
}
.rlb-finalize-actions {
  display: flex;
  gap: 12px;
}
.rlb-finalize-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.rlb-finalize-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
}
.rlb-finalize-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.rlb-finalize-btn-confirm {
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  color: #0d0d10;
  box-shadow: 0 8px 24px rgba(255, 51, 204, 0.35);
}
.rlb-finalize-btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 51, 204, 0.5);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .rlb-header { flex-direction: column; align-items: flex-start; }
  .rlb-filters { width: 100%; }
  .rlb-filter { flex: 1; min-width: 0; }
  .rlb-table { font-size: 0.72rem; }
  .rlb-table th, .rlb-table td { padding: 6px 6px; }
  .rlb-col-date, .rlb-col-streak, .rlb-col-time, .rlb-col-difficulty, .rlb-col-channel { display: none; }
  .rlb-name-card { padding: 28px 20px; }
  .rlb-admin-row { flex-direction: column; align-items: flex-start; }
  .rlb-admin-actions { width: 100%; }
  .rlb-admin-btn { flex: 1; }
}
