/* ============================================================================
   Ascenvo — Gamification UI styles  (css/gamification.css)
   ----------------------------------------------------------------------------
   Badge shelf, XP bar, streak flame, level chip, daily-challenge card, and the
   reward toasts. On-brand with site.css (same dark/cinematic palette + vars).
   Reads the site.css :root vars when present and falls back to literals so the
   trainers (which load their own CSS, not site.css) still render correctly.

   FUN trainers + the app hub only. Never loaded by the serious call-taking
   trainer. ============================================================================ */

/* local fallback vars (used inside trainers that don't pull site.css) */
.ag-hub, .ag-chip, .ag-card, .ag-badges {
  --ag-ink: var(--ink, #f3f6fb);
  --ag-soft: var(--ink-soft, #aab4c4);
  --ag-dim: var(--dim, #7c8799);
  --ag-line: var(--line, #23303f);
  --ag-bg1: var(--bg-1, #0c1219);
  --ag-bg2: var(--bg-2, #111a24);
  --ag-accent: var(--accent, #3b82f6);
  --ag-accent-2: var(--accent-2, #1d4ed8);
  --ag-good: var(--good, #34d399);
  --ag-gold: #f59e0b;
  --ag-flame: #fb923c;
}

/* ---- the progress hub (app.html) ---------------------------------------- */
.ag-hub {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin: 8px 0 8px;
}
.ag-hub .ag-card {
  background: linear-gradient(165deg, var(--ag-bg2), var(--ag-bg1));
  border: 1px solid var(--ag-line);
  border-radius: 16px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.ag-hub .ag-card.span2 { grid-column: 1 / -1; }

.ag-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.ag-card-head h3 {
  margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ag-dim); font-weight: 700;
}

/* level + XP block */
.ag-level-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.ag-level-num {
  font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  background: linear-gradient(180deg, #fff, #9cc3ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ag-level-label { font-size: 16px; font-weight: 600; color: var(--ag-ink); }
.ag-level-sub { font-size: 12.5px; color: var(--ag-dim); }

.ag-xpbar {
  height: 12px; border-radius: 8px; background: rgba(255,255,255,.06);
  border: 1px solid var(--ag-line); overflow: hidden; margin: 12px 0 8px;
  position: relative;
}
.ag-xpbar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ag-accent), var(--ag-accent-2));
  border-radius: 8px 0 0 8px;
  box-shadow: 0 0 14px -2px var(--ag-accent);
  transition: width .5s cubic-bezier(.2,.7,.2,1);
}
.ag-xp-cap { font-size: 12.5px; color: var(--ag-soft); display: flex; justify-content: space-between; }

/* streak flame */
.ag-streak { display: flex; align-items: center; gap: 14px; }
.ag-flame {
  font-size: 34px; line-height: 1;
  filter: drop-shadow(0 0 10px rgba(251,146,60,.5));
}
.ag-streak.cold .ag-flame { filter: grayscale(1) opacity(.5); }
.ag-streak-num { font-size: 32px; font-weight: 800; color: #fff; line-height: 1; }
.ag-streak-txt { font-size: 13px; color: var(--ag-soft); }
.ag-streak-best { font-size: 12px; color: var(--ag-dim); margin-top: 3px; }

/* daily challenge card */
.ag-daily { display: flex; gap: 14px; align-items: flex-start; }
.ag-daily .ag-daily-ic {
  font-size: 26px; line-height: 1; flex: 0 0 auto;
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--accent-soft, rgba(59,130,246,.14));
  border: 1px solid var(--accent-line, rgba(59,130,246,.42));
}
.ag-daily .ag-daily-bd { flex: 1; }
.ag-daily-label { font-size: 15px; color: var(--ag-ink); font-weight: 600; margin: 2px 0 6px; }
.ag-daily-prog {
  height: 8px; border-radius: 6px; background: rgba(255,255,255,.06);
  border: 1px solid var(--ag-line); overflow: hidden; margin-bottom: 6px;
}
.ag-daily-prog > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ag-good), #10b981);
  transition: width .5s ease;
}
.ag-daily-meta { font-size: 12.5px; color: var(--ag-dim); display: flex; justify-content: space-between; }
.ag-daily.done .ag-daily-label::after {
  content: " ✓"; color: var(--ag-good); font-weight: 700;
}
.ag-daily-bonus { color: var(--ag-good); font-weight: 600; }

/* ---- badge shelf -------------------------------------------------------- */
.ag-badges {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px; margin-top: 6px;
}
.ag-badge {
  text-align: center; padding: 14px 8px 12px; border-radius: 12px;
  border: 1px solid var(--ag-line); background: rgba(255,255,255,.02);
  transition: .16s ease;
}
.ag-badge.earned {
  border-color: var(--accent-line, rgba(59,130,246,.42));
  background: linear-gradient(165deg, rgba(59,130,246,.10), rgba(59,130,246,.02));
}
.ag-badge.earned:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -16px rgba(0,0,0,.8); }
.ag-badge .ag-badge-ic {
  font-size: 28px; line-height: 1; display: block; margin-bottom: 7px;
}
.ag-badge.locked .ag-badge-ic { filter: grayscale(1); opacity: .32; }
.ag-badge .ag-badge-nm {
  font-size: 12px; font-weight: 600; color: var(--ag-ink); line-height: 1.25;
}
.ag-badge.locked .ag-badge-nm { color: var(--ag-dim); }
.ag-badge .ag-badge-ds {
  font-size: 11px; color: var(--ag-dim); margin-top: 3px; line-height: 1.3;
}

/* ---- reward toasts (richer than the JS-injected fallback) ---------------- */
.ag-toast-wrap {
  position: fixed; right: 18px; bottom: 18px; z-index: 99999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none; max-width: 330px;
}
.ag-toast {
  background: linear-gradient(165deg, var(--bg-2, #111a24), var(--bg-1, #0c1219));
  color: var(--ink, #f3f6fb);
  border: 1px solid var(--line, #23303f);
  border-left: 3px solid var(--accent, #3b82f6);
  border-radius: 12px; padding: 12px 15px;
  font: 14px/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.75);
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  display: flex; gap: 11px; align-items: flex-start;
}
.ag-toast.in { opacity: 1; transform: translateY(0); }
.ag-toast .ic { font-size: 21px; line-height: 1; }
.ag-toast .bd { flex: 1; }
.ag-toast .ti { font-weight: 700; color: #fff; margin: 0 0 1px; }
.ag-toast .sb { color: var(--ink-soft, #aab4c4); font-size: 12.5px; }
.ag-toast.level { border-left-color: #f59e0b; }
.ag-toast.badge { border-left-color: #34d399; }
.ag-toast.streak { border-left-color: #fb923c; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 720px) {
  .ag-hub { grid-template-columns: 1fr; }
  .ag-level-num { font-size: 34px; }
  .ag-toast-wrap { left: 12px; right: 12px; max-width: none; }
}
