/* ==========================================================
   BẢNG VINH DANH - toàn bộ class có tiền tố .lbx- (không đụng CSS cũ của shop)
   Màu: xanh biển nhạt + trắng. Hỗ trợ dark mode của site: html[data-theme="dark"]
   Màu nhấn lấy từ cấu hình admin: --lb-accent / --lb-accent2 (set inline ở #lbx-root)
   ========================================================== */
#lbx-root, #lbx-root * { box-sizing: border-box; }
#lbx-root {
  --lb-accent: #3b82f6;
  --lb-accent2: #7dd3fc;
  --lb-ink: #0f2a4a;
  --lb-muted: #64809f;
  --lb-bg: #ffffff;
  --lb-soft: #f1f7ff;
  --lb-line: #dbe9fb;
  --lb-shadow: 0 24px 60px rgba(15, 42, 74, .25);
  --lb-gold: #e9a712;   --lb-gold-bg: #fff4cf;
  --lb-silver: #7f95ab; --lb-silver-bg: #e8eff6;
  --lb-bronze: #c2713a; --lb-bronze-bg: #fbe3d1;
  font-family: inherit;
  color: var(--lb-ink);
}
html[data-theme="dark"] #lbx-root {
  --lb-ink: #e8f1fc; --lb-muted: #8fa7c4; --lb-bg: #0f1b2d; --lb-soft: #15253b; --lb-line: #223653;
  --lb-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --lb-gold-bg: #3a2f0e; --lb-silver-bg: #243244; --lb-bronze-bg: #3b2616;
}

/* ---------- Nút cúp nổi ---------- */
.lbx-fab {
  position: fixed; z-index: 9990;
  width: var(--lbx-fab, 56px); height: var(--lbx-fab, 56px);
  border: 0; padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--lb-accent2), var(--lb-accent));
  box-shadow: 0 8px 22px rgba(59, 130, 246, .38), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
  animation: lbx-bob 3.2s ease-in-out infinite;
}
.lbx-fab svg { width: 52%; height: 52%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18)); }
.lbx-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 28px rgba(59, 130, 246, .5); }
.lbx-fab:active { transform: scale(.94); }
.lbx-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--lb-accent); }
.lbx-fab::after { /* vòng sáng nhẹ */
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--lb-accent2); opacity: 0; animation: lbx-ring 3.2s ease-out infinite;
}
@keyframes lbx-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes lbx-ring { 0% { opacity: .55; transform: scale(.92); } 70%, 100% { opacity: 0; transform: scale(1.25); } }
body.lbx-open .lbx-fab { display: none; }

/* ---------- Lớp phủ + khung ---------- */
.lbx-overlay {
  position: fixed; inset: 0; z-index: 1000001;
  background: rgba(10, 30, 58, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s;
}
.lbx-overlay.is-open { opacity: 1; visibility: visible; }
.lbx-sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 90vh; max-height: 90dvh;
  background: var(--lb-bg); border-radius: 26px 26px 0 0; box-shadow: var(--lb-shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(40px); transition: transform .3s cubic-bezier(.2, .9, .3, 1);
}
.lbx-overlay.is-open .lbx-sheet { transform: translateY(0); }
@media (min-width: 768px) {
  .lbx-overlay { align-items: center; padding: 24px; }
  .lbx-sheet { border-radius: 26px; max-height: 86vh; transform: translateY(16px) scale(.98); }
  .lbx-overlay.is-open .lbx-sheet { transform: none; }
  .lbx-grab { display: none; }
}

/* ---------- Đầu bảng ---------- */
.lbx-head {
  position: relative; padding: 10px 18px 14px; flex: none;
  background: linear-gradient(180deg, #dff0ff 0%, #f4faff 70%, var(--lb-bg) 100%);
}
html[data-theme="dark"] .lbx-head { background: linear-gradient(180deg, #17304f 0%, #12243b 70%, var(--lb-bg) 100%); }
.lbx-grab { width: 42px; height: 4px; border-radius: 4px; background: var(--lb-line); margin: 0 auto 10px; touch-action: none; cursor: grab; }
.lbx-title-row { display: flex; align-items: center; gap: 12px; padding-right: 40px; }
.lbx-badge {
  flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--lb-accent2), var(--lb-accent)); box-shadow: 0 6px 14px rgba(59, 130, 246, .3);
}
.lbx-badge svg { width: 24px; height: 24px; }
.lbx-title { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 800; letter-spacing: .5px; color: var(--lb-ink); }
.lbx-sub { margin: 3px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--lb-muted); }
.lbx-fox { position: absolute; right: 48px; top: 8px; width: 50px; height: auto; pointer-events: none; opacity: .95; }
.lbx-fox ~ .lbx-title-row { padding-right: 94px; }
.lbx-close {
  position: absolute; right: 12px; top: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .8); color: var(--lb-muted); display: grid; place-items: center; transition: background .15s, color .15s;
}
html[data-theme="dark"] .lbx-close { background: rgba(255, 255, 255, .08); }
.lbx-close:hover { background: var(--lb-accent); color: #fff; }
.lbx-close svg { width: 16px; height: 16px; }

/* ---------- Tab ---------- */
.lbx-tabs { display: flex; gap: 4px; margin-top: 12px; padding: 4px; border-radius: 14px; background: var(--lb-soft); border: 1px solid var(--lb-line); }
.lbx-tab {
  flex: 1; border: 0; background: transparent; color: var(--lb-muted); font: inherit; font-size: 13px; font-weight: 700;
  padding: 8px 6px; border-radius: 10px; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap;
}
.lbx-tab:hover { color: var(--lb-ink); }
.lbx-tab[aria-selected="true"] { background: var(--lb-bg); color: var(--lb-accent); box-shadow: 0 2px 8px rgba(59, 130, 246, .18); }
.lbx-tab:focus-visible { outline: 2px solid var(--lb-accent); outline-offset: 1px; }
.lbx-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--lb-muted); min-height: 24px; }
.lbx-range { font-weight: 600; }
.lbx-countdown { color: var(--lb-accent); font-weight: 700; }
.lbx-prev {
  border: 1px solid var(--lb-line); background: var(--lb-bg); color: var(--lb-muted); font: inherit; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 99px; cursor: pointer; white-space: nowrap;
}
.lbx-prev[aria-pressed="true"] { background: var(--lb-accent); border-color: var(--lb-accent); color: #fff; }

/* ---------- Thân (cuộn riêng) ---------- */
.lbx-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 16px 14px; min-height: 180px; }
.lbx-note { margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; font-size: 12px; line-height: 1.4; background: var(--lb-soft); color: var(--lb-muted); border: 1px dashed var(--lb-line); }
.lbx-note.is-warn { background: #fff8e1; color: #8a6200; border-color: #f3dc9a; }
html[data-theme="dark"] .lbx-note.is-warn { background: #3a2f0e; color: #f4d27a; border-color: #5a4a18; }

/* Podium Top 3 */
.lbx-podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; gap: 8px; align-items: end; margin: 4px 0 12px; }
.lbx-pod { text-align: center; min-width: 0; animation: lbx-rise .5s ease both; }
.lbx-pod:nth-child(1) { animation-delay: .08s; } .lbx-pod:nth-child(2) { animation-delay: 0s; } .lbx-pod:nth-child(3) { animation-delay: .14s; }
@keyframes lbx-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.lbx-pod-av {
  position: relative; width: 52px; height: 52px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff; border: 3px solid var(--c); background: linear-gradient(145deg, var(--c2), var(--c));
}
.lbx-pod.r1 .lbx-pod-av { width: 62px; height: 62px; font-size: 24px; }
.lbx-pod-av.no-av { font-size: 0; }
.lbx-pod-medal {
  position: absolute; right: -6px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--c); border: 2px solid var(--lb-bg);
}
.lbx-crown { position: absolute; left: 50%; top: -17px; width: 26px; transform: translateX(-50%); color: var(--lb-gold); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }
.lbx-pod-name { font-size: 13px; font-weight: 700; color: var(--lb-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.lbx-pod-amt { font-size: 12.5px; font-weight: 800; color: var(--lb-accent); margin-top: 1px; }
.lbx-pod-cnt { font-size: 11px; color: var(--lb-muted); }
.lbx-pod-step {
  margin-top: 6px; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: var(--c);
  background: var(--cbg); border: 1px solid var(--lb-line);
}
.lbx-pod.r1 { --c: var(--lb-gold); --c2: #ffd45c; --cbg: var(--lb-gold-bg); }
.lbx-pod.r2 { --c: var(--lb-silver); --c2: #c4d2e0; --cbg: var(--lb-silver-bg); }
.lbx-pod.r3 { --c: var(--lb-bronze); --c2: #eab183; --cbg: var(--lb-bronze-bg); }
.lbx-pod.r1 .lbx-pod-step { height: 54px; } .lbx-pod.r2 .lbx-pod-step { height: 40px; } .lbx-pod.r3 .lbx-pod-step { height: 32px; }
.lbx-pod.is-you .lbx-pod-name::after, .lbx-row.is-you .lbx-name::after { content: " (Bạn)"; color: var(--lb-accent); font-weight: 800; }

/* Hàng xếp hạng */
.lbx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lbx-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--lb-bg);
  border: 1px solid var(--lb-line); transition: transform .15s ease, box-shadow .15s ease, border-color .15s; animation: lbx-rise .35s ease both;
}
.lbx-row:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(59, 130, 246, .12); border-color: var(--lb-accent2); }
.lbx-row.is-you { background: var(--lb-soft); border-color: var(--lb-accent); }
.lbx-row.top { border-left: 4px solid var(--c); }
.lbx-row.r1 { --c: var(--lb-gold); } .lbx-row.r2 { --c: var(--lb-silver); } .lbx-row.r3 { --c: var(--lb-bronze); }
.lbx-rank { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--lb-muted); background: var(--lb-soft); }
.lbx-row.top .lbx-rank { color: #fff; background: var(--c); }
.lbx-av { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: var(--lb-accent); background: var(--lb-soft); border: 1px solid var(--lb-line); }
.lbx-info { flex: 1; min-width: 0; }
.lbx-name { font-size: 14px; font-weight: 700; color: var(--lb-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbx-count { font-size: 11.5px; color: var(--lb-muted); margin-top: 1px; }
.lbx-amt { flex: none; font-size: 14.5px; font-weight: 800; color: var(--lb-accent); text-align: right; }

/* Trạng thái */
.lbx-state { text-align: center; padding: 34px 18px; color: var(--lb-muted); }
.lbx-state svg.lbx-state-fox { width: 84px; height: auto; margin: 0 auto 8px; display: block; }
.lbx-state-title { font-size: 15px; font-weight: 800; color: var(--lb-ink); margin: 4px 0; }
.lbx-state-text { font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.lbx-btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; text-decoration: none;
  padding: 9px 18px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, var(--lb-accent2), var(--lb-accent)); box-shadow: 0 4px 12px rgba(59, 130, 246, .3);
}
.lbx-btn:hover { filter: brightness(1.05); color: #fff; }
.lbx-btn.ghost { background: var(--lb-soft); color: var(--lb-accent); box-shadow: none; border: 1px solid var(--lb-line); }
.lbx-more { display: block; width: 100%; margin-top: 12px; }
.lbx-skel { display: grid; gap: 8px; }
.lbx-skel i { display: block; height: 56px; border-radius: 16px; background: linear-gradient(90deg, var(--lb-soft) 25%, var(--lb-line) 37%, var(--lb-soft) 63%); background-size: 400% 100%; animation: lbx-shimmer 1.3s ease infinite; }
.lbx-skel i:first-child { height: 120px; }
@keyframes lbx-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Thành tích của tôi (dính đáy) */
.lbx-me { flex: none; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--lb-line); background: var(--lb-soft); }
.lbx-me-card { display: flex; align-items: center; gap: 12px; }
.lbx-me-rank { flex: none; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; display: grid; place-items: center; font-size: 16px; font-weight: 800; color: #fff; background: linear-gradient(145deg, var(--lb-accent2), var(--lb-accent)); }
.lbx-me-rank.is-none { background: var(--lb-line); color: var(--lb-muted); }
.lbx-me-info { flex: 1; min-width: 0; }
.lbx-me-label { font-size: 11.5px; color: var(--lb-muted); }
.lbx-me-amt { font-size: 16px; font-weight: 800; color: var(--lb-ink); }
.lbx-me-hint { font-size: 12px; color: var(--lb-muted); line-height: 1.35; }
.lbx-me .lbx-btn { padding: 8px 14px; font-size: 12.5px; }

body.lbx-open { overflow: hidden; }
@media (max-width: 380px) {
  .lbx-fox { display: none; }
  .lbx-tab { font-size: 12px; padding: 8px 2px; }
  .lbx-pod-av { width: 46px; height: 46px; } .lbx-pod.r1 .lbx-pod-av { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .lbx-fab, .lbx-fab::after, .lbx-pod, .lbx-row, .lbx-skel i { animation: none !important; }
  .lbx-sheet, .lbx-overlay { transition: none !important; }
}
