/* rewards.css — the Rewards hub (rewards.php) plus the points chip the topbar
   injects on every page. Monotone by design: colour comes from the user's
   accent theme, exactly like streak.php, so the page never fights the rest of
   the app. */

/* ── Wallet hero ── */
.rw-hero {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 4vw, 2.5rem);
  flex-wrap: wrap;
}

.rw-hero-main { flex: 1 1 260px; min-width: 0; }

.rw-points {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--plum);
}

.rw-points .bi-coin { color: var(--accent); font-size: 1.4rem; align-self: center; }
.rw-points-num { font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rw-points-lbl { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }

.rw-level-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.7rem 0 0.45rem;
}

.rw-level-badge {
  background: var(--brand-grad);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.rw-level-title { font-weight: 700; color: var(--plum); }
.rw-level-next { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }

.rw-level-track { height: 8px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.rw-level-bar { height: 100%; background: var(--brand-grad); border-radius: 999px; transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1); }

.rw-hero-side { display: flex; gap: clamp(0.8rem, 3vw, 1.6rem); }
.rw-stat { text-align: center; }
.rw-stat-num { display: block; font-size: 1.25rem; font-weight: 800; color: var(--plum); font-variant-numeric: tabular-nums; }
.rw-stat-lbl { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }

/* ── Card grid ── */
.rw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.rw-card-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.rw-card-head .bi { color: var(--accent); font-size: 1.1rem; }
.rw-card-head h2 { font-size: 1rem; font-weight: 800; color: var(--plum); margin: 0; }
.rw-card-note { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }

/* ── Weekly chest ── */
.rw-chest { text-align: center; }
.rw-chest-art { font-size: 3.2rem; line-height: 1; margin: 0.3rem 0 0.6rem; filter: grayscale(1); opacity: 0.55; transition: filter 0.3s ease, opacity 0.3s ease; }
.rw-chest.is-ready .rw-chest-art { filter: none; opacity: 1; animation: rwBob 2.4s ease-in-out infinite; }
.rw-chest-art.is-shaking { animation: rwShake 0.5s linear infinite; }
.rw-chest-copy { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.rw-chest-copy strong { color: var(--plum); }
.rw-chest-track { height: 6px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; margin-top: 0.7rem; }
.rw-chest-bar { height: 100%; background: var(--brand-grad); border-radius: 999px; transition: width 0.5s ease; }

@keyframes rwBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes rwShake { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

/* ── Quests ── */
.rw-quest {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.rw-quest:last-of-type { border-bottom: none; }
.rw-quest > .bi { color: var(--accent); font-size: 1.05rem; width: 1.4rem; text-align: center; flex: none; }
.rw-quest.is-done > .bi { color: #1a9e5c; }
.rw-quest-body { flex: 1; min-width: 0; }
.rw-quest-label { font-weight: 700; color: var(--plum); font-size: 0.9rem; }
.rw-quest-sub { font-size: 0.74rem; color: var(--text-muted); }
.rw-quest-todo { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.rw-quest-claimed { font-size: 0.74rem; color: #1a9e5c; font-weight: 700; display: inline-flex; align-items: center; gap: 0.2rem; }

.rw-hint { font-size: 0.72rem; color: var(--text-muted); margin: 0.7rem 0 0; }

/* ── Shop ── */
.rw-shop-copy { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 0.9rem; }
.rw-shop-copy strong { color: var(--plum); }

.rw-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; }

.rw-pack {
  border: 1.5px solid var(--border);
  background: var(--card-bg, #fff);
  border-radius: 14px;
  padding: 0.7rem 0.4rem;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.rw-pack:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 16px rgba(124, 92, 191, 0.18); }
.rw-pack:disabled { opacity: 0.45; cursor: not-allowed; }
.rw-pack-credits { display: block; font-size: 1.35rem; font-weight: 800; color: var(--plum); line-height: 1; }
.rw-pack-lbl { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rw-pack-cost { display: block; margin-top: 0.35rem; font-size: 0.78rem; font-weight: 700; color: var(--accent); }

/* ── Referral ── */
.rw-code {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 1.5px dashed var(--accent);
  background: var(--accent-pale);
  border-radius: 14px;
  padding: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--plum);
  cursor: pointer;
  user-select: all;
}

.rw-code .bi { font-size: 0.95rem; color: var(--accent); }
.rw-code.is-copied { border-style: solid; }
.rw-code.is-copied::after { content: 'Link copied'; position: absolute; }
.rw-ref-count { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }

.rw-ref-redeem { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.rw-ref-redeem input { flex: 1; min-width: 0; text-transform: uppercase; }

/* ── Username + friends ── */
.rw-username { margin-bottom: 1rem; }
.rw-username-row, .rw-addfriend { display: flex; align-items: center; gap: 0.5rem; }
.rw-addfriend { margin-bottom: 0.6rem; }
.rw-at { font-weight: 800; color: var(--text-muted); font-size: 1.05rem; }
.rw-username-row input, .rw-addfriend input { flex: 1; min-width: 0; }
.rw-username-note { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.4rem; }
.rw-username-note.is-ok { color: #1a9e5c; font-weight: 600; }
.rw-username-note.is-bad { color: var(--coral); font-weight: 600; }

.rw-sub-head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--text-muted);
  margin: 1rem 0 0.3rem;
}

.rw-friend, .rw-rank {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.rw-friend:last-child, .rw-rank:last-child { border-bottom: none; }
.rw-friend-body { flex: 1; min-width: 0; }
.rw-friend-name { font-weight: 700; color: var(--plum); font-size: 0.9rem; }
.rw-friend-sub { font-size: 0.74rem; color: var(--text-muted); }

.rw-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; background: var(--gray-bg); }
.rw-av-initial { display: grid; place-items: center; font-weight: 800; color: var(--accent); font-size: 0.9rem; }

.rw-empty { font-size: 0.84rem; color: var(--text-muted); margin: 0.4rem 0 0; }

/* ── Leaderboard ── */
.rw-scope { margin-left: auto; display: inline-flex; background: var(--gray-bg); border-radius: 999px; padding: 3px; }
.rw-scope-btn { padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.rw-scope-btn.is-active { background: var(--accent); color: #fff; }

.rw-rank.is-me { background: var(--accent-pale); border-radius: 12px; padding-inline: 0.5rem; }
.rw-rank-num { width: 26px; text-align: center; font-weight: 800; color: var(--text-muted); font-variant-numeric: tabular-nums; flex: none; }
.rw-rank-1 { color: #d4a017; }
.rw-rank-2 { color: #98a2b3; }
.rw-rank-3 { color: #b06f3c; }
.rw-rank-pts { font-weight: 800; color: var(--plum); font-variant-numeric: tabular-nums; }
.rw-you { font-size: 0.66rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 0.1rem 0.4rem; vertical-align: middle; }

/* ── Achievements ── */
.rw-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; }

.rw-badge {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 0.6rem;
  text-align: center;
  opacity: 0.55;
  filter: grayscale(1);
}

.rw-badge.is-got { opacity: 1; filter: none; border-color: var(--accent); background: var(--accent-pale); }
.rw-badge .bi { font-size: 1.5rem; color: var(--accent); }
.rw-badge-name { font-weight: 800; font-size: 0.82rem; color: var(--plum); margin-top: 0.25rem; }
.rw-badge-desc { font-size: 0.68rem; color: var(--text-muted); line-height: 1.3; margin-top: 0.15rem; }
.rw-badge-pts { font-size: 0.7rem; font-weight: 700; color: var(--accent); margin-top: 0.3rem; }

/* ── History ── */
.rw-hist { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.rw-hist:last-child { border-bottom: none; }
.rw-hist-label { flex: 1; min-width: 0; color: var(--text); }
.rw-hist-date { font-size: 0.72rem; color: var(--text-muted); }
.rw-hist-pts { font-weight: 800; color: #1a9e5c; font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: right; }
.rw-hist-pts.is-spend { color: var(--coral); }

/* ── Feature-off card ── */
.rw-offline { display: flex; gap: 0.9rem; align-items: flex-start; }
.rw-offline .bi { font-size: 1.6rem; color: var(--accent); }
.rw-offline-title { font-weight: 800; color: var(--plum); margin-bottom: 0.3rem; }
.rw-offline p { font-size: 0.86rem; color: var(--text-muted); margin: 0; line-height: 1.55; }

/* ── Celebration pop ── */
.rw-pop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(30, 16, 46, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.rw-pop.is-open { display: flex; animation: rwFade 0.18s ease; }

.rw-pop-card {
  width: 100%;
  max-width: 340px;
  background: var(--card-bg, #fff);
  border-radius: 22px;
  padding: 1.6rem 1.4rem 1.3rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(30, 16, 46, 0.35);
  animation: rwPop 0.32s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.rw-pop-art { font-size: 3rem; line-height: 1; }
.rw-pop-title { font-weight: 800; color: var(--plum); font-size: 1.1rem; margin-top: 0.4rem; }
.rw-pop-points { font-size: 2rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; margin: 0.2rem 0; }
.rw-pop-sub { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 1.1rem; line-height: 1.5; }

@keyframes rwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rwPop { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .rw-chest.is-ready .rw-chest-art,
  .rw-chest-art.is-shaking { animation: none; }
  .rw-pop.is-open, .rw-pop-card { animation: none; }
}

/* The topbar points chip is styled in partials/loader.php, next to the streak
   badge it sits beside — it has to work on every page, not just this one. */

@media (max-width: 480px) {
  .rw-packs { grid-template-columns: 1fr; }
  .rw-hero-side { width: 100%; justify-content: space-between; }
  .rw-level-next { margin-left: 0; width: 100%; }
}
