/* ==========================================================================
   NEXTBALL — Challenges (home widget, challenges modal, claim moment, post-match line)
   Flat, one accent; tokens from arena.css. Markup: challenges.js
   ========================================================================== */

/* ---- shared bits ---- */
.ch-kicker { font: 700 10px/1 var(--f-display); letter-spacing: .18em; text-transform: uppercase; color: var(--fg-2); }
.ch-kicker--accent { color: var(--orange); }
.ch-set { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 2px; font: 700 9px/1 var(--f-display); letter-spacing: .14em; text-transform: uppercase; background: var(--bg-3); color: var(--fg-1); flex: none; }
.ch-set--daily { background: rgba(255, 106, 19, .16); color: var(--orange-hi); }
.ch-set--weekly { background: rgba(46, 123, 224, .2); color: #8FBDF5; }
.ch-set--season { background: rgba(228, 177, 58, .18); color: var(--gold-hi); }

.ch-prog { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ch-prog-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.ch-prog-bar i { position: absolute; inset: 0 auto 0 0; background: var(--orange); border-radius: 3px; transition: width 600ms cubic-bezier(.2, .8, .2, 1); }
.ch-prog-num { font: 700 12px/1 var(--f-display); color: var(--fg-1); font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; }
.ch-prog-num b { color: var(--fg-0); font-size: 1.25em; }
.ch-prog--big .ch-prog-bar { height: 8px; border-radius: 4px; }

.ch-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 3px; background: var(--bg-3); font: 600 11px/1 var(--f-body); color: var(--fg-2); white-space: nowrap; }
.ch-chip b { font: 700 13px/1 var(--f-display); color: var(--fg-0); font-variant-numeric: tabular-nums; }
.ch-chip--xp b { color: var(--orange-hi); }
.ch-chip--coin b { color: var(--gold); }
.ch-chip .cos-coin, .ch-final-coins .cos-coin, .ch-fx-coins .cos-coin { width: 12px; height: 12px; }
.ch-reward { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.ch-check { width: 14px; height: 14px; flex: none; }
.ch-lock { width: 11px; height: 11px; flex: none; }

.ch-claim { height: 32px; padding: 0 16px; border: 0; border-radius: var(--r); background: var(--orange); color: var(--orange-ink); font: 700 12px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; transition: background var(--t-fast), transform var(--t-fast); animation: ch-claim-pulse 2.4s ease-in-out infinite; }
.ch-claim:hover { background: var(--orange-hi); }
.ch-claim:active { transform: translateY(1px); }
.ch-claim:disabled { opacity: .6; cursor: default; animation: none; }
.ch-claim--wide { width: 100%; height: 38px; }
@keyframes ch-claim-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 106, 19, 0); } 50% { box-shadow: 0 0 0 4px rgba(255, 106, 19, .22); } }
.ch-status { display: inline-flex; align-items: center; gap: 6px; height: 20px; font: 700 11px/1 var(--f-display); letter-spacing: .12em; text-transform: uppercase; }
.ch-status--done { color: var(--ok); }
.ch-status--claimed { color: var(--fg-3); }
.ch-status--locked { color: var(--fg-3); letter-spacing: .08em; }

/* --------------------------------------------------------------------------
   Home widget (between the live strip and the Top players / My stats row)
   -------------------------------------------------------------------------- */
.ch-widget { display: grid; grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) auto; align-items: center; gap: 12px 18px; margin: 0; padding: 14px 18px; background: var(--bg-1); border-radius: var(--r-lg); }
.ch-widget.hidden { display: none !important; }
.ch-w-head { display: grid; gap: 7px; min-width: 0; }
.ch-w-head h3 { margin: 0; font: 700 12px/1 var(--f-body) !important; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-2) !important; font-style: normal !important; }
.ch-w-sub { display: grid; gap: 2px; font: 600 12px/1.35 var(--f-body); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.ch-w-sub b { color: var(--fg-1); font-weight: 700; }
.ch-w-sub--guest { color: var(--orange-hi); }
.ch-w-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.ch-w-item { display: grid; gap: 9px; min-width: 0; padding: 10px 12px; border: 0; border-radius: var(--r); background: var(--bg-2); color: inherit; text-align: left; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color var(--t), background var(--t-fast); }
.ch-w-item:hover { outline-color: rgba(255, 255, 255, .35); }
.ch-w-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ch-w-name { font: 600 13px/1.2 var(--f-body); color: var(--fg-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-w-empty { grid-column: 1 / -1; font: 600 13px/1.3 var(--f-body); color: var(--fg-2); padding: 10px 0; }
.ch-w-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: var(--r); background: transparent; color: var(--fg-0); font: 700 12px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast); }
.ch-w-btn:hover { background: var(--bg-3); border-color: rgba(255, 255, 255, .3); }
.ch-w-btn.has-claim { border-color: var(--orange); }
.ch-w-claim { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: var(--orange-ink); font: 800 11px/1 var(--f-display); letter-spacing: 0; animation: ch-claim-pulse 2.4s ease-in-out infinite; }
body.is-offline .ch-widget { display: none !important; }

@media (max-width: 1100px) {
    .ch-widget { grid-template-columns: minmax(0, 1fr) auto; }
    .ch-w-items { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 1100px) {
    .ch-w-sub { display: flex; flex-wrap: wrap; gap: 2px 12px; }
}
@media (max-width: 640px) {
    .ch-widget { padding: 12px 12px 12px 14px; gap: 10px 12px; }
    .ch-w-items { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .ch-w-btn { height: 36px; padding: 0 12px; font-size: 11px; }
    .ch-w-sub { font-size: 11px; }
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
#challenges-modal { z-index: 1000; }
.ch-panel { position: relative; width: min(1080px, calc(100vw - 32px)); max-width: none; height: min(780px, calc(100dvh - 48px)); display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0 !important; }
.ch-panel .modal-header { margin-bottom: 0; }
.ch-guest { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; padding: 12px 14px; background: var(--bg-2); border-left: 3px solid var(--orange); border-radius: 3px; }
.ch-guest.hidden { display: none; }
.ch-guest p { flex: 1; margin: 0; font: 500 13px/1.4 var(--f-body); color: var(--fg-1); }
.ch-tabs { display: flex; align-items: center; gap: 2px; margin: 12px 0 0; border-bottom: 1px solid var(--line-strong); }
.ch-tab { display: inline-flex; align-items: center; gap: 7px; }
.ch-tab-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.ch-tab-dot[hidden] { display: none; }
.ch-tabs-timer { margin-left: auto; padding: 0 2px 0 12px; font: 700 12px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-body { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -20px; padding: 16px 20px 20px; }
.ch-loading { padding: 40px 0; text-align: center; color: var(--fg-2); font: 600 14px var(--f-body); }
.ch-intro p { margin: 0 0 14px; font: 500 13px/1.45 var(--f-body); color: var(--fg-2); }

.ch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ch-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 96px; padding: 14px 14px 14px 18px; border-radius: var(--r); background: var(--bg-2); overflow: hidden; }
.ch-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--bg-4); }
.ch-card.is-completed::before { background: var(--orange); }
.ch-card.is-completed { background: linear-gradient(90deg, rgba(255, 106, 19, .10), var(--bg-2) 60%); }
.ch-card.is-claimed { background: var(--bg-2); opacity: .62; }
.ch-card.is-claimed::before { background: var(--ok); opacity: .6; }
.ch-card.is-locked { background: repeating-linear-gradient(135deg, var(--bg-2) 0 10px, #1E232B 10px 20px); }
.ch-card.is-locked .ch-card-title, .ch-card.is-locked .ch-card-desc { color: var(--fg-3); }
.ch-card.is-locked .ch-chip { opacity: .6; }
.ch-card-main { display: grid; gap: 6px; min-width: 0; }
.ch-card-title { margin: 0; font: 700 15px/1.1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-0); }
.ch-card-desc { margin: 0 0 4px; font: 500 13px/1.35 var(--f-body); color: var(--fg-2); }
.ch-card-side { display: grid; justify-items: end; gap: 8px; }

/* weekly bonus strip */
.ch-bonus { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto auto; align-items: center; gap: 16px; margin: 0 0 14px; padding: 12px 16px; border-radius: var(--r); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.ch-bonus.is-completed { box-shadow: inset 0 0 0 1px var(--orange); }
.ch-bonus-txt { display: grid; gap: 5px; }
.ch-bonus-txt b { font: 700 15px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-0); }
.ch-bonus .ch-status { justify-self: end; }

/* season */
.ch-season { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.ch-final { position: sticky; top: 0; display: grid; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--bg-2); }
.ch-final-title { margin: -4px 0 0; font: 700 20px/1.05 var(--f-display); letter-spacing: .02em; text-transform: uppercase; color: var(--fg-0); }
.ch-final-reward { display: grid; gap: 10px; padding: 12px; border-radius: 3px; background: var(--bg-1); }
.ch-final-reward > .ch-final-bg { height: 88px; }
.ch-final-row { display: flex; align-items: center; gap: 12px; }
.ch-final-bg { position: relative; display: block; height: 72px; border-radius: 3px; overflow: hidden; }
.ch-final-bg .cos-bg { position: absolute; inset: 0; }
.ch-final-fr { display: inline-flex; padding: 8px 6px 10px; }
.ch-final-fr .cos-av-wrap { width: 48px; height: 48px; }
.ch-final-fr .cos-av-wrap::before { background: var(--bg-1); }
.ch-final-fr .cos-av--initials { font-size: 17px; }
.ch-final-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font: 600 13px/1.3 var(--f-body); color: var(--fg-0); }
.ch-final-coins { display: inline-flex; align-items: center; gap: 6px; color: var(--gold) !important; font-family: var(--f-display) !important; font-weight: 700; }
.ch-final-note, .ch-final-hint { margin: 0; font: 500 12px/1.4 var(--f-body); color: var(--fg-3); }
.ch-final-hint { text-align: center; color: var(--fg-2); }
.ch-season-main { display: grid; gap: 12px; min-width: 0; }
.ch-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ch-stage { display: grid; gap: 6px; padding: 10px 12px; border: 0; border-radius: var(--r); background: var(--bg-2); color: var(--fg-1); text-align: left; cursor: pointer; box-shadow: inset 0 -2px 0 transparent; transition: background var(--t-fast), box-shadow var(--t-fast); }
.ch-stage:hover { background: var(--bg-3); }
.ch-stage.active { background: var(--bg-3); box-shadow: inset 0 -2px 0 var(--fg-0); color: var(--fg-0); }
.ch-stage-name { display: inline-flex; align-items: center; gap: 7px; font: 700 13px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; }
.ch-stage-meta { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1 var(--f-body); color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-stage.is-locked .ch-stage-name { color: var(--fg-2); }
.ch-stage.is-locked .ch-stage-meta { color: var(--fg-3); }
.ch-stage-lock { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); background: var(--bg-2); font: 500 13px/1.4 var(--f-body); color: var(--fg-2); }
.ch-stage-lock b { color: var(--fg-0); }
.ch-stage-lock .ch-lock { width: 14px; height: 14px; color: var(--fg-2); }
.ch-season .ch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* claim moment: docked card at the bottom of the modal, reuses the level panel */
.ch-fx { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 3; animation: ch-fx-in 360ms cubic-bezier(.2, .9, .25, 1.15) both; }
.ch-fx[hidden] { display: none; }
.ch-fx.is-out { animation: ch-fx-out 280ms ease-in both; }
@keyframes ch-fx-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ch-fx-out { to { opacity: 0; transform: translateY(12px); } }
.ch-fx-card { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; padding: 14px 16px 16px; border-radius: var(--r-lg); background: var(--bg-1); box-shadow: 0 0 0 1px var(--line-strong), 0 24px 60px -18px rgba(0, 0, 0, .9); }
.ch-fx-head { display: flex; align-items: center; gap: 10px; }
.ch-fx-head b { flex: 1; font: 700 16px/1.1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-fx-x { width: 28px; height: 28px; font-size: 18px; }
.ch-fx-xp .xp-panel { background: var(--bg-2); }
.ch-fx-extras { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-fx-coins { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 3px; background: var(--bg-2); font: 700 14px/1 var(--f-display); color: var(--gold); }
.ch-fx-item { display: inline-flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 3px; background: var(--bg-2); font: 700 13px/1.2 var(--f-body); color: var(--fg-0); }
.ch-fx-item small { display: block; font: 700 9px/1 var(--f-display); letter-spacing: .16em; text-transform: uppercase; color: var(--orange); margin-bottom: 3px; }
.ch-fx-item .ch-final-bg { width: 90px; height: 34px; }
.ch-fx-item .ch-final-fr { padding: 4px; }
.ch-fx-item .ch-final-fr .cos-av-wrap { width: 30px; height: 30px; }
.ch-fx-item .cos-frame-tab { display: none; }

.ch-toast { position: fixed; left: 50%; bottom: 28px; z-index: 2000; transform: translateX(-50%); padding: 12px 18px; border-radius: var(--r); background: var(--bg-3); color: var(--fg-0); font: 600 14px/1.3 var(--f-body); box-shadow: inset 3px 0 0 var(--orange), 0 18px 40px -12px rgba(0, 0, 0, .8); animation: ch-fx-in 300ms ease-out both; }
.ch-toast--err { box-shadow: inset 3px 0 0 var(--bad), 0 18px 40px -12px rgba(0, 0, 0, .8); }
.ch-toast.is-out { animation: ch-fx-out 300ms ease-in both; }

@media (max-width: 900px) {
    .ch-season { grid-template-columns: minmax(0, 1fr); }
    .ch-final { position: static; }
}
@media (max-width: 700px) {
    .ch-panel { width: calc(100vw - 16px); }
    .ch-grid, .ch-season .ch-grid { grid-template-columns: minmax(0, 1fr); }
    .ch-card { min-height: 0; padding: 12px 12px 12px 16px; gap: 10px; }
    .ch-card-title { font-size: 14px; }
    .ch-tabs { flex-wrap: wrap; }
    .ch-tabs-timer { order: -1; flex-basis: 100%; margin: 0 0 6px; padding: 0; font-size: 11px; letter-spacing: .06em; }
    .ch-hide-sm { display: none; }
    .ch-panel { height: calc(100dvh - 32px); }
    .ch-tabs .tab-btn { padding: 0 10px; }
    .ch-bonus { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 12px; }
    .ch-bonus .ch-prog { grid-column: 1 / -1; grid-row: 2; }
    .ch-stages { gap: 6px; }
    .ch-stage { padding: 9px 8px; }
    .ch-stage-meta { font-size: 11px; }
    .ch-guest { flex-wrap: wrap; }
    .ch-fx { left: 8px; right: 8px; bottom: 8px; }
}

/* --------------------------------------------------------------------------
   Post-match line (inside the result screen's XP panel)
   -------------------------------------------------------------------------- */
.xp-ch { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.xp-ch--muted { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font: 500 13px/1.35 var(--f-body); color: var(--fg-2); }
.xp-ch-kicker { font: 700 10px/1 var(--f-display); letter-spacing: .18em; text-transform: uppercase; color: var(--fg-2); }
.xp-ch-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.xp-ch-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(90px, 36%); align-items: center; gap: 10px; min-height: 26px; font: 600 13px/1.3 var(--f-body); color: var(--fg-1); }
.xp-ch-row .ch-set { justify-content: center; }
.xp-ch-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-ch-row .ch-prog-bar { height: 5px; }
.xp-ch-row.is-done { grid-template-columns: 58px minmax(0, 1fr) auto; color: var(--fg-0); }
.xp-ch-row.is-done .xp-ch-name { display: flex; align-items: center; gap: 6px; }
.xp-ch-row.is-done .ch-check { color: var(--ok); }
.xp-ch-row.is-done b { color: var(--ok); font-weight: 700; }
.xp-ch-claim, .xp-ch-more { height: 26px; padding: 0 10px; border: 0; border-radius: 3px; background: var(--orange); color: var(--orange-ink); font: 700 11px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.xp-ch-more { justify-self: start; background: transparent; color: var(--fg-2); padding: 0; height: 18px; }
.xp-ch-more:hover { color: var(--fg-0); }

@media (prefers-reduced-motion: reduce) {
    .ch-claim, .ch-w-claim, .ch-fx, .ch-toast { animation: none !important; }
    .ch-prog-bar i { transition: none; }
}
