/* Kids rewards + collectibles styling.
   rv-*   : a single reward medallion (placeholder visual resolved from ImageKey).
   cele-* : the reward-earned celebration overlay (CSS-only confetti, kid-safe).
   coll-* : the "My Collection" page (earned rewards + not-yet-earned silhouettes).
   In-brand: unQbd blue #00B4FF, orange #FFAA00, with brighter kid-friendly accents.
   No streak-loss pressure, no timers, no leaderboards anywhere. */

/* ---------- Reward medallion (placeholder visual) ---------- */
.rv-badge {
    --rv-color: #00B4FF;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 28%, #ffffff 0%, var(--rv-color) 78%);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14), inset 0 -4px 8px rgba(0, 0, 0, 0.12);
    border: 3px solid #ffffff;
}

.rv-badge i {
    font-size: 2.2rem;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* Real Sam's-world art (when present for the ImageKey): fills the medallion and inherits its
   circular clip + white ring, so it scales with every .rv-badge size (collection, coding, the
   celebration). A transparent sticker PNG sits over the brand-color backing. */
.rv-badge .rv-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Not-yet-earned: a muted silhouette that still pulls the child forward. */
.rv-badge.rv-locked {
    background: #e5e9ef;
    color: #aab4c2;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
    border-color: #f1f4f8;
}

/* ---------- Celebration overlay ----------
   The celebration is token-driven (the --cele-* layer below) so the kid sticker variant and dark
   mode re-theme by re-pointing tokens, no per-rule hex. Light is primary. */
:root {
    --cele-card: #ffffff;
    --cele-soft: #F2F8FE;
    --cele-ink: #173049;
    --cele-muted: #4b5563;
    --cele-blue: #00B4FF;
    --cele-blue-deep: #0098db;
    --cele-orange: #FFAA00;
    --cele-green: #2FBF71;
    --cele-green-tint: #e7faf0;
    --cele-line: #D7E7F5;
    --cele-on-accent: #ffffff;
    --cele-overlay-bg: rgba(13, 28, 45, 0.55);

    /* Collection page (coll-) token layer; mirrors the --pg-*/--cele- convention so the page is
       token-driven (no stray hex) and dark mode re-themes by re-pointing these below. */
    --coll-blue: #00B4FF;
    --coll-blue-light: #4fd0ff;
    --coll-blue-deep: #0098db;
    --coll-blue-ink: #0090cc;
    --coll-orange: #FFAA00;
    --coll-orange-light: #ffc94d;
    --coll-green: #2FBF71;
    --coll-green-light: #6bdd9f;
    /* Ink + muted + meta kept at the master hexes so the SHARED coding (non-kid) variant is
       appearance-identical; dark mode still re-themes via body.dark-mode below. */
    --coll-ink: #111827;
    --coll-muted: #4b5563;
    --coll-meta: #6b7280;
    --coll-soft: #EAF4FE;
    --coll-card: #ffffff;
    --coll-line: #D7E7F5;
    --coll-on-accent: #ffffff;
    --coll-chip-bg: rgba(0, 180, 255, 0.12);
    --coll-chip-ink: #0090cc;
    /* Section-header icon tints (kid trophy case); blue reuses the chip tokens above. */
    --coll-orange-bg: rgba(255, 170, 0, 0.14);
    --coll-orange-ink: #b97400;
    --coll-green-bg: rgba(47, 191, 113, 0.14);
    --coll-green-ink: #1c7a47;
    --coll-locked-bg: #fafbfc;
    --coll-locked-line: #D7E7F5;
    --coll-shadow-sm: 0 2px 8px rgba(23, 48, 73, 0.06);
    --coll-shadow: 0 14px 40px rgba(23, 48, 73, 0.08);
}

.cele-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--cele-overlay-bg);
    animation: cele-fade 0.2s ease;
}

@keyframes cele-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cele-card {
    position: relative;
    overflow: hidden;
    width: min(92vw, 360px);
    background: var(--cele-card);
    border-radius: 24px;
    padding: 1.75rem 1.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
    animation: cele-pop 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes cele-pop {
    from { transform: scale(0.82); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.cele-eyebrow {
    margin: 0 0 0.25rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--cele-orange);
}

/* The kids sticker celebration uses the blue eyebrow from the approved design. */
.cele-eyebrow-kid { color: var(--cele-blue); letter-spacing: 0.1em; }

.cele-title {
    margin: 0 0 1rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--cele-ink);
}

.cele-card-kid .cele-title { margin-bottom: 0.4rem; }

.cele-visual {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.cele-visual .rv-badge {
    width: 104px;
    height: 104px;
    animation: cele-bob 1.6s ease-in-out infinite;
}

.cele-visual .rv-badge i { font-size: 2.8rem; }

@keyframes cele-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.cele-desc {
    margin: 0 0 1.25rem;
    color: var(--cele-muted);
    font-size: 1rem;
    line-height: 1.45;
}

/* The earned-sticker pill that surfaces the existing reward by name. */
.cele-earned {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--cele-green-tint);
    color: var(--cele-green);
    font-weight: 800;
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    margin: 0 0 1.1rem;
}

/* The "Your sticker set X of N collected" tray (reads the existing collection; display only). */
.cele-set {
    background: var(--cele-soft);
    border: 1px solid var(--cele-line);
    border-radius: 1.1rem;
    padding: 1rem 1.1rem;
    text-align: left;
    margin: 0 0 0.4rem;
}

.cele-set-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.cele-set-title { font-weight: 800; color: var(--cele-ink); font-size: 1rem; }
.cele-set-count { color: var(--cele-muted); font-size: 0.85rem; font-weight: 700; }

.cele-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.cele-slot {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
}

.cele-slot.is-earned { background: var(--cele-slot-color, var(--cele-blue)); }
.cele-slot.is-empty { background: transparent; border: 2px dashed var(--cele-line); }

.cele-btn {
    border: none;
    border-radius: 999px;
    padding: 0.7rem 2rem;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--cele-on-accent);
    background: var(--cele-blue);
    cursor: pointer;
}

.cele-btn:hover { background: var(--cele-blue-deep); }
.cele-btn:focus-visible { outline: 3px solid var(--cele-orange); outline-offset: 2px; }

/* A quiet "Back to games" link below the primary action in the kid celebration. */
.cele-backlink {
    display: inline-block;
    margin-top: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cele-muted);
    font-weight: 700;
    font-size: 0.95rem;
}

.cele-backlink:hover { text-decoration: underline; }
.cele-backlink:focus-visible { outline: 2px solid var(--cele-blue); outline-offset: 2px; }

/* ---------- Kid sticker celebration: desktop scale ----------
   The kids variant (.cele-card-kid) shows the celebration large to match the approved v3 desktop
   reference: a wider card, a big sticker, a large "You did it." heading, the earned pill, a roomy
   "Your sticker set X of N collected" tray laid out as an even grid, and a big Next button. Scoped
   to the kid card so the default reward card (coding/other) stays as-is. Color stays on the --cele-*
   token layer, so dark mode re-themes with no per-rule hex; sizes scale down on phones below. */
.cele-card.cele-card-kid {
    width: min(94vw, 560px);
    padding: 2.5rem 2.25rem 2rem;
}

.cele-card-kid .cele-eyebrow { font-size: 0.95rem; }
.cele-card-kid .cele-visual { margin-bottom: 1.5rem; }
.cele-card-kid .cele-visual .rv-badge { width: 152px; height: 152px; }
.cele-card-kid .cele-visual .rv-badge i { font-size: 4rem; }
.cele-card-kid .cele-title { font-size: 2.8rem; }
.cele-card-kid .cele-earned { font-size: 1.2rem; padding: 0.7rem 1.4rem; margin-bottom: 1.6rem; }
.cele-card-kid .cele-set { border-radius: 1.4rem; padding: 1.5rem 1.75rem; }
.cele-card-kid .cele-set-title { font-size: 1.25rem; }
.cele-card-kid .cele-set-count { font-size: 1rem; }
.cele-card-kid .cele-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; justify-items: center; }
.cele-card-kid .cele-slot { width: 3.2rem; height: 3.2rem; }
.cele-card-kid .cele-btn { font-size: 1.35rem; padding: 1.05rem 2.6rem; margin-top: 1rem; }
.cele-card-kid .cele-backlink { font-size: 1.05rem; margin-top: 0.75rem; }

/* Phones: keep the large celebration readable without overflowing a narrow card. */
@media (max-width: 560px) {
    .cele-card-kid .cele-title { font-size: 2.1rem; }
    .cele-card-kid .cele-visual .rv-badge { width: 120px; height: 120px; }
    .cele-card-kid .cele-visual .rv-badge i { font-size: 3.2rem; }
    .cele-card-kid .cele-slot { width: 2.6rem; height: 2.6rem; }
    .cele-card-kid .cele-btn { font-size: 1.15rem; padding: 0.85rem 2rem; }
}

/* CSS-only confetti: a handful of colored pieces that fall once. */
.cele-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cele-piece {
    position: absolute;
    top: -12px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.9;
    animation: cele-fall 1.5s ease-in forwards;
}

@keyframes cele-fall {
    to { transform: translateY(420px) rotate(540deg); opacity: 0; }
}

.cele-piece-0 { left: 10%; background: #00B4FF; animation-delay: 0s; }
.cele-piece-1 { left: 24%; background: #FFAA00; animation-delay: 0.12s; }
.cele-piece-2 { left: 38%; background: #2FBF71; animation-delay: 0.06s; }
.cele-piece-3 { left: 56%; background: #FF6B9D; animation-delay: 0.18s; }
.cele-piece-4 { left: 72%; background: #9B6BFF; animation-delay: 0.04s; }
.cele-piece-5 { left: 88%; background: #FF8A3D; animation-delay: 0.14s; }

@media (prefers-reduced-motion: reduce) {
    .cele-overlay, .cele-card, .cele-visual .rv-badge, .cele-piece {
        animation: none;
    }
    .cele-piece { display: none; }
}

/* Dark mode re-themes the celebration by re-pointing the --cele-* tokens (no per-rule hex).
   Gated on the app's body.dark-mode class (the app theme switch), not the OS color scheme,
   so light app mode stays light regardless of the OS setting. Mirrors the --brand-primary-light
   convention; light remains primary. The decorative confetti colors are intentionally
   palette-fixed and read on either background. */
body.dark-mode {
    --cele-card: #15293b;
    --cele-soft: #13283a;
    --cele-ink: #eaf4ff;
    --cele-muted: #9bb6cc;
    --cele-blue: var(--brand-primary-light, #4DB8FF);
    /* Hover lightens (rather than darkens) against the lighter dark-mode blue. */
    --cele-blue-deep: #6cc5ff;
    --cele-line: #26425a;
    --cele-green-tint: rgba(47, 191, 113, 0.22);
    --cele-overlay-bg: rgba(0, 0, 0, 0.6);

    /* Collection page dark tokens (fixes the prior light-cards-on-dark-body regression). */
    --coll-blue: var(--brand-primary-light, #4DB8FF);
    --coll-blue-light: #6cc5ff;
    --coll-blue-deep: #6cc5ff;
    --coll-blue-ink: #8fd2ff;
    --coll-ink: #eaf4ff;
    --coll-muted: #9bb6cc;
    --coll-meta: #9bb6cc;
    --coll-soft: #13283a;
    --coll-card: #15293b;
    --coll-line: #26425a;
    --coll-chip-bg: rgba(77, 184, 255, 0.18);
    --coll-chip-ink: #8fd2ff;
    --coll-orange-bg: rgba(255, 170, 0, 0.18);
    --coll-orange-ink: #ffc266;
    --coll-green-bg: rgba(47, 191, 113, 0.22);
    --coll-green-ink: #8fe3b4;
    --coll-locked-bg: #11202e;
    --coll-locked-line: #2a4660;
    --coll-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --coll-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

/* The not-yet-earned reward silhouette needs a dark-appropriate muted fill (the light-mode grays
   would glare as a near-white pill on the dark page). Scoped to body.dark-mode so light is unchanged. */
body.dark-mode .rv-badge.rv-locked {
    background: #1d3346;
    color: #51718c;
    border-color: #26425a;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ---------- Collection page (coll-) ----------
   Token-driven so dark mode re-themes via the --coll-* layer above (no per-rule hex). The kids
   trophy case opts into a full-width desktop layout via .coll-page-kid (footer below the fold,
   summary card, large reward grid) so the shared coding rewards view keeps its compact column.
   Layout + scale only; the collection data and earned/locked states are unchanged. */
.coll-page {
    max-width: 880px;
    margin: 0 auto;
    /* Clears the fixed top nav like the journey map does. */
    padding: 7rem 16px 64px;
    color: var(--coll-ink);
}

.coll-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-height: 50vh;
    justify-content: center;
    text-align: center;
    color: var(--coll-muted);
}

.coll-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--coll-line);
    border-top-color: var(--coll-blue);
    border-radius: 50%;
    animation: coll-spin 0.9s linear infinite;
}

@keyframes coll-spin { to { transform: rotate(360deg); } }

.coll-header {
    margin-bottom: 28px;
}

.coll-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 6px 4px;
    margin-bottom: 12px;
    color: var(--coll-blue);
    font-weight: 600;
    cursor: pointer;
}

.coll-back:hover { text-decoration: underline; }
.coll-back:focus-visible { outline: 2px solid var(--coll-blue); outline-offset: 2px; }

/* Header row: title block on the left, earned-summary on the right (a row only on the kid layout;
   a plain block on the coding layout so it stacks exactly as before). */
.coll-headrow {
    display: block;
}

.coll-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--coll-blue);
}

.coll-title {
    margin: 0 0 8px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--coll-ink);
}

.coll-sub {
    margin: 0;
    color: var(--coll-muted);
    font-size: 1.05rem;
}

.coll-count {
    display: inline-block;
    margin-top: 10px;
    background: var(--coll-chip-bg);
    color: var(--coll-chip-ink);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 999px;
}

/* Section header: the group title (with an icon tile on the kid case) plus an earned/total count. */
.coll-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 28px 0 12px;
}

/* Title group (icon tile + heading) on the left; the count sits opposite it. */
.coll-section-titlewrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

/* Section-header icon tile (kid trophy case only -- rendered only on the kid shell). Tints are
   token-driven; the blue default reuses the chip tokens. */
.coll-section-icon {
    flex: 0 0 auto;
    width: 2.6rem;
    height: 2.6rem;
    display: grid;
    place-items: center;
    border-radius: 0.8rem;
    font-size: 1.2rem;
    background: var(--coll-chip-bg);
    color: var(--coll-chip-ink);
}

.coll-section-icon-blue { background: var(--coll-chip-bg); color: var(--coll-chip-ink); }
.coll-section-icon-orange { background: var(--coll-orange-bg); color: var(--coll-orange-ink); }
.coll-section-icon-green { background: var(--coll-green-bg); color: var(--coll-green-ink); }

.coll-section-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--coll-ink);
}

.coll-section-count {
    flex: 0 0 auto;
    color: var(--coll-muted);
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--coll-card);
    border: 1px solid var(--coll-line);
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
}

.coll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.coll-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 16px 12px;
    background: var(--coll-card);
    border: 1px solid var(--coll-line);
    border-radius: 16px;
    box-shadow: var(--coll-shadow-sm);
}

.coll-item.is-locked { opacity: 0.8; background: var(--coll-locked-bg); }

.coll-item-name {
    font-weight: 700;
    color: var(--coll-ink);
    font-size: 0.95rem;
}

.coll-item.is-locked .coll-item-name { color: var(--coll-meta); }

.coll-item-meta {
    font-size: 0.78rem;
    color: var(--coll-meta);
}

.coll-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--coll-chip-bg);
    color: var(--coll-chip-ink);
}

/* ---------- Kid trophy case: full-width desktop layout ----------
   Wide container that fills the viewport so the footer is below the fold, an eyebrow + large
   title, the earned summary as a card on the right, larger section headers, and a roomy reward
   grid with earned (full color) vs not-yet-earned (dashed placeholder) cards. Scoped to
   .coll-page-kid so the shared coding rewards view keeps its compact column; scales down below.
   Color stays on the --coll-* token layer, so dark mode re-themes with no per-rule hex. */
.coll-page.coll-page-kid {
    max-width: 1200px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 7rem 2rem 3rem;
}

.coll-page-kid .coll-headrow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.coll-page-kid .coll-title { font-size: 3rem; font-weight: 900; }
.coll-page-kid .coll-sub { font-size: 1.3rem; max-width: 46rem; }

/* The earned summary becomes a big-number card on the right (the design's "{earned}/{total} rewards
   earned"). The earned/total numbers are unchanged; only the presentation differs from the pill. */
.coll-page-kid .coll-count {
    margin-top: 0;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: var(--coll-card);
    border: 1px solid var(--coll-line);
    padding: 1.1rem 1.6rem;
    border-radius: 18px;
    box-shadow: var(--coll-shadow-sm);
    white-space: nowrap;
    text-align: center;
}

.coll-count-num {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--coll-blue-ink);
}

.coll-count-total { color: var(--coll-meta); font-weight: 800; }

.coll-count-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--coll-meta);
}

.coll-page-kid .coll-section-title { font-size: 1.6rem; }
.coll-page-kid .coll-section-count { font-size: 0.95rem; }

.coll-page-kid .coll-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}

.coll-page-kid .coll-item {
    gap: 0.9rem;
    padding: 1.5rem 1rem;
    border-radius: 20px;
}

.coll-page-kid .coll-item-name { font-size: 1.15rem; }
.coll-page-kid .coll-item-meta { font-size: 0.9rem; }
.coll-page-kid .coll-chip { font-size: 0.85rem; padding: 0.3rem 0.8rem; }

/* Not-yet-earned cards read as dashed placeholders (the mockup's locked silhouette). */
.coll-page-kid .coll-item.is-locked {
    opacity: 1;
    background: transparent;
    border-style: dashed;
    border-color: var(--coll-locked-line);
    box-shadow: none;
}

@media (max-width: 900px) {
    .coll-page.coll-page-kid { padding-left: 1.5rem; padding-right: 1.5rem; }
    .coll-page-kid .coll-title { font-size: 2.3rem; }
    .coll-page-kid .coll-sub { font-size: 1.15rem; }
    .coll-page-kid .coll-section-title { font-size: 1.35rem; }
}

@media (max-width: 560px) {
    .coll-page { padding-top: 5rem; }
    .coll-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

    /* Kid layout returns to phone-friendly proportions (the desktop sizes would overflow). */
    .coll-page.coll-page-kid { padding: 5rem 1rem 3rem; }
    .coll-page-kid .coll-headrow { flex-direction: column; gap: 1rem; }
    .coll-page-kid .coll-count { align-self: flex-start; }
    .coll-page-kid .coll-title { font-size: 1.9rem; }
    .coll-page-kid .coll-sub { font-size: 1.05rem; }
    .coll-page-kid .coll-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ===================================================================
   Coding "My Rewards" (.cjr-*)
   The adult coding rewards VIEW (the approved design): a developer-styled header with a
   "badges unlocked" summary card, a Badges grid (earned + not-yet-earned), and a Certificates grid
   (gold earned cards / dashed locked cards). Badges + a completion certificate only -- no
   collectibles. Used ONLY for the !IsKidShell branch of RewardCollection.razor; the kid trophy case
   (.coll-page-kid) is untouched. All color/elevation lives on the --cjr-* token layer (light :root +
   the dark body.dark-mode block below) so component rules stay token-driven (no stray hex) and dark
   mode re-themes by re-pointing tokens; the dark-mode wiring guard (KidsDarkModeCssWiringTests) scans
   this file for the body.dark-mode gate and the absence of an OS color-scheme media query. */
:root {
    --cjr-blue: var(--brand-primary, #00B4FF);
    --cjr-blue-deep: var(--brand-secondary, #0174B1);
    --cjr-blue-soft: rgba(0, 180, 255, 0.12);
    --cjr-green: #17B26A;
    --cjr-gold: #FFAA00;
    --cjr-gold-deep: #E89600;
    --cjr-gold-soft: rgba(255, 170, 0, 0.14);

    --cjr-ink: #222222;
    --cjr-text-2: #475569;
    --cjr-text-3: #64748B;
    --cjr-surface: #ffffff;
    --cjr-surface-2: #F8FAFC;
    --cjr-border: #E5EAF0;
    --cjr-dashed: #CBD3DC;
    --cjr-locked-fg: #94A3B2;
    --cjr-on-accent: #ffffff;
    --cjr-shadow-card: 0 2px 10px rgba(2, 6, 23, 0.06);
    --cjr-shadow-hover: 0 12px 30px rgba(2, 6, 23, 0.10);
    --cjr-mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

.coll-page.coll-page-coding {
    max-width: 1140px;
    padding: 7rem 24px 72px;
    color: var(--cjr-ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.cjr-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 6px 2px;
    margin-bottom: 18px;
    font-family: var(--cjr-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--cjr-text-2);
    cursor: pointer;
}

.cjr-back:hover { color: var(--cjr-blue-deep); text-decoration: underline; }
.cjr-back:focus-visible { outline: 2px solid var(--cjr-blue); outline-offset: 2px; border-radius: 6px; }

.cjr-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.cjr-head-text { min-width: 0; }

.cjr-eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    font-family: var(--cjr-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--cjr-blue-deep);
    background: var(--cjr-blue-soft);
    padding: 6px 12px;
    border-radius: 8px;
}

.cjr-title {
    margin: 0 0 10px;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--cjr-ink);
}

.cjr-sub { margin: 0; font-size: 1.05rem; color: var(--cjr-text-2); max-width: 560px; }

.cjr-stat-card {
    flex: 0 0 auto;
    text-align: center;
    background: var(--cjr-surface);
    border: 1px solid var(--cjr-border);
    border-radius: 14px;
    padding: 16px 22px;
    box-shadow: var(--cjr-shadow-card);
}

.cjr-stat-num { font-family: var(--cjr-mono); font-size: 1.9rem; font-weight: 700; color: var(--cjr-blue-deep); }
.cjr-stat-total { color: var(--cjr-text-3); }
.cjr-stat-label { font-size: 0.75rem; font-weight: 600; color: var(--cjr-text-3); }

.cjr-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 40px 0 18px;
}

.cjr-section-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-size: 1.3rem;
    background: var(--cjr-blue-soft);
    color: var(--cjr-blue-deep);
}

.cjr-section-icon-gold { background: var(--cjr-gold-soft); color: var(--cjr-gold-deep); }

.cjr-section-title { margin: 0; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; color: var(--cjr-ink); }

.cjr-section-count {
    font-family: var(--cjr-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cjr-text-3);
    background: var(--cjr-surface);
    border: 1px solid var(--cjr-border);
    padding: 6px 12px;
    border-radius: 8px;
}

/* Badges */
.cjr-badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.cjr-badge {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--cjr-surface);
    border: 1px solid var(--cjr-border);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: var(--cjr-shadow-card);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cjr-badge.is-earned:hover { transform: translateY(-3px); box-shadow: var(--cjr-shadow-hover); }
.cjr-badge.is-locked { background: var(--cjr-surface-2); border-style: dashed; border-color: var(--cjr-dashed); box-shadow: none; }

/* Size the shared reward medallion down to the card scale. */
.cjr-badge .rv-badge { width: 54px; height: 54px; flex: 0 0 auto; }
.cjr-badge .rv-badge i { font-size: 1.6rem; }

.cjr-badge-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cjr-badge-name { font-size: 0.95rem; font-weight: 700; color: var(--cjr-ink); line-height: 1.25; }
.cjr-badge.is-locked .cjr-badge-name { color: var(--cjr-text-3); font-weight: 600; }

.cjr-badge-state { display: inline-flex; align-items: center; gap: 4px; font-family: var(--cjr-mono); font-size: 0.72rem; font-weight: 600; }
.cjr-state-earned { color: var(--cjr-green); }
.cjr-state-locked { color: var(--cjr-locked-fg); }

/* Certificates */
.cjr-cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.cjr-cert {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 24px;
}

.cjr-cert.is-earned {
    background: linear-gradient(150deg, var(--cjr-gold), var(--cjr-gold-deep));
    color: var(--cjr-on-accent);
    box-shadow: 0 14px 30px rgba(255, 170, 0, 0.28);
}

.cjr-cert.is-locked {
    background: var(--cjr-surface-2);
    border: 1.5px dashed var(--cjr-dashed);
    color: var(--cjr-text-3);
}

.cjr-cert-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cjr-cert-seal { font-size: 2.2rem; }
.cjr-cert.is-locked .cjr-cert-seal { color: var(--cjr-locked-fg); }

.cjr-cert-flag {
    font-family: var(--cjr-mono);
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 7px;
}

.cjr-cert-name { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; }
.cjr-cert.is-locked .cjr-cert-name { color: var(--cjr-text-2); font-weight: 700; }
.cjr-cert-meta { margin: 0; font-size: 0.9rem; opacity: 0.92; }

@media (max-width: 760px) {
    .coll-page.coll-page-coding { padding: 6rem 16px 56px; }
    .cjr-title { font-size: 1.9rem; }
    .cjr-stat-card { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .cjr-badge { transition: none; }
}

/* Dark mode re-themes the coding rewards view by re-pointing the --cjr-* token layer (no per-rule
   hex). Gated on the app's body.dark-mode class (NOT the OS color scheme) so light app mode stays
   light. Accents follow the --brand-primary-light convention for contrast; the earned certificate
   keeps its fixed gold gradient + white text (only deepening its shadow) in both themes. */
body.dark-mode {
    --cjr-blue: var(--brand-primary-light, #4DB8FF);
    --cjr-blue-deep: #8fd2ff;
    --cjr-blue-soft: rgba(77, 184, 255, 0.16);
    --cjr-green: #6fe3a6;
    --cjr-gold: #FFAA00;
    --cjr-gold-deep: #E89600;
    --cjr-gold-soft: rgba(255, 170, 0, 0.18);

    --cjr-ink: #F1F5F9;
    --cjr-text-2: #CBD3DC;
    --cjr-text-3: #94A3B2;
    --cjr-surface: #19212C;
    --cjr-surface-2: #141B24;
    --cjr-border: rgba(255, 255, 255, 0.10);
    --cjr-dashed: rgba(255, 255, 255, 0.20);
    --cjr-locked-fg: #7C8BA0;
    --cjr-shadow-card: 0 2px 12px rgba(0, 0, 0, 0.45);
    --cjr-shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.55);
}
