/* ═══════════════════════════════════════════════════════════════════
   LEADERBOARD + HOME POLISH + STREAK CEREMONY  (uipolish batch)

   Owns:
     1. lb2-*  — the Hall of Sovereigns podium (home preview AND the
                 full leaderboard screen — one language, both hosts).
     2. lbx-*  — the full-leaderboard ranking rows + column header +
                 pinned "you" row.
     3. sflame — the house SVG flame used in the streak pill (replaces
                 the 🔥 emoji; SVG is injected by app.js).
     4. daily-ceremony — full-screen stage for the claimDaily lodge
                 ceremony (FYM.Juice plaque + coin fountain + rollup).
     5. lw-*   — live-wins marquee item polish on home.

   Loaded AFTER obsidian-vault.css (link lives in the leaderboard
   screen block of index.html) so it wins the cascade without
   !important wars. New class namespaces avoid the old body.ov
   #home-screen utility scoping entirely — which is also what fixes
   the previously-broken podium on the leaderboard screen (the old
   grid classes were scoped to #home-screen only).
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1 · PODIUM ──────────────────────────────────────────────────── */

.lb2-podium {
    display: grid;
    grid-template-columns: 1fr 1.18fr 1fr;
    align-items: end;
    gap: 10px;
    padding: 40px 4px 4px;
}

.lb2-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    opacity: 0;                         /* staggered entrance below */
    -webkit-tap-highlight-color: transparent;
}
.lb2-tile.lb2-in { animation: lb2-rise 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.lb2-tile[data-rank="2"].lb2-in { animation-delay: 60ms; }
.lb2-tile[data-rank="1"].lb2-in { animation-delay: 180ms; }
.lb2-tile[data-rank="3"].lb2-in { animation-delay: 300ms; }
@keyframes lb2-rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Champion light — a soft radial halo + rising beam behind #1 only.
   Elevation by LIGHT, not by a giant flat slab. */
.lb2-halo {
    position: absolute;
    top: -34px;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side,
        rgba(242, 202, 80, 0.26) 0%,
        rgba(242, 202, 80, 0.10) 45%,
        transparent 72%);
    pointer-events: none;
    z-index: 0;
    animation: lb2-halo-breathe 4.2s ease-in-out infinite;
}
@keyframes lb2-halo-breathe {
    0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
    50%      { opacity: 1;    transform: translateX(-50%) scale(1.06); }
}

/* Avatar — gold-ringed frame. Ring is a conic "metal" gradient so it
   reads as turned brass, with an inner dark gap ring for depth. */
.lb2-ava {
    position: relative;
    z-index: 1;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(from 215deg,
        #8a6a2c 0%, #d9b45e 12%, #fff3c4 24%, #d9b45e 38%,
        #8a6a2c 52%, #b98f3e 66%, #f2ca50 82%, #8a6a2c 100%);
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(20, 16, 8, 0.9),
        inset 0 0 0 1px rgba(255, 243, 196, 0.35);
}
.lb2-tile[data-rank="1"] .lb2-ava {
    width: 84px;
    height: 84px;
    padding: 4px;
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.6),
        0 0 24px rgba(242, 202, 80, 0.30),
        0 0 0 1px rgba(20, 16, 8, 0.9),
        inset 0 0 0 1px rgba(255, 243, 196, 0.45);
}
.lb2-tile[data-rank="2"] .lb2-ava {
    background: conic-gradient(from 215deg,
        #5c6068 0%, #b9bec9 14%, #f2f4f8 26%, #b9bec9 40%,
        #5c6068 54%, #8a8f99 68%, #d7dbe2 84%, #5c6068 100%);
}
.lb2-tile[data-rank="3"] .lb2-ava {
    background: conic-gradient(from 215deg,
        #5c3c1c 0%, #b0793f 14%, #f0c9a0 26%, #b0793f 40%,
        #5c3c1c 54%, #8a5c2c 68%, #d9a76a 84%, #5c3c1c 100%);
}
.lb2-ava img,
.lb2-ava-fb {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #0e0d0a;          /* dark gap between metal + photo */
    box-sizing: border-box;
}
.lb2-ava-fb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(120% 120% at 30% 22%,
        #2e2a20 0%, #191612 58%, #0b0a08 100%);
    color: #e9c349;
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.lb2-tile[data-rank="1"] .lb2-ava-fb { font-size: 32px; }

/* Medal emblem — overlaps the avatar's lower-right. SVG built in
   app.js (_lbMedalSVG) with radial gradients + key light. */
.lb2-medal {
    position: absolute;
    right: -8px;
    bottom: -7px;
    width: 27px;
    height: 27px;
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
    pointer-events: none;
}
.lb2-tile[data-rank="1"] .lb2-medal { width: 34px; height: 34px; right: -9px; bottom: -8px; }
.lb2-medal svg { display: block; width: 100%; height: 100%; }

/* Laurel crown — sits behind/above the champion avatar. */
.lb2-laurel {
    position: absolute;
    top: -26px;
    left: 50%;
    width: 118px;
    height: 44px;
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.lb2-laurel svg { display: block; width: 100%; height: 100%; }

/* Name + context line */
.lb2-name {
    margin-top: 12px;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #d1c5b2;
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
.lb2-tile[data-rank="1"] .lb2-name {
    color: #f2ca50;
    font-size: 12px;
    max-width: 124px;
    text-shadow: 0 0 14px rgba(242, 202, 80, 0.35);
}
.lb2-ctx {
    margin-top: 4px;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #8f8672;
    white-space: nowrap;
}
.lb2-ctx b { font-weight: 700; }

/* Plinth — the podium step. Gradients fade to nothing instead of a
   solid slab; a bright top edge + etched numeral carry the rank. */
.lb2-plinth {
    position: relative;
    width: 100%;
    margin-top: 12px;
    border-radius: 5px 5px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    overflow: hidden;
}
.lb2-tile[data-rank="1"] .lb2-plinth {
    height: 96px;
    background: linear-gradient(180deg,
        rgba(242, 202, 80, 0.30) 0%,
        rgba(190, 148, 48, 0.12) 52%,
        rgba(20, 17, 10, 0) 100%);
    border-top: 1px solid rgba(255, 236, 170, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.lb2-tile[data-rank="2"] .lb2-plinth {
    height: 64px;
    background: linear-gradient(180deg,
        rgba(209, 197, 178, 0.16) 0%,
        rgba(209, 197, 178, 0.05) 55%,
        rgba(20, 17, 10, 0) 100%);
    border-top: 1px solid rgba(230, 224, 210, 0.55);
}
.lb2-tile[data-rank="3"] .lb2-plinth {
    height: 50px;
    background: linear-gradient(180deg,
        rgba(197, 146, 74, 0.16) 0%,
        rgba(197, 146, 74, 0.05) 55%,
        rgba(20, 17, 10, 0) 100%);
    border-top: 1px solid rgba(222, 178, 120, 0.55);
}
/* Etched rank numeral inside the plinth */
.lb2-plinth-num {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 52px;
    line-height: 1;
    color: rgba(233, 195, 73, 0.10);
    pointer-events: none;
    user-select: none;
}
.lb2-tile[data-rank="2"] .lb2-plinth-num { color: rgba(209, 197, 178, 0.09); font-size: 40px; }
.lb2-tile[data-rank="3"] .lb2-plinth-num { color: rgba(197, 146, 74, 0.10); font-size: 36px; }

.lb2-val {
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 19px;
    line-height: 1.1;
    color: #e9c349;
    font-variant-numeric: tabular-nums;
    z-index: 1;
}
.lb2-tile[data-rank="1"] .lb2-val {
    font-size: 25px;
    color: #ffe9a1;
    text-shadow: 0 0 18px rgba(242, 202, 80, 0.5);
}
.lb2-tile[data-rank="2"] .lb2-val { color: #d1c5b2; }
.lb2-tile[data-rank="3"] .lb2-val { color: #d9a76a; }
.lb2-val-label {
    margin-top: 3px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(209, 197, 178, 0.55);
    z-index: 1;
}
.lb2-tile[data-rank="1"] .lb2-val-label { color: rgba(255, 236, 170, 0.6); }

.lb2-empty { min-height: 1px; }
.lb2-podium-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: #a39a84;
    font-style: italic;
    padding: 32px 0;
}

@media (min-width: 768px) {
    .lb2-podium { gap: 18px; padding-top: 52px; }
    .lb2-ava { width: 76px; height: 76px; }
    .lb2-tile[data-rank="1"] .lb2-ava { width: 104px; height: 104px; }
    .lb2-tile[data-rank="1"] .lb2-plinth { height: 120px; }
    .lb2-tile[data-rank="2"] .lb2-plinth { height: 82px; }
    .lb2-tile[data-rank="3"] .lb2-plinth { height: 64px; }
    .lb2-name { font-size: 12px; max-width: 150px; }
    .lb2-tile[data-rank="1"] .lb2-name { font-size: 13px; max-width: 170px; }
}

/* ── 2 · FULL LIST — column header + rows + "you" row ───────────── */

.lbx-colhead {
    display: grid;
    /* Mirrors .lbx-row: 34px rank cell, then member (avatar+meta
       merge under one "Member" heading), then the value column. */
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #8f8672;
    border-top: 1px solid rgba(78, 70, 57, 0.18);
    border-bottom: 1px solid rgba(78, 70, 57, 0.18);
}
.lbx-colhead .lbx-col-val { text-align: right; }

.lbx-row {
    display: grid;
    grid-template-columns: 34px 40px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(78, 70, 57, 0.10);
    cursor: pointer;
    transition: background 150ms ease;
    opacity: 0;
    animation: lb2-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--lbx-i, 0) * 40ms);
    -webkit-tap-highlight-color: transparent;
}
.lbx-row:hover { background: rgba(233, 195, 73, 0.045); }
.lbx-row.lbx-top {
    background: linear-gradient(90deg, rgba(233, 195, 73, 0.055), transparent 65%);
}

.lbx-rank {
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 15px;
    color: rgba(233, 195, 73, 0.6);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.lbx-rank-medal { width: 26px; height: 26px; margin: 0 auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.lbx-rank-medal svg { display: block; width: 100%; height: 100%; }

.lbx-ava {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(from 215deg,
        #6d5424 0%, #c5a655 20%, #f4e0a4 30%, #c5a655 45%,
        #6d5424 60%, #a5873c 78%, #6d5424 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.lbx-ava img,
.lbx-ava-fb {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #0e0d0a;
    box-sizing: border-box;
}
.lbx-ava-fb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(120% 120% at 30% 22%, #2a2720 0%, #16140f 60%, #0b0a08 100%);
    color: #e9c349;
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 15px;
}

.lbx-meta { min-width: 0; }
.lbx-name {
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e5e2e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lbx-ctx {
    margin-top: 2px;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #8f8672;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lbx-valcol { text-align: right; }
.lbx-val {
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 15px;
    color: #e9c349;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.lbx-val-sub {
    margin-top: 1px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(209, 197, 178, 0.45);
}

/* "YOU" chip when the player is inside the top N */
.lbx-you-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px 2px;
    border-radius: 999px;
    background: rgba(233, 195, 73, 0.14);
    border: 1px solid rgba(233, 195, 73, 0.4);
    color: #f2ca50;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    vertical-align: 2px;
}
.lbx-row.lbx-you {
    background: linear-gradient(90deg, rgba(233, 195, 73, 0.10), rgba(233, 195, 73, 0.02));
    border-top: 1px solid rgba(233, 195, 73, 0.35);
    border-bottom: 1px solid rgba(233, 195, 73, 0.35);
}

/* Pinned self row when the player is OUTSIDE the top N — sticks just
   above the bottom nav (72px bar + breathing room). */
.lbx-row.lbx-you-pinned {
    position: sticky;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    z-index: 5;
    margin-top: 8px;
    border-radius: 6px;
    background: linear-gradient(180deg, #241f12 0%, #171310 100%);
    border: 1px solid rgba(233, 195, 73, 0.45);
    box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.55), 0 0 18px rgba(233, 195, 73, 0.12);
    animation-delay: 0ms;
}
.lbx-row.lbx-you-pinned .lbx-rank { color: #f2ca50; font-size: 12px; }

.lbx-msg {
    text-align: center;
    color: #a39a84;
    font-style: italic;
    font-size: 13px;
    padding: 28px 0;
}

/* Category tabs — lodge pills. Overrides the near-invisible
   obsidian-vault treatment (id selector beats its 3-class scope). */
body.ov #leaderboard-screen .ov-lb-tab {
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #a39a84;
    background: rgba(233, 195, 73, 0.05);
    border: 1px solid rgba(233, 195, 73, 0.28);
    transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
    white-space: nowrap;
    cursor: pointer;
}
body.ov #leaderboard-screen .ov-lb-tab:hover {
    color: #e5e2e1;
    border-color: rgba(233, 195, 73, 0.4);
}
body.ov #leaderboard-screen .ov-lb-tab.is-active,
body.ov #leaderboard-screen .ov-lb-tab.active {
    color: #2c2100;
    background: linear-gradient(160deg, #f4d97c 0%, #e9c349 45%, #c5a12a 100%);
    border-color: rgba(255, 243, 196, 0.7);
    box-shadow: 0 2px 10px rgba(233, 195, 73, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* ── 3 · STREAK PILL FLAME (SVG replaces 🔥) ────────────────────── */

.streak-count-flame .sflame {
    display: block;
    width: 15px;
    height: 19px;
    filter: drop-shadow(0 0 6px rgba(255, 150, 60, 0.5));
}
.streak-count-badge.is-zero .streak-count-flame .sflame {
    filter: grayscale(0.85) opacity(0.45);
}
/* Gentle candle-sway on an active streak */
.streak-count-badge:not(.is-zero) .streak-count-flame .sflame {
    animation: sflame-sway 2.8s ease-in-out infinite;
    transform-origin: 50% 92%;
}
@keyframes sflame-sway {
    0%, 100% { transform: rotate(-2.5deg) scaleY(1); }
    50%      { transform: rotate(2.5deg) scaleY(1.05); }
}

/* ── 4 · DAILY CLAIM CEREMONY (FYM.Juice stage) ─────────────────── */

.daily-ceremony {
    position: fixed;
    inset: 0;
    z-index: 1400;
}
.daily-ceremony::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 100% at 50% 28%,
        rgba(26, 20, 8, 0.55) 0%,
        rgba(6, 5, 2, 0.80) 100%);
    opacity: 0;
    transition: opacity 240ms ease-out;
}
.daily-ceremony.is-on::before { opacity: 1; }
.daily-ceremony.is-out {
    opacity: 0;
    transition: opacity 280ms ease-in;
    pointer-events: none;
}
/* On the full-screen stage the plaque sits in the upper third
   (platform.css default is top:12px — tuned for game stages). */
.daily-ceremony .fym-plaque { top: 19vh; }
/* Ceremony eyebrow above the plaque */
.daily-ceremony-kicker {
    position: absolute;
    top: calc(19vh - 30px);
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: rgba(209, 197, 178, 0.6);
    opacity: 0;
    transition: opacity 400ms ease-out 250ms;
    pointer-events: none;
}
.daily-ceremony.is-on .daily-ceremony-kicker { opacity: 1; }
/* Skip affordance */
.daily-ceremony-skip {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(209, 197, 178, 0.35);
    opacity: 0;
    transition: opacity 400ms ease-out 900ms;
    pointer-events: none;
}
.daily-ceremony.is-on .daily-ceremony-skip { opacity: 1; }

/* ── 5 · LIVE-WINS MARQUEE ITEMS ────────────────────────────────── */

#live-wins-feed .lw-item {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    cursor: pointer;
}
#live-wins-feed .lw-pulse {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #e9c349;
    box-shadow: 0 0 6px rgba(233, 195, 73, 0.85);
    animation: lw-pulse 1.8s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes lw-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}
#live-wins-feed .lw-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e5e2e1;
}
#live-wins-feed .lw-won {
    font-size: 11px;
    color: #8f8672;
}
#live-wins-feed .lw-amt {
    font-family: var(--font-display, Georgia, serif);
    font-style: italic;
    font-weight: 700;
    font-size: 13px;
    color: #e9c349;
    font-variant-numeric: tabular-nums;
}
#live-wins-feed .lw-game {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(209, 197, 178, 0.5);
}
#live-wins-feed .lw-sep {
    /* The feed container already applies gap-8 (32px) between
       children — no extra margin needed. */
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(233, 195, 73, 0.35);
    flex-shrink: 0;
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .lb2-tile, .lbx-row { opacity: 1; animation: none; }
    .lb2-halo, #live-wins-feed .lw-pulse,
    .streak-count-badge:not(.is-zero) .streak-count-flame .sflame { animation: none; }
}
