/* =========================================================================
   Harmony WC26 Predictor — mobile-first "stadium night" design system
   Uses CSS logical properties throughout so RTL (Arabic) mirrors for free.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Cairo:wght@400;600;700;800&family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');

:root {
  --bg: #0a0e1a;
  --bg-2: #0d1322;
  --surface: #131b2e;
  --surface-2: #1a2440;
  --surface-3: #222e4f;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.14);
  --text: #e9eefb;
  --muted: #8a97b4;
  --muted-2: #5f6c8a;

  --accent: #10b981;     /* emerald */
  --accent-2: #0ea5e9;   /* sky */
  --indigo: #6366f1;
  --gold: #f5b50a;
  --danger: #ef4444;
  --win: #10b981;
  --draw: #f5b50a;
  --lose: #ef4444;

  --grad: linear-gradient(135deg, #10b981 0%, #0ea5e9 55%, #6366f1 100%);
  --grad-gold: linear-gradient(135deg, #f5b50a, #f97316);
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.3);

  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
  --nav-h: 68px;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-ar: 'Cairo', system-ui, 'Segoe UI', Tahoma, sans-serif;
  /* Athletic "scoreboard" face for numbers + headings (Latin glyphs only —
     Arabic falls through to Cairo per-glyph, so it's safe in both locales). */
  --font-display: 'Barlow Condensed', 'Cairo', system-ui, sans-serif;
}

/* ---- reset / base ------------------------------------------------------- */
.hp-root *, .hp-root *::before, .hp-root *::after { box-sizing: border-box; }
.hp-root {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, #16203a 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 0%, #1a1340 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  line-height: 1.45;
}
.hp-root[dir='rtl'] { font-family: var(--font-ar); }
.hp-root img { max-width: 100%; }
/* :where() keeps this reset at element-level specificity so component button
   classes (.hp-btn, .hp-step-btn, .hp-chip, …) keep their backgrounds. */
:where(.hp-root) button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.hp-root input { font-family: inherit; }
.hp-root a { color: var(--accent-2); text-decoration: none; }
.hp-hidden { display: none !important; }

/* scrollbars */
.hp-root ::-webkit-scrollbar { width: 0; height: 0; }

/* =========================================================================
   UX / a11y hardening — visible focus, reduced-motion, fast taps,
   and an athletic "scoreboard" face for numbers (design-intel guided).
   ========================================================================= */

/* Visible keyboard-focus ring on every interactive element (was missing). */
:where(.hp-root) :is(button, a, input, select, textarea, [tabindex],
  .hp-lb-row.clickable, .hp-md-row.clickable):focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  border-radius: 12px;
}

/* Kill the 300ms mobile tap delay; keep pull-to-refresh from firing inside. */
:where(.hp-root) button, :where(.hp-root) a, .hp-lb-row, .hp-chip, .hp-tag,
.hp-step-btn, .hp-nav button, .hp-mdbtn, .hp-howbtn { touch-action: manipulation; }
.hp-modal { overscroll-behavior: contain; }

/* Comfortable touch targets on the primary controls (≥44–48px). */
.hp-nav button { min-height: 48px; }
.hp-modal-x { width: 40px; height: 40px; }
/* The score steppers are the most-tapped control — give them a real target.
   (.hp-root prefix raises specificity above the component + desktop rules.) */
.hp-root .hp-step-btn { width: 42px; height: 42px; font-size: 21px; border-radius: 11px; }
.hp-root .hp-stepper { gap: 6px; }
.hp-root .hp-chip { padding-block: 11px; }
/* Expand tiny icon buttons' hit area to ~44px without changing their look. */
.hp-mdbtn { position: relative; }
.hp-mdbtn::after { content: ''; position: absolute; inset: -11px; }

/* Smooth, consistent hover/press feedback (color first, never layout shift). */
.hp-btn, .hp-chip, .hp-tag, .hp-lb-row, .hp-howbtn, .hp-mdbtn, .hp-step-btn,
.hp-nav button, .hp-modal-x { transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease; }
.hp-root input, .hp-root select, .hp-root textarea { accent-color: var(--accent); }

/* Respect users who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  .hp-root *, .hp-root *::before, .hp-root *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .hp-confetti { display: none !important; }
}

/* Scoreboard numerals: condensed athletic face + tabular figures so scores,
   ranks and points line up like a real scoreboard. Arabic text in these
   elements falls through to Cairo per-glyph, so RTL is unaffected. */
.hp-score, .hp-score-sep, .hp-num, .hp-lb-rank, .hp-lb-pts, .hp-pts-tag,
.hp-pf-rankbox .rk, .hp-pf-rankbox .pt, .hp-pf-prow .sc, .hp-pf-stat .v,
.hp-md-head .sc, .hp-md-row .pts, .hp-md-row .rk, .hp-sc-row .pt, .hp-sc-ko,
.hp-h2, .hp-modal h3, .hp-move {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}
.hp-score, .hp-pf-prow .sc, .hp-md-head .sc, .hp-lb-rank, .hp-pf-rankbox .rk {
  letter-spacing: .02em;
}
/* Structured score — inline-flex so the home number mirrors next to the home
   team in RTL (fixes the "1-0 shows as 0-1" reversal in Arabic). */
.hp-sp { display: inline-flex; align-items: baseline; gap: 5px; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.hp-sp .sep { opacity: .5; font-weight: 600; }

/* ---- layout container --------------------------------------------------- */
.hp-screen { max-width: 560px; margin-inline: auto; padding-inline: 16px; }
.hp-view { animation: hp-fade .35s ease both; padding-block: 14px 20px; }
@keyframes hp-fade { from { opacity: 0; transform: translateY(8px);} to {opacity:1; transform:none;} }

/* ---- splash ------------------------------------------------------------- */
.hp-splash {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); z-index: 50;
}
.hp-ball { font-size: 64px; animation: hp-bounce 1s ease-in-out infinite; }
@keyframes hp-bounce { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-22px) } }

/* ---- typographic helpers ----------------------------------------------- */
.hp-h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.hp-h2 { font-size: 19px; font-weight: 800; margin: 0 0 10px; letter-spacing: -.01em; }
.hp-sub { color: var(--muted); font-size: 14px; }
.hp-eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 700; color: var(--accent); }
.hp-num { font-variant-numeric: tabular-nums; }

/* ---- buttons ------------------------------------------------------------ */
.hp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: 999px; font-weight: 800; font-size: 16px;
  background: var(--surface-2); color: var(--text); width: 100%;
  transition: transform .12s ease, filter .2s ease, background .2s; user-select: none;
}
.hp-btn:active { transform: scale(.97); }
.hp-btn--primary { background: var(--grad); color: #04122a; box-shadow: 0 8px 24px rgba(16,185,129,.32); }
.hp-btn--gold { background: var(--grad-gold); color: #2a1500; }
.hp-btn--ghost { background: rgba(255,255,255,.05); border: 1px solid var(--line-2); }
.hp-btn--sm { padding: 9px 14px; font-size: 14px; width: auto; }
.hp-btn[disabled] { opacity: .45; pointer-events: none; }

/* ---- inputs ------------------------------------------------------------- */
.hp-field { margin-block: 12px; }
.hp-label { display: block; font-size: 13px; color: var(--muted); margin-block-end: 7px; font-weight: 600; }
.hp-input {
  width: 100%; padding: 15px 16px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text);
  font-size: 17px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.hp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(16,185,129,.16); }
.hp-input::placeholder { color: var(--muted-2); }

/* ---- cards -------------------------------------------------------------- */
.hp-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  box-shadow: var(--shadow-sm);
}
.hp-card + .hp-card { margin-block-start: 12px; }

/* =========================================================================
   ONBOARDING
   ========================================================================= */
.hp-onb { min-height: 100vh; display: flex; flex-direction: column; padding: 24px 18px calc(28px + env(safe-area-inset-bottom)); }
.hp-onb-top { display: flex; align-items: center; justify-content: space-between; margin-block-end: 8px; }
.hp-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.hp-logo img { width: 34px; height: 34px; border-radius: 9px; }
.hp-progress { display: flex; gap: 6px; margin-block: 18px 22px; }
.hp-progress span { height: 5px; border-radius: 99px; background: var(--line-2); flex: 1; transition: background .3s; }
.hp-progress span.on { background: var(--grad); }
.hp-onb-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hp-onb-hero { text-align: center; padding-block: 12px; }
.hp-onb-hero .big { font-size: 64px; line-height: 1; margin-block-end: 12px; }
.hp-lang-toggle { font-size: 13px; color: var(--muted); padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); }

/* team & champion pickers */
.hp-pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-block-start: 6px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.hp-pick {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
  border-radius: var(--r-sm); background: var(--surface); border: 2px solid transparent; transition: .15s;
}
.hp-pick .flag { font-size: 30px; }
.hp-pick .nm { font-size: 12px; text-align: center; color: var(--muted); line-height: 1.2; }
.hp-pick.sel { border-color: var(--accent); background: var(--surface-2); }
.hp-pick.sel .nm { color: var(--text); font-weight: 700; }
.hp-search { margin-block: 10px; }

/* magic reveal */
.hp-magic { text-align: center; }
.hp-magic .ring { width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent-2), var(--indigo), var(--accent));
  display: grid; place-items: center; animation: hp-spin 6s linear infinite; }
.hp-magic .ring i { width: 104px; height: 104px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 46px; font-style: normal; }
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* =========================================================================
   APP CHROME (header + bottom nav)
   ========================================================================= */
.hp-header { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px);
  background: rgba(10,14,26,.72); border-block-end: 1px solid var(--line); }
.hp-header-in { max-width: 560px; margin-inline: auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hp-rankchip { display: flex; align-items: center; gap: 8px; background: var(--surface-2); padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.hp-rankchip b { color: var(--gold); }
.hp-aud-chip { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: rgba(99,102,241,.2); color: #c3c6ff; text-transform: uppercase; letter-spacing: .04em; margin-inline-start: 2px; }

.hp-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(13,19,34,.9); backdrop-filter: blur(18px); border-block-start: 1px solid var(--line);
  display: flex; max-width: 560px; margin-inline: auto;
}
.hp-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; position: relative; }
.hp-nav button .ic { font-size: 21px; line-height: 1; }
.hp-nav button.on { color: var(--text); }
.hp-nav button.on .ic { transform: translateY(-1px); filter: drop-shadow(0 4px 10px rgba(16,185,129,.5)); }
.hp-nav button.on::before { content:''; position: absolute; top: 6px; width: 30px; height: 3px; border-radius: 99px; background: var(--grad); }
.hp-nav button[data-nav="challenges"] { display: none; } /* mobile: reached via Home card */

/* =========================================================================
   HOME / DASHBOARD
   ========================================================================= */
.hp-hero-card { background: var(--grad); color: #04122a; border-radius: var(--r-lg); padding: 18px; position: relative; overflow: hidden; box-shadow: 0 14px 36px rgba(14,165,233,.3); }
.hp-hero-card::after { content:''; position: absolute; inset-block-start: -40%; inset-inline-end: -10%; width: 220px; height: 220px; background: radial-gradient(circle, rgba(255,255,255,.4), transparent 60%); }
.hp-hero-card .rk { font-size: 46px; font-weight: 800; line-height: 1; }
.hp-hero-card .lbl { font-weight: 800; opacity: .8; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.hp-hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.hp-hero-pts { text-align: end; }
.hp-hero-pts b { font-size: 30px; font-weight: 800; }

.hp-stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-block-start: 12px; }
.hp-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 10px; text-align: center; }
.hp-stat b { display: block; font-size: 22px; font-weight: 800; }
.hp-stat span { font-size: 11px; color: var(--muted); }

.hp-countdown { display: flex; align-items: center; gap: 12px; }
.hp-cd-box { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; text-align: center; min-width: 48px; }
.hp-cd-box b { font-size: 20px; font-weight: 800; display: block; }
.hp-cd-box span { font-size: 10px; color: var(--muted); text-transform: uppercase; }

/* =========================================================================
   PREDICT FEED — match cards + score steppers
   ========================================================================= */
.hp-filters { display: flex; gap: 8px; overflow-x: auto; padding-block: 4px 12px; position: sticky; top: 58px; z-index: 10; }
.hp-chip { white-space: nowrap; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line-2); font-size: 13px; font-weight: 700; color: var(--muted); }
.hp-chip.on { background: var(--text); color: #0a0e1a; border-color: var(--text); }
.hp-pilltoggle { padding: 7px 13px; cursor: pointer; }
.hp-pilltoggle.on { background: var(--grad-gold); color: #1a1200; border-color: transparent; font-weight: 800; }
.hp-tz { text-align: center; font-size: 12px; color: var(--muted); margin-block: 0 10px; font-weight: 600; }

.hp-day-h { display: flex; align-items: center; gap: 10px; margin-block: 18px 10px; }
.hp-day-h .d { font-weight: 800; font-size: 14px; }
.hp-day-h .ln { flex: 1; height: 1px; background: var(--line); }
.hp-day-h .rnd { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
/* today's group: scroll target (offset for the sticky filter bar) + highlight */
#hp-today { scroll-margin-top: 78px; }
.hp-day-h.today .d { color: var(--gold); }
.hp-today-pill { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 99px; color: #1a1200;
  background: var(--grad-gold); box-shadow: 0 3px 10px rgba(245,181,10,.35); white-space: nowrap; }

.hp-match { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-block-end: 11px; position: relative; transition: border-color .2s; }
.hp-match.edited { border-color: rgba(16,185,129,.4); }
.hp-match.locked { opacity: .92; }
.hp-match-top { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted-2); margin-block-end: 12px; }
.hp-match-top .ven { display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.hp-badge-mini { font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .05em; }
.hp-badge-mini.auto { background: rgba(138,151,180,.18); color: var(--muted); }
.hp-badge-mini.edited { background: rgba(16,185,129,.16); color: var(--accent); }
.hp-badge-mini.live { background: rgba(239,68,68,.18); color: var(--lose); }
.hp-badge-mini.final { background: rgba(245,181,10,.16); color: var(--gold); }

.hp-vs-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.hp-team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.hp-team .flag { font-size: 38px; line-height: 1; }
.hp-team .nm { font-size: 13px; font-weight: 700; text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.hp-team.win .nm { color: var(--accent); }

.hp-score { display: flex; align-items: center; gap: 6px; }
.hp-stepper { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hp-step-btn { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; font-size: 18px; font-weight: 800; color: var(--text); transition: .12s; }
.hp-step-btn:active { transform: scale(.88); background: var(--accent); color: #04122a; }
.hp-score-val { font-size: 34px; font-weight: 800; min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.hp-score-sep { color: var(--muted-2); font-weight: 800; font-size: 22px; padding-inline: 2px; }

.hp-wdl { display: flex; justify-content: center; gap: 6px; margin-block-start: 12px; }
.hp-wdl span { font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 99px; background: var(--surface-3); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hp-wdl span.on.w { background: rgba(16,185,129,.2); color: var(--win); }
.hp-wdl span.on.d { background: rgba(245,181,10,.2); color: var(--draw); }
.hp-wdl span.on.l { background: rgba(239,68,68,.2); color: var(--lose); }

/* knockout: who advances */
.hp-adv { display: flex; justify-content: center; gap: 8px; margin-block-start: 10px; }
.hp-adv button { font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.hp-adv button.on { background: var(--grad); color: #04122a; border-color: transparent; }

/* locked / result display */
.hp-result { display: flex; align-items: center; justify-content: center; gap: 10px; margin-block-start: 10px; font-size: 13px; }
.hp-result .res { font-weight: 800; }
.hp-pts-tag { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 99px; }
.hp-pts-tag.good { background: rgba(16,185,129,.18); color: var(--accent); }
.hp-pts-tag.zero { background: rgba(239,68,68,.14); color: var(--lose); }
.hp-advtag { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-2); }
.hp-advtag.good { background: rgba(16,185,129,.12); color: var(--accent); border-color: rgba(16,185,129,.35); }
.hp-advtag.zero { background: rgba(255,255,255,.04); color: var(--muted); }
.hp-lock-ic { font-size: 12px; }
.hp-cd-mini { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.hp-cd-mini.soon { color: var(--gold); animation: hp-pulse 1.6s ease-in-out infinite; }
@keyframes hp-pulse { 50% { opacity: .5; } }

/* =========================================================================
   BRACKET
   ========================================================================= */
.hp-bracket-tabs { display: flex; gap: 6px; overflow-x: auto; padding-block: 6px 14px; }
.hp-bracket-tabs button { white-space: nowrap; padding: 8px 14px; border-radius: 99px; font-weight: 800; font-size: 13px; background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); }
.hp-bracket-tabs button.on { background: var(--grad); color: #04122a; border-color: transparent; }

.hp-tie { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-block-end: 10px; }
.hp-tie-side { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; transition: .15s; }
.hp-tie-side .flag { font-size: 26px; }
.hp-tie-side .nm { font-weight: 700; font-size: 14px; flex: 1; }
.hp-tie-side .sc { font-weight: 800; font-size: 18px; color: var(--muted); }
.hp-tie-side.win { background: rgba(16,185,129,.12); }
.hp-tie-side.win .nm { color: var(--accent); }
.hp-tie-side.win .sc { color: var(--accent); }
.hp-tie-mid { text-align: center; font-size: 10px; color: var(--muted-2); padding: 2px 0; text-transform: uppercase; letter-spacing: .1em; }
.hp-tie.tbd { opacity: .5; }

.hp-champion { text-align: center; padding: 26px 16px; background: var(--grad-gold); color: #2a1500; border-radius: var(--r-lg); margin-block: 8px; box-shadow: 0 16px 40px rgba(245,181,10,.3); }
.hp-champion .trophy { font-size: 56px; }
.hp-champion .flag { font-size: 52px; margin-block: 6px; }
.hp-champion .nm { font-size: 24px; font-weight: 800; }
.hp-champion .lbl { font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; opacity: .75; }

/* =========================================================================
   LEADERBOARD
   ========================================================================= */
.hp-tabs { display: flex; gap: 8px; margin-block-end: 14px; background: var(--surface); padding: 5px; border-radius: 14px; border: 1px solid var(--line); }
.hp-tabs button { flex: 1; padding: 10px; border-radius: 10px; font-weight: 800; font-size: 13px; color: var(--muted); }
.hp-tabs button.on { background: var(--surface-3); color: var(--text); }

.hp-lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); margin-block-end: 8px; }
.hp-lb-row.me { border-color: var(--accent); background: linear-gradient(90deg, rgba(16,185,129,.12), var(--surface)); }
.hp-lb-rank { font-weight: 800; font-size: 17px; min-width: 30px; text-align: center; }
.hp-lb-rank.top { color: var(--gold); }
.hp-lb-flag { font-size: 26px; }
.hp-lb-av { border-radius: 50%; background-size: cover; background-position: center; background-color: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; overflow: hidden; }
.hp-lb-av-fb { background: linear-gradient(135deg, var(--accent), var(--indigo)); color: #04122a; font-weight: 800; }
.hp-lb-name { flex: 1; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-lb-pts { font-weight: 800; font-size: 16px; }
.hp-lb-pts span { font-size: 11px; color: var(--muted); font-weight: 600; }
.hp-move { font-size: 11px; font-weight: 800; min-width: 26px; text-align: center; }
.hp-move.up { color: var(--accent); }
.hp-move.down { color: var(--lose); }
.hp-move.same { color: var(--muted-2); }
.hp-lb-me-sticky { position: sticky; bottom: calc(var(--nav-h) + 8px); z-index: 12; box-shadow: 0 -8px 24px rgba(0,0,0,.4); }

.hp-league-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hp-league-card .code { font-family: ui-monospace, monospace; letter-spacing: .15em; font-weight: 800; background: var(--surface-3); padding: 5px 10px; border-radius: 8px; }

/* =========================================================================
   PROFILE
   ========================================================================= */
.hp-profile-head { text-align: center; padding-block: 14px; }
.hp-avatar { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 10px; background: var(--grad); display: grid; place-items: center; font-size: 40px; box-shadow: var(--shadow); }
.hp-badge-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.hp-badge-it { text-align: center; padding: 12px 4px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.hp-badge-it.off { opacity: .28; filter: grayscale(1); }
.hp-badge-it .e { font-size: 28px; }
.hp-badge-it .n { font-size: 10px; color: var(--muted); margin-block-start: 4px; }

.hp-row-link { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); margin-block-end: 9px; font-weight: 700; }
.hp-row-link .ar { color: var(--muted-2); }

/* =========================================================================
   TOASTS / CONFETTI / MODAL
   ========================================================================= */
.hp-toast-wrap { position: fixed; inset-inline: 0; bottom: calc(var(--nav-h) + 16px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.hp-toast { background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text); padding: 11px 18px; border-radius: 99px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); animation: hp-toast-in .3s ease both; }
.hp-toast.ok { background: rgba(16,185,129,.95); color: #04122a; }
@keyframes hp-toast-in { from { transform: translateY(20px); opacity: 0; } }

.hp-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.hp-confetti i { position: absolute; top: -20px; width: 9px; height: 14px; opacity: .9; animation: hp-fall linear forwards; }
@keyframes hp-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 1; } }

.hp-modal-bg { position: fixed; inset: 0; background: rgba(5,8,16,.7); backdrop-filter: blur(6px); z-index: 80; display: grid; place-items: end center; animation: hp-fade .2s; }
.hp-modal { position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px 22px 0 0; padding: 22px 18px calc(26px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch; animation: hp-sheet .3s cubic-bezier(.2,.8,.2,1) both; }
.hp-modal-x { position: sticky; top: -4px; float: inline-end; inset-inline-end: 0; z-index: 2; width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface-2); color: var(--text);
  font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; margin-block-start: -6px; }
.hp-modal-x:hover { background: var(--surface-3); }
.hp-modal h3 { padding-inline-end: 40px; }
.hp-modal-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line-2); margin: -8px auto 12px; }
@keyframes hp-sheet { from { transform: translateY(100%); } }
.hp-modal h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }

/* share card */
.hp-sharecard { background: var(--grad); border-radius: var(--r-lg); padding: 22px; color: #04122a; position: relative; overflow: hidden; }
.hp-sharecard .big { font-size: 40px; font-weight: 800; line-height: 1; }

/* generic */
.hp-empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.hp-empty .e { font-size: 42px; margin-block-end: 10px; }
.hp-spacer { height: 16px; }
.hp-center { text-align: center; }
.hp-mt { margin-block-start: 14px; }
.hp-mb { margin-block-end: 14px; }
.hp-row { display: flex; gap: 10px; }
.hp-row > * { flex: 1; }

/* ---- momentum chip (home) --------------------------------------------- */
.hp-momentum { display: inline-flex; margin-block-start: 8px; font-size: 13px; font-weight: 800; padding: 6px 14px;
  border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); }
.hp-momentum.fire { background: linear-gradient(90deg, rgba(245,181,10,.2), rgba(239,68,68,.18)); border-color: rgba(245,181,10,.35); color: #ffd778; }
.hp-joinnote { margin-block-start: 8px; font-size: 12.5px; font-weight: 700; line-height: 1.5; padding: 9px 13px;
  border-radius: 12px; background: linear-gradient(90deg, rgba(34,197,94,.16), rgba(34,197,94,.06));
  border: 1px solid rgba(34,197,94,.34); color: var(--text); }
.hp-konote { margin-block: 2px 10px; font-size: 12.5px; font-weight: 700; line-height: 1.5; padding: 8px 13px;
  border-radius: 12px; background: linear-gradient(90deg, rgba(245,181,10,.16), rgba(245,181,10,.05));
  border: 1px solid rgba(245,181,10,.32); color: var(--text); }

/* ---- وسوم tags + player profile -------------------------------------- */
.hp-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.hp-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; line-height: 1;
  padding: 3px 7px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2);
  color: var(--text); white-space: nowrap; }
.hp-tag--gold  { background: rgba(245,181,10,.18); border-color: rgba(245,181,10,.42); color: #ffd778; }
.hp-tag--fire  { background: rgba(239,68,68,.16);  border-color: rgba(239,68,68,.42);  color: #ff9d8a; }
.hp-tag--sharp { background: rgba(16,185,129,.16); border-color: rgba(16,185,129,.42); color: #6ee7b7; }
.hp-tag--up    { background: rgba(14,165,233,.16); border-color: rgba(14,165,233,.42); color: #7dd3fc; }
.hp-tag--new   { background: rgba(34,197,94,.16);  border-color: rgba(34,197,94,.42);  color: #86efac; }

.hp-lb-row.clickable { cursor: pointer; transition: background .12s ease; }
.hp-lb-row.clickable:hover { background: var(--surface-2); }
.hp-lb-nx { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.hp-lb-nx .hp-lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.hp-lb-chev { color: var(--muted-2); font-size: 20px; font-weight: 700; opacity: .7; margin-inline: 2px; }

.hp-pf-head { display: flex; align-items: center; gap: 12px; }
.hp-pf-head.me { }
.hp-pf-id { flex: 1; min-width: 0; }
.hp-pf-id .nm { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-pf-id .sub { font-size: 13px; color: var(--muted); margin-block-start: 2px; }
.hp-pf-rankbox { text-align: center; padding-inline-start: 6px; }
.hp-pf-rankbox .rk { font-size: 22px; font-weight: 900; color: var(--gold); line-height: 1; }
.hp-pf-rankbox .pt { font-size: 11px; color: var(--muted); margin-block-start: 3px; }
.hp-pf-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-block-start: 12px; }
.hp-pf-stats { display: flex; gap: 8px; margin-block-start: 12px; }
.hp-pf-stat { flex: 1; text-align: center; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 9px 6px; min-width: 0; }
.hp-pf-stat .v { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-pf-stat .l { font-size: 11px; color: var(--muted); margin-block-start: 2px; }
.hp-pf-pred { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 9px 11px; margin-block-start: 7px; border-inline-start: 3px solid var(--line-2); }
.hp-pf-pred.good { border-inline-start-color: var(--accent); }
.hp-pf-pred.zero { border-inline-start-color: #ef4444; }
.hp-pf-pred.par { border-inline-start-color: #22c55e; background: linear-gradient(90deg, rgba(34,197,94,.08), transparent); }
.hp-pf-prow { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.hp-pf-prow .tm { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-pf-prow .tm.aw { text-align: end; }
.hp-pf-prow .sc { font-weight: 900; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.hp-pf-prow .hp-pts-tag { flex: 0 0 auto; }
.hp-pf-psub { font-size: 11.5px; color: var(--muted); margin-block-start: 4px; }
.hp-md-row.clickable { cursor: pointer; }
.hp-md-row.clickable:hover { background: var(--surface-2); border-radius: 8px; }

/* ---- "how points work" explainer ------------------------------------- */
.hp-howbtn { background: rgba(255,255,255,.05); border: 1px solid var(--line-2); color: var(--accent-2);
  font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.hp-howbtn:hover { background: rgba(255,255,255,.10); }
.hp-predtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hp-ranktop { display: flex; justify-content: flex-end; margin-block-end: 8px; }
.hp-sc-h { font-size: 13px; font-weight: 800; color: var(--accent); margin-block: 14px 6px; }
.hp-sc-h:first-child { margin-block-start: 2px; }
.hp-sc-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-block-end: 1px solid rgba(255,255,255,.06); }
.hp-sc-row .ic { font-size: 16px; flex: 0 0 auto; width: 22px; text-align: center; }
.hp-sc-row .lb { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; }
.hp-sc-row .pt { flex: 0 0 auto; font-size: 13px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.hp-sc-ko { font-size: 13px; font-weight: 800; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; line-height: 1.8; }
.hp-sc-note { font-size: 12px; color: var(--accent-2); margin-block-start: 6px; line-height: 1.5; font-weight: 600; }
.hp-sc-fair { margin-block-start: 14px; font-size: 12.5px; font-weight: 700; line-height: 1.5; padding: 9px 12px;
  border-radius: 12px; background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.32); color: var(--text); }

/* ---- match-detail button + sheet -------------------------------------- */
.hp-mdbtn { font-size: 15px; line-height: 1; padding: 4px 7px; border-radius: 8px; background: var(--surface-3); }
.hp-mdbtn:active { transform: scale(.9); }
.hp-md-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 6px 0 4px; }
.hp-md-head .tm { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hp-md-head .tm .fl { font-size: 40px; }
.hp-md-head .tm .nm { font-weight: 700; font-size: 13px; text-align: center; }
.hp-md-head .sc { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hp-md-you { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; margin-block: 8px; font-weight: 700; }
.hp-md-crowd { display: flex; flex-direction: column; gap: 6px; margin-block: 10px; }
.hp-cb { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.hp-cb .l { width: 54px; color: var(--muted); font-weight: 700; }
.hp-cb .bar { flex: 1; height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hp-cb .bar i { display: block; height: 100%; border-radius: 99px; }
.hp-cb .bar i.w { background: var(--win); } .hp-cb .bar i.d { background: var(--draw); } .hp-cb .bar i.l { background: var(--lose); }
.hp-cb .p { width: 38px; text-align: end; font-weight: 800; }
.hp-md-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; }
.hp-md-row.me { background: linear-gradient(90deg, rgba(16,185,129,.14), transparent); }
.hp-md-row .rk { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.hp-md-row .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-md-row .sub { color: var(--muted); font-size: 12px; font-weight: 700; }
.hp-md-row .pts { font-weight: 800; color: var(--accent); }

/* ---- prize banner ------------------------------------------------------ */
.hp-prize {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  background: linear-gradient(135deg, rgba(245,181,10,.16), rgba(249,115,22,.12));
  border: 1px solid rgba(245,181,10,.32); color: #ffd778;
  border-radius: var(--r); padding: 12px 14px; font-weight: 700; font-size: 13px; text-align: center;
}
.hp-prize .t { font-size: 20px; }

/* ---- greeting ---------------------------------------------------------- */
.hp-greet { background: linear-gradient(135deg, rgba(16,185,129,.18), rgba(14,165,233,.1));
  border: 1px solid rgba(16,185,129,.3); border-radius: var(--r); padding: 14px 16px; }
.hp-greet b { color: var(--accent); }

/* ---- challenges / bonus ------------------------------------------------ */
.hp-bonus { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px; margin-block-end: 12px; }
.hp-bonus-h { display: flex; align-items: center; gap: 10px; margin-block-end: 10px; }
.hp-bonus-h .e { font-size: 26px; }
.hp-bonus-h .q { font-weight: 800; font-size: 15px; }
.hp-bonus-pick { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 10px 12px; font-weight: 700; cursor: pointer; }
.hp-bonus-pick .flag { font-size: 22px; }
.hp-bonus-pick .ph { color: var(--muted-2); }
.hp-toggle-row { display: flex; gap: 8px; }
.hp-toggle-row button { flex: 1; padding: 12px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line-2); color: var(--muted); font-weight: 800; }
.hp-toggle-row button.on { background: var(--grad); color: #04122a; border-color: transparent; }
.hp-bonus-correct { color: var(--accent); font-size: 12px; font-weight: 800; margin-block-start: 6px; }
.hp-player-row { padding: 12px; margin-block-end: 8px; transition: background .15s; }
.hp-player-row:active { background: var(--surface-3); }
.hp-player-row .flag { font-size: 26px; }
.hp-player-row .pnames { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.hp-player-row .pnames b { font-size: 15px; }
.hp-player-row .pnames small { color: var(--muted); font-weight: 600; font-size: 11px; }
/* The modal is fully self-styled — explicit color + font so it can never
   inherit a theme's dark-on-dark text, wherever it mounts. */
.hp-modal-bg, .hp-modal-bg .hp-modal { color: var(--text); font-family: var(--font); }
[dir='rtl'] .hp-modal-bg, .hp-root[dir='rtl'] .hp-modal-bg .hp-modal { font-family: var(--font-ar); }
.hp-modal b, .hp-modal h3 { color: var(--text); }
#hp-bonus-progress { margin-block: 10px 4px; }

.hp-cup-tag { display:inline-flex; align-items:center; gap:6px; background: var(--grad-gold); color:#2a1500;
  font-weight: 800; font-size: 11px; padding: 3px 10px; border-radius: 99px; }

/* =========================================================================
   DESKTOP  (>= 900px) — sidebar nav, centered wide canvas, grids, bracket tree
   ========================================================================= */
.hp-nav-brand { display: none; }

@media (min-width: 900px) {
  .hp-root { padding-bottom: 0; }

  /* sidebar */
  .hp-nav {
    inset-inline-start: 0; inset-block: 0; top: 0; bottom: 0;
    height: 100vh; width: 248px; max-width: 248px; margin: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 22px 14px; border-block-start: none;
    border-inline-end: 1px solid var(--line);
    background: linear-gradient(180deg, #0d1322, #0a0e1a);
  }
  .hp-nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px;
    padding: 6px 12px 18px; }
  .hp-nav-brand img { width: 34px; height: 34px; border-radius: 9px; }
  .hp-nav button { flex: none; flex-direction: row; justify-content: flex-start; gap: 14px;
    padding: 13px 16px; border-radius: 12px; font-size: 15px; }
  .hp-nav button .ic { font-size: 22px; }
  .hp-nav button.on { background: var(--surface-2); }
  .hp-nav button.on::before { display: none; }
  .hp-nav button[data-nav="challenges"] { display: flex; } /* desktop: show in sidebar */
  .hp-nav button.on .ic { filter: none; }
  .hp-nav button[data-nav].on { box-shadow: inset 3px 0 0 var(--accent); }
  .hp-nav-spacer { flex: 1; }

  /* header + content shifted past the fixed 248px sidebar, then centered in the
     remaining space. The content area is offset by the sidebar width; the inner
     wrappers (.hp-header-in / .hp-view) center within it. */
  .hp-screen { max-width: 1080px; margin-inline: auto; padding-inline: 32px; } /* onboarding (no sidebar) */
  .hp-header { margin-inline-start: 248px; }
  .hp-header-in { max-width: 1080px; margin-inline: auto; }
  #hp-content.hp-screen { max-width: none; margin: 0; margin-inline-start: 248px; padding-inline: 32px; }

  /* dashboard: 2-col */
  .hp-view { padding-block: 22px 40px; max-width: 1080px; margin-inline: auto; }
  .hp-home-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
  .hp-home-grid > * { margin: 0 !important; }
  .hp-hero-card .rk { font-size: 56px; }

  /* predict feed: card grid */
  .hp-feed-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hp-feed-grid .hp-match { margin: 0; }
  .hp-day-h { grid-column: 1 / -1; }
  .hp-filters { position: static; }

  /* leaderboard a touch wider rows */
  .hp-lb-row { padding: 14px 18px; }

  /* challenges 2-col */
  .hp-bonus-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hp-bonus-grid .hp-bonus { margin: 0; }

  /* full bracket tree: rounds side by side */
  .hp-bk-board { display: flex; gap: 14px; overflow-x: auto; padding-block: 6px 20px; align-items: stretch; }
  .hp-bk-col { min-width: 210px; flex: 1; display: flex; flex-direction: column; }
  .hp-bk-col h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--accent); text-align: center; }
  .hp-bk-col .hp-tie { flex: none; }
  .hp-bk-ties { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; flex: 1; }
  .hp-bk-champ-col { min-width: 200px; display: flex; flex-direction: column; justify-content: center; }

  /* onboarding centered card */
  .hp-onb { max-width: 460px; margin-inline: auto; }

  /* slightly larger tap surfaces feel good on desktop too */
  .hp-step-btn { width: 34px; height: 34px; }
}

@media (min-width: 1280px) {
  .hp-header-in, #hp-content.hp-screen, .hp-screen { max-width: 1200px; }
  .hp-feed-grid { grid-template-columns: repeat(3, 1fr); }
}
