/* ==========================================================================
   HelpLife - gamified supplement deals showcase
   ========================================================================== */

:root {
  --bg:        #08090a;
  --bg-soft:   #0d1012;
  --panel:     #101417;
  --card:      #12181b;
  --card-2:    #161d20;
  --border:    #232d30;
  --border-2:  #2e3a3e;
  --text:      #e9f7ec;
  --muted:     #8fa39a;
  --muted-2:   #6a7d75;
  --neon:      #39ff14;
  --neon-dim:  rgba(57, 255, 20, .12);
  --neon-glow: rgba(57, 255, 20, .35);
  --gold:      #ffd24a;
  --silver:    #cfd8dc;
  --bronze:    #e08a3c;
  --danger:    #ff4d5e;
  --radius:    16px;
  --mono:      'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --sans:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(57, 255, 20, .06), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(57, 255, 20, .04), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* ---------- top bar ------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 9, 10, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 66px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--neon), #1fbb0a);
  color: #04150a;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: -.5px;
  box-shadow: 0 0 18px var(--neon-glow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: -.2px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.live-totals { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; }
.live-totals b { color: var(--neon); font-family: var(--mono); font-size: 14px; }

/* ---------- hero ---------------------------------------------------------- */
.hero { border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(57,255,20,.035), transparent); }
.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 34px 18px;
}
.eyebrow {
  margin: 0 0 8px;
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neon);
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.15;
  letter-spacing: -.7px;
  max-width: 22ch;
}
.hero-sub { margin: 0 0 16px; color: var(--muted); max-width: 56ch; }
.score-formula {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12.5px;
  color: var(--muted);
}
.score-formula .tag { color: var(--neon); font-weight: 700; letter-spacing: .5px; }
.score-formula .mono { color: var(--text); }
.score-formula .plus { color: var(--muted-2); }

.hero-stats { display: flex; gap: 12px; }
.hstat {
  min-width: 132px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  text-align: center;
}
.hnum { display: block; font-size: 26px; font-weight: 700; color: var(--neon); }
.hlbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); }

/* ---------- controls ------------------------------------------------------ */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 22px 0 4px;
}
.search, .select {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-2);
  background: var(--panel);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
}
.search { flex: 1 1 260px; min-width: 200px; }
.search:focus, .select:focus { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-dim); }
.select { flex: 0 0 auto; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 4px; }
.chip {
  border: 1px solid var(--border-2);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: .15s;
}
.chip em { font-style: normal; color: var(--muted-2); margin-left: 4px; }
.chip:hover { color: var(--text); border-color: var(--neon); }
.chip.is-active { background: var(--neon); color: #04150a; border-color: var(--neon); font-weight: 700; }
.chip.is-active em { color: rgba(4, 21, 10, .6); }

/* ---------- leaderboard --------------------------------------------------- */
.board { display: flex; flex-direction: column; gap: 14px; padding: 18px 0 8px; }

.deal {
  display: grid;
  grid-template-columns: 236px 1fr;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  transition: border-color .18s, transform .18s, box-shadow .18s;
  position: relative;
  overflow: visible;
}
.deal:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: 0 14px 34px -22px #000; }
.deal.top-1 { border-color: rgba(255, 210, 74, .45); box-shadow: 0 0 0 1px rgba(255, 210, 74, .12) inset; }
.deal.top-2 { border-color: rgba(207, 216, 220, .35); }
.deal.top-3 { border-color: rgba(224, 138, 60, .35); }

/* media */
.deal-media { position: relative; }
.deal-media img {
  display: block;
  width: 100%;
  height: 218px;
  object-fit: contain;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,.06), transparent 60%),
    #0c1113;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.deal-media img.img-fail {
  background:
    linear-gradient(135deg, #0c1113 25%, #10171a 25%, #10171a 50%, #0c1113 50%, #0c1113 75%, #10171a 75%);
  background-size: 14px 14px;
}
.rank-badge {
  position: absolute;
  top: -8px; left: -8px;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  font-family: var(--mono);
  font-weight: 700;
  z-index: 2;
}
.rank-badge .rank-hash { color: var(--muted-2); font-size: 11px; }
.rank-badge .rank-num { font-size: 16px; }
.rank-badge.r1 { background: linear-gradient(145deg, #ffd24a, #e0a400); color: #231a00; border-color: #ffd24a; }
.rank-badge.r1 .rank-hash { color: rgba(35,26,0,.65); }
.rank-badge.r2 { background: linear-gradient(145deg, #e6edf0, #b3c1c7); color: #1a2226; border-color: #cfd8dc; }
.rank-badge.r2 .rank-hash { color: rgba(26,34,38,.6); }
.rank-badge.r3 { background: linear-gradient(145deg, #e08a3c, #a85f1d); color: #241000; border-color: #e08a3c; }
.rank-badge.r3 .rank-hash { color: rgba(36,16,0,.6); }
.ribbon {
  position: absolute;
  bottom: 8px; left: 8px;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(8,9,10,.78);
  border: 1px solid var(--border-2);
  color: var(--muted);
}

/* body */
.deal-body { min-width: 0; display: flex; flex-direction: column; }
.deal-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.deal-title { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 11px;
  letter-spacing: .4px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
}
.pill.hot { color: #ffd24a; border-color: rgba(255,210,74,.4); background: rgba(255,210,74,.08); }
.pill.feat { color: var(--neon); border-color: var(--neon-glow); background: var(--neon-dim); }
.pill.ok { color: var(--neon); border-color: rgba(57,255,20,.32); }
.pill.off { color: var(--danger); border-color: rgba(255,77,94,.35); }

.deal-desc {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deal-price { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.price { font-size: 22px; font-weight: 700; color: var(--text); }
.score-pill {
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--border-2);
  border-radius: 999px;
  padding: 4px 12px;
}
.score-pill b { color: var(--neon); }

/* heat */
.heat { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.heat-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #0a0f11;
  border: 1px solid var(--border);
  overflow: hidden;
}
.heat-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1fbb0a, var(--neon));
  box-shadow: 0 0 12px var(--neon-glow);
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.heat-lbl { font-size: 11px; color: var(--muted-2); min-width: 34px; text-align: right; }

/* footer / actions */
.deal-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 4px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.metrics { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
  cursor: pointer;
  transition: .15s;
  user-select: none;
}
.stat .ico { font-size: 13px; filter: grayscale(.35); }
.stat b { font-family: var(--mono); color: var(--text); font-size: 13.5px; }
.stat .lbl { color: var(--muted-2); }
.stat:hover { border-color: var(--neon); color: var(--text); }
.stat:hover .ico { filter: none; }
.stat.pop b { animation: pop .34s ease; }
.stat-like.on { border-color: var(--neon-glow); background: var(--neon-dim); color: var(--neon); }
.stat-like.on .lbl { color: rgba(57,255,20,.75); }
.stat-share.on { border-color: rgba(57,255,20,.3); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.35); color: var(--neon); } 100% { transform: scale(1); } }

/* share popover */
.share { position: relative; }
.share > summary { list-style: none; }
.share > summary::-webkit-details-marker { display: none; }
.share-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 176px;
  padding: 6px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--card-2);
  box-shadow: 0 20px 40px -20px #000, 0 0 0 1px rgba(57,255,20,.06);
}
.share-menu a, .share-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
}
.share-menu a:hover, .share-menu button:hover { background: var(--neon-dim); color: var(--neon); }

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--neon), #21c30b);
  color: #04150a;
  font-weight: 700;
  font-size: 14px;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 26px -12px var(--neon-glow);
  transition: .16s;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 30px -12px var(--neon-glow); }
.btn-cta .arrow { transition: transform .16s; }
.btn-cta:hover .arrow { transform: translateX(3px); }

/* reorder animation */
.board.rerank .deal { opacity: .35; transform: scale(.99); }
.board .deal { transition: border-color .18s, box-shadow .18s, opacity .3s, transform .3s; }

.board-note { color: var(--muted-2); font-size: 12px; padding: 6px 0 40px; }

.empty {
  margin: 40px 0;
  padding: 40px;
  text-align: center;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: var(--panel);
}
.empty h2 { margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* ---------- footer -------------------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 26px 0;
  margin-top: 20px;
}
.site-foot p { margin: 0 0 6px; color: var(--muted-2); font-size: 12.5px; }
.foot-links { display: flex; gap: 10px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); border-bottom: 1px dotted var(--muted-2); }
.foot-links a:hover { color: var(--neon); }

/* ---------- load more / pagination ---------------------------------------- */
/* Before JS boots, hide everything past the first page so there is no flash. */
.board:not(.is-paged) .deal:nth-child(n+11) { display: none; }
.deal.is-hidden { display: none; }

.load-more-wrap {
  display: none; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 18px 6px;
}
.load-more-wrap .btn-cta { min-width: 210px; font-family: inherit; }
.load-more-wrap .lm-count { color: var(--muted-2); font-weight: 600; }
.lm-shown { color: var(--muted-2); font-size: 12.5px; letter-spacing: .3px; }

/* ---------- image lightbox (enlarge to 600x600) --------------------------- */
.deal-media img { cursor: zoom-in; }

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 6, 7, .84);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.lightbox-stage {
  position: relative; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.lightbox-img {
  width: min(600px, calc(100vw - 48px), calc(100vh - 140px));
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: contain;
  background: #0b0d0e;
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: 0 30px 90px -30px #000, 0 0 44px -16px var(--neon-glow);
  animation: hl-lb-pop .18s ease-out;
}
@keyframes hl-lb-pop {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: none; }
}
.lightbox-cap {
  color: var(--muted); font-size: 13px; text-align: center;
  max-width: min(600px, calc(100vw - 48px));
}
.lightbox-x {
  position: absolute; top: -14px; right: -14px;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border-2); background: var(--panel);
  color: var(--text); font-size: 21px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-x:hover { color: var(--danger); border-color: var(--danger); }
body.hl-lightbox-open { overflow: hidden; }

/* ---------- legal pages (privacy / terms) --------------------------------- */
.legal-hero {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(57,255,20,.035), transparent);
  padding: 40px 0 30px;
}
.legal-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -.7px;
  line-height: 1.15;
}
.legal-hero .lede { color: var(--muted); max-width: 68ch; margin: 0; }
.legal-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; color: var(--muted-2); font-size: 12.5px; }
.legal-meta b { color: var(--muted); font-weight: 600; }

.legal-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  padding: 30px 18px 10px;
}
.legal-toc {
  position: sticky;
  top: 86px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 18px;
}
.legal-toc h2 {
  margin: 0 0 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--neon);
}
.legal-toc ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.legal-toc a { color: var(--muted); font-size: 12.5px; }
.legal-toc a:hover { color: var(--neon); }

.legal-body { min-width: 0; }
.legal-body section { padding: 22px 0; border-bottom: 1px solid var(--border); }
.legal-body section:first-child { padding-top: 4px; }
.legal-body h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: -.2px;
  scroll-margin-top: 90px;
}
.legal-body h3 { margin: 16px 0 8px; font-size: 14.5px; color: var(--text); }
.legal-body p, .legal-body li { color: var(--muted); font-size: 14px; line-height: 1.62; }
.legal-body p { margin: 0 0 12px; }
.legal-body ul, .legal-body ol { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.legal-body strong { color: var(--text); font-weight: 600; }
.legal-body a { color: var(--neon); border-bottom: 1px dotted var(--neon-glow); }
.legal-body a:hover { border-bottom-style: solid; }

.legal-note {
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--neon);
  background: var(--card);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 14px;
}
.legal-note p:last-child { margin-bottom: 0; }
.legal-note.warn { border-left-color: var(--danger); }

.legal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.legal-back { color: var(--muted); font-size: 12.5px; }

/* ---------- toast --------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--card-2);
  border: 1px solid var(--neon-glow);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: 0 18px 40px -18px #000, 0 0 22px -6px var(--neon-glow);
  opacity: 0;
  pointer-events: none;
  transition: .28s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------------------------------------------------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-stats { justify-content: flex-start; }
  .legal-layout { grid-template-columns: 1fr; gap: 22px; padding: 24px 18px 10px; }
  .legal-toc { position: static; }
}
@media (max-width: 640px) {
  .deal { grid-template-columns: 118px 1fr; gap: 14px; padding: 14px; }
  .deal-media img { height: 132px; padding: 6px; }
  .deal-title { font-size: 17px; }
  .deal-desc { -webkit-line-clamp: 2; margin: 8px 0 10px; font-size: 12.5px; }
  .price { font-size: 18px; }
  .deal-foot { flex-direction: column; align-items: stretch; }
  .metrics { justify-content: flex-start; }
  .btn-cta { justify-content: center; width: 100%; }
  .live-totals { display: none; }
  .hstat { min-width: 108px; padding: 12px; }
  .hnum { font-size: 20px; }
  .share-menu { left: auto; right: 0; }
}
@media (max-width: 400px) {
  .deal { grid-template-columns: 96px 1fr; }
  .deal-media img { height: 108px; }
  .stat .lbl { display: none; }
}
