/* StanceArena — app shell (lobby, nav, friends, profile) */
@import url('design-tokens.css');

:root {
  --bg:          #08111f;
  --surface:     #0f1c30;
  --surface2:    #172540;
  --blue:        #2563eb;
  --blue-l:      #60a5fa;
  --red:         #dc2626;
  --red-l:       #f87171;
  --gold:        #f59e0b;
  --gold-l:      #fbbf24;
  --hint:        #6366f1;
  --purple:      #8b5cf6;
  --green:       #22c55e;
  --green-l:     #4ade80;
  --text:        var(--sa-text);
  --muted:       var(--sa-text-muted);
  --border:      #1e3050;
  --r-sm:        8px;
  --r-md:        12px;
  --r-lg:        16px;
  --r-pill:      50px;
  --font:        'Rubik', sans-serif;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bot:    env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; background: var(--bg); color: var(--text);
  font-family: var(--font); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.app-phone {
  height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--bg); position: relative;
}

/* ── LOBBY ── */
.lobby { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.lobby-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 16px 10px; flex-shrink: 0;
}
.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid rgba(37,99,235,.25);
  border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer;
}
.u-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(37,99,235,.25); color: var(--blue-l);
  border: 1.5px solid rgba(37,99,235,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
}
.u-name  { font-size: 11px; font-weight: 700; color: var(--text); }
.u-coins { font-size: 11px; font-weight: 700; color: var(--gold); }
.notif-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
}
.lobby-topbar-actions {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.sa-top-settings,
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface2, #1a2332); border: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; text-decoration: none; color: var(--text); flex-shrink: 0;
}
.sa-top-settings:active, .topbar-icon-btn:active { transform: scale(.94); }
.sa-lang-topbar-slot { display: flex; align-items: center; flex-shrink: 0; }
.sa-app-top-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 4px; flex-shrink: 0;
}
.profile-hdr-actions {
  display: flex; align-items: center; gap: 8px; margin-inline-start: auto;
}
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}
.lobby-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 8px; -webkit-overflow-scrolling: touch; }
.lobby-scroll::-webkit-scrollbar { display: none; }
.section-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--muted); text-transform: uppercase; margin: 10px 0 8px;
}
.mode-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px; margin-bottom: 10px; cursor: pointer; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .15s, transform .12s;
}
.mode-card:active { transform: scale(.98); }
.mode-card.fun   { border-color: rgba(245,158,11,.2); }
.mode-card.all   { border-color: rgba(99,102,241,.25); }
.mode-card-icon  { font-size: 32px; flex-shrink: 0; }
.mode-card-name  { font-size: 16px; font-weight: 700; color: var(--text); }
.mode-card-desc  { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.mode-tag {
  display: inline-block; font-size: 9px; font-weight: 700;
  letter-spacing: .5px; padding: 3px 8px; border-radius: 20px; margin-bottom: 5px;
}
.tag-all { background: rgba(99,102,241,.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,.3); }
.tag-fun { background: rgba(245,158,11,.15); color: var(--gold-l); border: 1px solid rgba(245,158,11,.25); }
.tag-mcq { background: rgba(37,99,235,.15); color: var(--blue-l); border: 1px solid rgba(37,99,235,.25); }
.tag-cw  { background: rgba(99,102,241,.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,.25); }
.tag-travel { background: rgba(245,158,11,.15); color: var(--gold-l); border: 1px solid rgba(245,158,11,.3); }
.mode-card.travel { border-color: rgba(245,158,11,.2); }
.mode-arrow { color: var(--muted); font-size: 16px; flex-shrink: 0; margin-right: auto; }
.default-badge {
  position: absolute; top: 10px; left: 12px;
  background: var(--hint); color: #fff;
  font-size: 8px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
}
.hot-badge {
  position: absolute; top: 10px; left: 12px;
  background: var(--red); color: #fff;
  font-size: 8px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
}
.friends-teaser {
  background: var(--surface); border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--r-lg); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; margin-bottom: 10px;
}
.ft-avatars { display: flex; }
.ft-av {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--bg); margin-left: -8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
}
.ft-av:last-child { margin-left: 0; }
.ft-title { font-size: 12px; font-weight: 700; color: var(--text); }
.ft-sub   { font-size: 10px; color: var(--muted); margin-top: 1px; }
.ft-badge {
  background: rgba(99,102,241,.2); border: 1px solid rgba(99,102,241,.4);
  border-radius: 20px; padding: 4px 10px; font-size: 11px; font-weight: 700;
  color: #a5b4fc; white-space: nowrap;
}
.lobby-cta { padding: 12px 16px 8px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.play-btn {
  width: 100%; padding: 16px; border-radius: var(--r-lg); border: none;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: #fff; font-family: var(--font); font-size: 16px; font-weight: 900;
  cursor: pointer; box-shadow: 0 4px 20px rgba(37,99,235,.35);
}
.play-btn-secondary {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border2); box-shadow: none;
}
.play-btn:active { transform: scale(.98); }

/* ── BOTTOM NAV ── */
.bnav {
  display: flex; border-top: 1px solid var(--border); background: var(--bg);
  padding: 8px 0 calc(14px + var(--safe-bot)); flex-shrink: 0;
}
.bni {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; padding: 6px 0; min-height: 44px; justify-content: center;
  text-decoration: none; color: inherit;
}
.bni-icon { font-size: 19px; color: var(--muted); }
.bni-lbl  { font-size: 9px; font-weight: 600; color: var(--muted); }
.bni.active .bni-icon, .bni.active .bni-lbl { color: var(--blue-l); }
.bni-dot  { width: 4px; height: 4px; border-radius: 50%; background: var(--blue-l); margin-top: 1px; opacity: 0; }
.bni.active .bni-dot { opacity: 1; }

/* ── LEGAL STRIP (above bottom nav — payment compliance) ── */
.legal-strip {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 7px 12px 2px; border-top: 1px solid var(--border);
  background: var(--bg); flex-shrink: 0;
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
}
.legal-strip a {
  color: var(--muted); text-decoration: none; padding: 5px 10px;
  border-radius: 6px; transition: color 0.15s;
}
.legal-strip a:hover, .legal-strip a:focus-visible { color: var(--blue-l); }
.legal-strip-sep { color: var(--border); user-select: none; line-height: 1; }

/* ── FRIENDS ── */
.friends-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.fr-hdr { padding: calc(14px + var(--safe-top)) 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.fr-title { font-size: 18px; font-weight: 900; color: var(--text); }
.fr-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.filter-tabs { display: flex; gap: 6px; padding: 10px 16px; flex-shrink: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.ftab {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: var(--font); white-space: nowrap;
}
.ftab.active { background: var(--surface2); border-color: var(--blue); color: var(--text); }
.fr-scroll { flex: 1; overflow-y: auto; padding: 10px 16px; -webkit-overflow-scrolling: touch; }
.fr-scroll::-webkit-scrollbar { display: none; }
.fr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; margin-bottom: 10px; }
.fr-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fr-av { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.fr-name { font-size: 13px; font-weight: 700; color: var(--text); }
.fr-time { font-size: 10px; color: var(--muted); margin-top: 1px; }
.fr-status { margin-right: auto; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.st-waiting { background: rgba(107,130,160,.15); color: var(--muted); border: 1px solid var(--border); }
.st-correct { background: rgba(34,197,94,.12); color: var(--green-l); border: 1px solid rgba(34,197,94,.25); }
.st-wrong   { background: rgba(220,38,38,.12); color: var(--red-l); border: 1px solid rgba(220,38,38,.25); }
.fr-question { font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.4; }
.fr-question strong { color: var(--text); }
.answers-compare { display: flex; gap: 8px; }
.ans-col { flex: 1; background: var(--surface2); border-radius: 10px; padding: 8px 10px; }
.ans-col-lbl { font-size: 9px; font-weight: 700; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.ans-val { font-size: 13px; font-weight: 700; }
.ans-correct .ans-val { color: var(--green-l); }
.ans-wrong   .ans-val { color: var(--red-l); }
.ans-neutral .ans-val { color: var(--text); }
.ans-waiting .ans-val { color: var(--muted); font-style: italic; font-size: 11px; }
.remind-btn {
  width: 100%; margin-top: 10px; padding: 8px; border-radius: 10px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 11px; font-weight: 700; cursor: pointer;
}
.fr-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.fr-empty-icon { font-size: 48px; margin-bottom: 12px; }
.fr-empty-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.fr-empty-sub { font-size: 12px; line-height: 1.5; }

/* ── PROFILE ── */
.profile-screen { flex: 1; display: flex; flex-direction: column; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.profile-hdr {
  padding: calc(14px + var(--safe-top)) 16px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.p-av-lg {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(37,99,235,.25); color: var(--blue-l);
  border: 2.5px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.p-full-name { font-size: 16px; font-weight: 700; color: var(--text); }
.p-stats     { font-size: 11px; color: var(--muted); margin-top: 2px; }
.menu-section { padding: 14px 16px 0; }
.menu-lbl { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; margin-bottom: 6px; transition: border-color .15s;
  text-decoration: none; color: inherit;
}
.menu-item:active { border-color: rgba(96,165,250,.3); }
.mi-icon  { font-size: 18px; width: 28px; text-align: center; }
.mi-title { font-size: 13px; font-weight: 600; color: var(--text); }
.mi-sub   { font-size: 10px; color: var(--muted); margin-top: 1px; }
.mi-right { margin-right: auto; }
.mi-arrow { font-size: 12px; color: var(--muted); }
.lang-tag { font-size: 11px; font-weight: 600; color: var(--gold); background: rgba(245,158,11,.1); border-radius: 20px; padding: 3px 9px; }
.menu-item.admin { border-color: rgba(220,38,38,.2); }
.menu-item.admin .mi-icon, .menu-item.admin .mi-title { color: var(--red-l); }
.logout-btn {
  margin: 14px 16px calc(20px + var(--safe-bot)); padding: 13px; border-radius: var(--r-md);
  border: 1px solid rgba(220,38,38,.25); background: transparent; color: var(--red-l);
  font-family: var(--font); font-size: 13px; font-weight: 700; cursor: pointer; width: calc(100% - 32px);
}
.coming-soon-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.coming-soon-toast.show { opacity: 1; }

/* ── LOBBY XP / STREAK / QUESTS ── */
.xp-bar-wrap { margin: 0 16px 6px; flex-shrink: 0; }
.xp-row2 { display: flex; align-items: center; gap: 8px; }
.xp-lv { font-size: 11px; font-weight: 700; color: var(--blue-l); white-space: nowrap; }
.xp-bg { flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--hint), var(--blue-l)); border-radius: 3px; }
.xp-nxt { font-size: 10px; color: var(--muted); white-space: nowrap; }
.streak-bar {
  margin: 0 16px 8px; background: var(--surface); border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--r-md); padding: 8px 12px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.s-val { font-size: 14px; font-weight: 900; color: var(--gold); }
.s-sub { font-size: 10px; color: var(--muted); }
.s-nxt { font-size: 10px; font-weight: 600; color: var(--gold-l); margin-right: auto; }
.wa-invite {
  margin: 0 16px 8px; padding: 11px 14px; background: rgba(37,211,102,.08);
  border: 1px solid rgba(37,211,102,.25); border-radius: var(--r-lg);
  display: flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0;
}
.wa-invite-t { font-size: 13px; font-weight: 700; color: var(--text); }
.wa-invite-s { font-size: 10px; color: var(--muted); margin-top: 1px; }
.wa-pick-sub { font-size: 11px; color: var(--muted); text-align: center; margin: 0 0 12px; }
.wa-pick-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px;
  margin-bottom: 8px; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; text-align: right; font-family: var(--font);
}
.wa-pick-btn:active { transform: scale(.98); }
.wa-pick-mix { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); }
.wa-pick-mcq { border-color: rgba(37,99,235,.35); background: rgba(37,99,235,.08); }
.wa-pick-cw { border-color: rgba(139,92,246,.35); background: rgba(139,92,246,.08); }
.wa-pick-ico { font-size: 28px; flex-shrink: 0; }
.wa-pick-name { display: block; font-size: 14px; font-weight: 800; color: var(--text); }
.wa-pick-desc { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.quest-item {
  display: flex; align-items: center; gap: 9px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 9px 12px; margin-bottom: 6px;
}
.qi-icon { font-size: 15px; flex-shrink: 0; }
.qi-text { flex: 1; font-size: 12px; color: var(--text); font-weight: 500; }
.qi-bar { width: 100%; height: 3px; background: var(--surface2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.qi-fill { height: 100%; background: var(--green); border-radius: 2px; }
.qi-rew { font-size: 11px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.quest-item.done { opacity: .55; }
.quest-item.done .qi-text { text-decoration: line-through; color: var(--muted); }
.bp-teaser {
  background: var(--surface); border: 1px solid rgba(245,158,11,.3); border-radius: var(--r-lg);
  padding: 11px 13px; margin-bottom: 7px; display: flex; align-items: center; gap: 11px; cursor: pointer;
}
.bp-pl { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.bp-ps { font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.bp-b { height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.bp-bf { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-l)); border-radius: 3px; }
.bp-badge { font-size: 11px; font-weight: 700; color: var(--gold); background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); border-radius: 20px; padding: 4px 9px; }

/* ── HISTORY ── */
.hist-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.hist-hdr { padding: calc(14px + var(--safe-top)) 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.hist-hdr-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.back-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--muted); text-decoration: none;
}
.hist-title { font-size: 17px; font-weight: 900; color: var(--text); text-align: center; }
.hist-sub { font-size: 11px; color: var(--muted); text-align: center; }
.hist-stats { display: flex; gap: 8px; margin-bottom: 10px; }
.hst { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; text-align: center; }
.hst-val { font-size: 18px; font-weight: 900; }
.hst-val.c { color: var(--green-l); }
.hst-val.w { color: var(--red-l); }
.hst-val.x { color: var(--gold); }
.hst-lbl { font-size: 9px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.filter-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.filter-row::-webkit-scrollbar { display: none; }
.fchip {
  padding: 5px 12px; border-radius: var(--r-pill); border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; white-space: nowrap; font-family: var(--font); flex-shrink: 0;
}
.fchip.active { background: var(--surface2); border-color: var(--blue); color: var(--text); }
.fchip.c-fun.active { background: rgba(245,158,11,.1); border-color: var(--gold); color: var(--gold-l); }
.fchip.c-mcq.active { background: rgba(37,99,235,.1); border-color: var(--blue); color: var(--blue-l); }
.fchip.c-cw.active { background: rgba(99,102,241,.1); border-color: var(--hint); color: #a5b4fc; }
.hist-scroll { flex: 1; overflow-y: auto; padding: 10px 16px; -webkit-overflow-scrolling: touch; }
.hist-scroll::-webkit-scrollbar { display: none; }
.date-divider { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin: 12px 0 8px; }
.hq-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; margin-bottom: 8px; }
.hq-card.correct { border-color: rgba(34,197,94,.2); }
.hq-card.wrong { border-color: rgba(220,38,38,.15); }
.hq-card.shop { border-color: rgba(245,158,11,.15); }
.hq-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hq-badge { font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 20px; flex-shrink: 0; }
.hq-b-fun { background: rgba(245,158,11,.12); color: var(--gold-l); border: 1px solid rgba(245,158,11,.3); }
.hq-b-mcq { background: rgba(37,99,235,.12); color: var(--blue-l); border: 1px solid rgba(37,99,235,.3); }
.hq-b-cw { background: rgba(99,102,241,.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,.3); }
.hq-b-shop { background: rgba(245,158,11,.12); color: var(--gold-l); border: 1px solid rgba(245,158,11,.3); }
.hq-topic { font-size: 10px; color: var(--muted); font-weight: 600; }
.hq-time { font-size: 10px; color: var(--muted); margin-right: auto; }
.hq-xp { font-size: 10px; font-weight: 700; color: var(--green-l); }
.hq-question { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; margin-bottom: 8px; }
.hq-answers { display: flex; gap: 7px; }
.hq-ans { flex: 1; border-radius: var(--r-sm); padding: 6px 9px; font-size: 11px; }
.hq-ans-lbl { font-size: 9px; font-weight: 700; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; }
.hq-ans-val { font-size: 12px; font-weight: 700; }
.hq-ans.correct-a { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25); }
.hq-ans.correct-a .hq-ans-val { color: var(--green-l); }
.hq-ans.wrong-a { background: rgba(220,38,38,.1); border: 1px solid rgba(220,38,38,.2); }
.hq-ans.wrong-a .hq-ans-val { color: var(--red-l); }
.hq-ans.neutral-a { background: var(--surface2); border: 1px solid var(--border); }
.hq-ans.shop-a { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); }
.hq-ans.shop-a .hq-ans-val { color: var(--gold-l); }

/* ── LEAGUE ── */
.league-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.league-hdr { padding: calc(14px + var(--safe-top)) 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.league-title { font-size: 17px; font-weight: 900; color: var(--text); }
.league-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.rank-badge {
  margin: 14px 16px; background: linear-gradient(135deg, rgba(245,158,11,.15), rgba(245,158,11,.05));
  border: 1px solid rgba(245,158,11,.3); border-radius: var(--r-lg); padding: 16px;
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
}
.rank-icon { font-size: 42px; flex-shrink: 0; }
.rank-name { font-size: 20px; font-weight: 900; color: var(--gold); }
.rank-pts { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rank-prog { margin-top: 8px; }
.rank-prog-lbl { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.rank-prog-bg { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.rank-prog-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-l)); }
.league-scroll { flex: 1; overflow-y: auto; padding: 0 16px 10px; }
.league-scroll::-webkit-scrollbar { display: none; }
.rank-ladder { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rank-step {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 13px;
}
.rank-step.current { border-color: rgba(245,158,11,.5); background: rgba(245,158,11,.06); }
.rank-step.done { opacity: .65; }
.rank-step.locked { opacity: .35; }
.rs-icon { font-size: 22px; flex-shrink: 0; }
.rs-name { font-size: 13px; font-weight: 700; color: var(--text); }
.rs-range { font-size: 10px; color: var(--muted); }
.rs-right { margin-right: auto; font-size: 11px; font-weight: 700; }
.rs-right.done { color: var(--green-l); }
.rs-right.current { color: var(--gold); }
.rs-right.locked { color: var(--muted); }

/* ── XP POP (global) ── */
@keyframes xpFly {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  60% { opacity: 1; transform: translateY(-30px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-55px) scale(1); }
}
.xp-pop {
  position: fixed; z-index: 9999; pointer-events: none;
  background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.4);
  border-radius: 20px; padding: 4px 12px; font-size: 13px; font-weight: 900;
  color: var(--green-l); animation: xpFly 1.1s ease forwards; white-space: nowrap;
}

/* ── ONBOARDING ── */
.onb-overlay {
  position: fixed; inset: 0; z-index: 10000; background: var(--bg);
  display: flex; align-items: stretch; justify-content: center;
}
.onb-overlay .onb-screen { width: 100%; max-width: 430px; margin: 0 auto; }
.onb-screen { flex: 1; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.onb-slides { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.onb-slide { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 24px; text-align: center; }
.onb-emoji { font-size: 60px; margin-bottom: 20px; }
.onb-title { font-size: 22px; font-weight: 900; color: var(--text); margin-bottom: 10px; line-height: 1.3; }
.onb-desc { font-size: 14px; color: var(--muted); line-height: 1.6; max-width: 280px; }
.onb-challenger {
  background: var(--surface); border: 1px solid rgba(37,99,235,.3); border-radius: var(--r-lg);
  padding: 14px 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; width: 100%;
}
.onb-ch-av {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(37,99,235,.25); color: var(--blue-l);
  border: 2px solid var(--blue); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700;
}
.onb-ch-name { font-size: 14px; font-weight: 700; color: var(--text); }
.onb-ch-sub { font-size: 11px; color: var(--muted); }
.how-steps { display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: right; }
.how-step {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px;
}
.how-num {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(37,99,235,.2); color: var(--blue-l);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.how-text { font-size: 13px; color: var(--text); font-weight: 500; }
.onb-footer { padding: 16px 24px calc(24px + var(--safe-bot)); flex-shrink: 0; }
.onb-footer { padding: 16px 24px calc(24px + env(safe-area-inset-bottom, 0px)); flex-shrink: 0; display: flex; flex-direction: column; align-items: center; width: 100%; }
.onb-dots { display: flex; justify-content: center; align-items: center; gap: 6px; width: 100%; max-width: 100%; margin: 0 auto 14px; }
.onb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: all .2s; }
.onb-dot.active { background: var(--blue-l); width: 18px; border-radius: 3px; }
.onb-btn {
  width: 100%; padding: 15px; border-radius: var(--r-lg); border: none;
  background: linear-gradient(135deg, var(--blue), #1d4ed8); color: #fff;
  font-family: var(--font); font-size: 16px; font-weight: 900; cursor: pointer;
}
.onb-skip {
  width: 100%; margin-top: 10px; background: transparent; border: none; color: var(--muted);
  font-family: var(--font); font-size: 12px; cursor: pointer;
}
.name-input-wrap {
  width: 100%; background: var(--surface); border: 1.5px solid var(--blue);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px;
}
.name-input {
  width: 100%; background: transparent; border: none; outline: none;
  font-family: var(--font); font-size: 16px; color: var(--text); text-align: center; caret-color: var(--blue);
}
.name-input::placeholder { color: var(--muted); }

/* ── BATTLE PASS SCREEN ── */
.bp-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.bp-hdr { padding: calc(14px + var(--safe-top)) 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.bp-ht { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.bp-title { font-size: 17px; font-weight: 900; color: var(--text); }
.bp-season-lbl { font-size: 10px; color: var(--muted); }
.bp-buy-btn {
  background: linear-gradient(135deg, var(--gold), var(--gold-l)); border: none; border-radius: var(--r-pill);
  padding: 7px 14px; font-family: var(--font); font-size: 11px; font-weight: 700; color: #000; cursor: pointer;
}
.bp-xb { height: 7px; background: var(--surface2); border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.bp-xf { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-l)); border-radius: 4px; }
.bp-xl { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.bp-scroll2 { flex: 1; overflow-y: auto; padding: 12px 16px; }
.bp-scroll2::-webkit-scrollbar { display: none; }
.bp-tlbls { display: flex; gap: 0; margin-bottom: 5px; padding-right: 34px; }
.bp-tl { flex: 1; text-align: center; font-size: 10px; font-weight: 700; color: var(--muted); }
.bp-tl.p { color: var(--gold); }
.bp-tr { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.bp-tn { width: 28px; font-size: 10px; color: var(--muted); text-align: center; flex-shrink: 0; }
.bp-nw { width: 32px; display: flex; justify-content: center; flex-shrink: 0; position: relative; }
.bp-nl { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 2px; height: 7px; background: var(--border); }
.bp-nl.done { background: var(--green); }
.bp-node {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.bp-node.done { border-color: var(--green); background: rgba(34,197,94,.15); }
.bp-node.cur { border-color: var(--blue-l); background: rgba(37,99,235,.15); box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.bp-node.lk { opacity: .35; }
.bp-rf {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 7px 9px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text); font-weight: 500;
}
.bp-rp {
  flex: 1; background: rgba(245,158,11,.05); border: 1px solid rgba(245,158,11,.25); border-radius: var(--r-md);
  padding: 7px 9px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--gold-l); font-weight: 500;
}
.bp-lk {
  flex: 1; height: 44px; background: var(--surface2); border-radius: var(--r-md); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 13px; opacity: .25;
}

/* ── AVATARS ── */
.av-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.av-hdr { padding: calc(14px + var(--safe-top)) 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.av-title { font-size: 17px; font-weight: 900; color: var(--text); text-align: center; }
.av-sub { font-size: 11px; color: var(--muted); text-align: center; margin-top: 2px; }
.av-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; }
.av-scroll::-webkit-scrollbar { display: none; }
.av-section-lbl { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; margin: 8px 0 10px; }
.av-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.av-item { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
.av-circle {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; border: 2px solid var(--border); position: relative; transition: border-color .15s, transform .12s;
}
.av-circle.selected { border-color: var(--blue-l); box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.av-circle.locked { opacity: .4; }
.av-lock {
  position: absolute; bottom: -2px; right: -2px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.av-label { font-size: 9px; color: var(--muted); text-align: center; font-weight: 600; line-height: 1.3; }
.av-label.selected { color: var(--blue-l); }
.av-label.bp { color: var(--gold); }

/* ── LEAGUE PLAYERS ── */
.league-players { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.lp-row {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px;
}
.lp-row.lp-me { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.06); }
.lp-rank { width: 22px; text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); flex-shrink: 0; }
.lp-rank.top { font-size: 14px; }
.lp-rank.me { color: var(--gold); }
.lp-av {
  width: 28px; height: 28px; border-radius: 50%; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); flex-shrink: 0;
}
.lp-name { flex: 1; font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-tier { font-size: 14px; flex-shrink: 0; }
.lp-pts { font-size: 11px; font-weight: 700; color: var(--gold); flex-shrink: 0; }
.lp-loading, .lp-empty { text-align: center; padding: 16px; color: var(--muted); font-size: 12px; }

/* ── LEAGUE TABS + RANK VISUALS (XP leaderboard spec) ── */
.league-tabs {
  display: flex; gap: 6px; padding: 0 16px 10px; flex-shrink: 0;
}
.ltab {
  flex: 1; min-height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-family: var(--font);
  font-size: 11px; font-weight: 700; cursor: pointer;
}
.ltab.active { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.45); color: var(--gold); }

.lp-row.rank-1, .lp-row.rank-2, .lp-row.rank-3 { position: relative; }
.lp-row.rank-1 {
  border-color: rgba(255,215,0,.55);
  box-shadow: 0 0 16px 4px rgba(255,215,0,.25);
  animation: goldPulse 2s infinite;
}
.lp-row.rank-2 {
  border-color: rgba(192,192,192,.5);
  box-shadow: 0 0 12px 3px rgba(192,192,192,.2);
  animation: silverPulse 2.5s infinite;
}
.lp-row.rank-3 {
  border-color: rgba(205,127,50,.5);
  box-shadow: 0 0 10px 3px rgba(205,127,50,.2);
}
.lp-row.rank-top10 { border: 2px solid #FF6B35; }
.lp-row.rank-top100 { border: 1px solid rgba(255,255,255,.28); }

.lp-av-rank { position: relative; }
.lp-crown {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 11px; line-height: 1; pointer-events: none;
}
.lp-badge { margin-left: 4px; font-size: 12px; }

.chat-username.rank-1 { color: #FFD700 !important; font-weight: 900; }
.chat-username.rank-2 { color: #C0C0C0 !important; font-weight: 700; }
.chat-username.rank-3 { color: #CD7F32 !important; font-weight: 700; }
.chat-username.rank-top10 { color: #FF6B35 !important; }
.chat-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; padding: 1px 5px; border-radius: 6px; margin-left: 4px;
  background: linear-gradient(135deg, #FFD700, #FF8C00); color: #111;
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 16px 4px rgba(255,215,0,.25); }
  50% { box-shadow: 0 0 28px 10px rgba(255,215,0,.45); }
}
@keyframes silverPulse {
  0%, 100% { box-shadow: 0 0 12px 3px rgba(192,192,192,.2); }
  50% { box-shadow: 0 0 20px 8px rgba(192,192,192,.35); }
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: .65; }
}

/* ── OG VIRAL CARD ── */
.og-overlay {
  position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.65);
  display: flex; align-items: flex-end; justify-content: center;
}
.og-sheet {
  width: 100%; max-width: 430px; background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(20px + var(--safe-bot)); border-top: 1px solid var(--border);
}
.og-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 12px; }
.og-stitle { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 12px; text-align: center; }
.og-close {
  width: 100%; margin-top: 12px; padding: 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-family: var(--font); font-size: 13px; font-weight: 700; cursor: pointer;
}
.og-viral-card {
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(220,38,38,.08));
  border: 1px solid rgba(37,99,235,.25); border-radius: var(--r-lg); padding: 14px; overflow: hidden;
}
.og-vc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.og-vc-logo { font-size: 12px; font-weight: 800; color: var(--text); }
.og-vc-tag { font-size: 10px; font-weight: 700; color: var(--blue-l); background: rgba(37,99,235,.15); padding: 3px 8px; border-radius: 20px; }
.og-vc-body { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.og-vc-av {
  width: 48px; height: 48px; border-radius: 50%; background: rgba(37,99,235,.25); color: var(--blue-l);
  border: 2px solid var(--blue); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.og-vc-title { font-size: 15px; font-weight: 800; color: var(--text); }
.og-vc-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.og-vc-link { font-size: 10px; color: var(--muted); margin-bottom: 8px; }

/* ── ARENA SPLASH (boot → fun mix) ── */
.arena-splash {
  flex: 1; position: relative; overflow: hidden; min-height: 100%;
  padding: 0; background: #060a10;
}
.arena-splash-full {
  width: 100%; height: 100%; display: block; object-fit: cover;
  object-position: center center;
  animation: arenaSplashIn 0.55s ease-out;
}
@keyframes arenaSplashIn {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: none; }
}

/* ── DIRECT ENTRY GATE (legacy) ── */
.entry-gate {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  padding: calc(10px + var(--safe-top)) 18px calc(16px + var(--safe-bot));
}
.entry-topbar { flex-shrink: 0; margin-bottom: 8px; }
.entry-hero { text-align: center; padding: 12px 0 20px; flex-shrink: 0; }
.entry-logo { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.entry-title { font-size: 26px; font-weight: 900; letter-spacing: -0.5px; color: var(--text); }
.entry-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.entry-actions {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  gap: 14px; min-height: 0; padding: 8px 0;
}
.entry-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 20px 18px; border-radius: 20px;
  border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: right;
  transition: transform .12s ease, border-color .15s;
  font-family: var(--font); color: inherit;
}
.entry-card:active { transform: scale(0.97); }
.entry-card-glow {
  position: absolute; inset: 0; opacity: 0.35; pointer-events: none;
}
.entry-fun { border-color: rgba(245,158,11,.45); }
.entry-fun .entry-card-glow { background: radial-gradient(ellipse at 0% 50%, rgba(245,158,11,.25), transparent 70%); }
.entry-battle { border-color: rgba(220,38,38,.4); }
.entry-battle .entry-card-glow { background: radial-gradient(ellipse at 0% 50%, rgba(220,38,38,.22), transparent 70%); }
.entry-ico { font-size: 36px; flex-shrink: 0; line-height: 1; }
.entry-card-body { flex: 1; min-width: 0; }
.entry-card-name { display: block; font-size: 20px; font-weight: 900; color: var(--text); line-height: 1.2; }
.entry-card-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.entry-go { font-size: 22px; color: var(--muted); flex-shrink: 0; }
.entry-more {
  flex-shrink: 0; margin-top: 12px; align-self: center;
  background: transparent; border: none; color: var(--muted);
  font-family: var(--font); font-size: 12px; font-weight: 700; cursor: pointer;
}
.og-vc-cta { font-size: 13px; font-weight: 800; color: var(--green-l); text-align: center; }
