/* ─────────────────────────────────────────────────────────────────────────
   Icey Design System · v5 — Roblox Hype
   Dark navy · Ice blue · Glassmorphism · Aurora borealis · Game UI vibes
───────────────────────────────────────────────────────────────────────── */

/* ── 1 · Custom properties ──────────────────────────────────────────────── */
:root {
  /* Base */
  --bg-primary:   #050d1a;
  --bg-secondary: #0a1628;
  --bg-card:      rgba(255,255,255,0.05);

  /* Legacy aliases kept for backward compat */
  --bg:  #050d1a;
  --bg2: #0a1628;
  --surface:  rgba(255,255,255,.05);
  --surface2: rgba(255,255,255,.08);
  --surface3: rgba(77,217,255,.06);
  --border:   rgba(77,217,255,.12);
  --border2:  rgba(77,217,255,.22);
  --border3:  rgba(77,217,255,.38);

  /* Accent */
  --accent-primary:   #4dd9ff;
  --accent-secondary: #0096c7;
  --accent-glow:      rgba(77,217,255,0.3);

  --accent:      #4dd9ff;
  --accent-rgb:  77,217,255;
  --accent-dim:  rgba(77,217,255,.09);
  --accent-glow-shadow: 0 0 20px rgba(77,217,255,.40), 0 0 60px rgba(77,217,255,.16);

  --accent2:     #00b4d8;
  --accent2-rgb: 0,180,216;
  --accent2-dim: rgba(0,180,216,.09);

  --blue:        #818cf8;
  --blue-rgb:    129,140,248;
  --blue-dim:    rgba(129,140,248,.09);

  /* Semantic */
  --success: #34d399;
  --danger:  #f87171;
  --warn:    #fbbf24;
  --gold:    #fcd34d;
  --silver:  #94a3b8;
  --bronze:  #d97706;

  /* Text */
  --text-primary:   #ffffff;
  --text-secondary: #8ba8c4;
  --text:   #e8f4ff;
  --muted:  rgba(232,244,255,.35);
  --muted2: rgba(232,244,255,.58);

  /* Rarity */
  --rarity-legendary: #ffd700;
  --rarity-godly:     #ff4444;
  --rarity-rare:      #4d79ff;
  --rarity-uncommon:  #9b59b6;
  --rarity-common:    #aaaaaa;

  /* Fonts */
  --font-body:    'Nunito', sans-serif;
  --font-heading: 'Exo 2', sans-serif;
  --font-brand:   'Exo 2', sans-serif;

  /* Radius */
  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.55), 0 0 12px rgba(77,217,255,.04);
  --shadow-md: 0 6px 24px rgba(0,0,0,.65), 0 0 30px rgba(77,217,255,.07);
  --shadow-lg: 0 10px 48px rgba(0,0,0,.75), 0 0 60px rgba(77,217,255,.10);

  /* Layout */
  --nav-h:    64px;
  --ticker-h: 64px;
  --max-w:    1200px;
}

/* ── 2 · Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--nav-h) + var(--ticker-h));
  min-height: 100vh;
  overflow-x: hidden;
}

/* Game map grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;

  background:
    radial-gradient(
      circle at center,
      rgba(77,217,255,.15),
      transparent 45%
    );
}

/* ── 3 · Aurora background ──────────────────────────────────────────────── */
.aurora-bg {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.aurora-bg::before {
  content: '';
  position: absolute;
  width: 180%; height: 70%;
  top: -30%; left: -40%;
  background:
    radial-gradient(ellipse 70% 80% at 30% 40%, rgba(0,180,216,.24) 0%, transparent 62%),
    radial-gradient(ellipse 55% 65% at 72% 30%, rgba(77,217,255,.18) 0%, transparent 58%),
    radial-gradient(ellipse 45% 55% at 52% 72%, rgba(129,140,248,.14) 0%, transparent 55%);
  filter: blur(60px);
  animation: aurora-a 24s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
.aurora-bg::after {
  content: '';
  position: absolute;
  width: 140%; height: 65%;
  bottom: -25%; right: -25%;
  background:
    radial-gradient(ellipse 60% 70% at 58% 45%, rgba(77,217,255,.14) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 22% 62%, rgba(0,180,216,.18) 0%, transparent 55%),
    radial-gradient(ellipse 35% 45% at 80% 75%, rgba(129,140,248,.10) 0%, transparent 50%);
  filter: blur(75px);
  animation: aurora-b 32s ease-in-out infinite alternate-reverse;
  will-change: transform, opacity;
}
@keyframes aurora-a {
  0%   { transform: translate(0,0)   scale(1);    opacity: .75; }
  50%  { transform: translate(7%,4%) scale(1.07); opacity: .55; }
  100% { transform: translate(-5%,8%) scale(.93); opacity: .85; }
}
@keyframes aurora-b {
  0%   { transform: translate(0,0)    scale(1);    opacity: .65; }
  50%  { transform: translate(-7%,5%) scale(1.05); opacity: .85; }
  100% { transform: translate(5%,-5%) scale(.96);  opacity: .50; }
}

/* ── 4 · Base typography ────────────────────────────────────────────────── */
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; color: #7ae8ff; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.75rem); }
h3 { font-size: 1.2rem; }

img    { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── 5 · Layout ─────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 1.5rem;
  width: 100%;
  position: relative;
  z-index: 2;
}
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.page-wrap { max-width: 960px; margin: 0 auto; }

/* ── 6 · Navigation ─────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(5,13,26,.90);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid rgba(77,217,255,.14);
  box-shadow: 0 0 30px rgba(0,0,0,.45), 0 2px 8px rgba(77,217,255,.06);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 200;
}

.nav-brand {
  font-family: var(--font-brand);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: .10em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #4dd9ff 0%, #00b4d8 45%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(77,217,255,.40));
  text-decoration: none !important;
  margin-right: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .45rem;
  transition: filter .2s, transform .2s;
}
.nav-brand:hover {
  filter: drop-shadow(0 0 22px rgba(77,217,255,.65)) brightness(1.12);
  transform: scale(1.04);
  text-decoration: none !important;
}
.nav-brand-img {
  display: inline-block;
  width: 28px; height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: nowrap;
}
.nav-link {
  font-size: .68rem;
  font-weight: 800;
  font-family: var(--font-heading);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted2);
  text-decoration: none;
  padding: .32rem .6rem;
  border-radius: var(--radius-sm);
  position: relative;
  white-space: nowrap;
  transition: color .15s, background .15s, box-shadow .15s;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), var(--accent2));
  border-radius: 99px;
  transform: scaleX(0);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.nav-link:hover {
  color: var(--text);
  background: rgba(77,217,255,.07);
  text-decoration: none;
}
.nav-link:hover::after { transform: scaleX(1); }
.nav-link--active { color: var(--accent); }
.nav-link--active::after { transform: scaleX(1); }

/* Nav right cluster: username + points + logout */
.nav-right {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(77,217,255,.30);
  object-fit: cover;
  flex-shrink: 0;
}
.nav-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(77,217,255,.20);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  background: rgba(77,217,255,.06);
}
.nav-username {
  font-family: var(--font-heading);
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted2);
  white-space: nowrap;
  letter-spacing: .03em;
}
.nav-points {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .9rem;
  background: rgba(77,217,255,.10);
  border: 1px solid rgba(77,217,255,.30);
  border-radius: 999px;
  font-family: var(--font-brand);
  font-size: .78rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: .04em;
  white-space: nowrap;
  text-decoration: none !important;
  animation: points-pulse 3.2s ease-in-out infinite;
  transition: background .2s, box-shadow .2s, transform .15s, animation-play-state .1s;
}
.nav-points:hover {
  background: rgba(77,217,255,.18);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(77,217,255,.45);
  text-decoration: none !important;
  animation-play-state: paused;
}
@keyframes points-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(77,217,255,.22); }
  50%       { box-shadow: 0 0 22px rgba(77,217,255,.55), 0 0 44px rgba(77,217,255,.18); }
}
.nav-logout {
  font-size: .65rem;
  font-weight: 800;
  font-family: var(--font-heading);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: .26rem .6rem;
  border: 1px solid rgba(248,113,113,.22);
  border-radius: var(--radius-sm);
  transition: color .15s, border-color .15s, background .15s;
}
.nav-logout:hover {
  color: var(--danger);
  border-color: rgba(248,113,113,.50);
  background: rgba(248,113,113,.08);
  text-decoration: none;
}

/* ── 7 · Flash messages ─────────────────────────────────────────────────── */
.flash-list {
  list-style: none;
  padding: .75rem 1.5rem 0;
  display: flex; flex-direction: column; gap: .4rem;
  position: relative; z-index: 2;
}
.flash {
  padding: .65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  border-left: 3px solid transparent;
  backdrop-filter: blur(10px);
}
.flash.success { background: rgba(52,211,153,.10);  border-color: var(--success); color: #6ee7b7; }
.flash.danger  { background: rgba(248,113,113,.10); border-color: var(--danger);  color: #fca5a5; }
.flash.info    { background: rgba(77,217,255,.10);  border-color: var(--accent);  color: var(--accent); }
.flash.warning { background: rgba(251,191,36,.10);  border-color: var(--warn);    color: var(--warn); }

/* ── 8 · Payout ticker — fixed below nav ───────────────────────────────── */
.payout-ticker {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  height: var(--ticker-h);
  background: rgba(3,9,20,.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(77,217,255,.10);
  box-shadow: 0 3px 14px rgba(0,0,0,.45);
  display: flex; align-items: center; overflow: hidden;
  z-index: 199;
}
.payout-ticker-label {
  flex-shrink: 0;
  padding: 0 1rem;
  font-family: var(--font-brand);
  font-size: .55rem; font-weight: 900;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent);
  border-right: 1px solid rgba(77,217,255,.14);
  white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  height: 100%;
  justify-content: center;
}
.payout-ticker-label::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: ticker-dot-pulse 1.4s ease-in-out infinite;
}
@keyframes ticker-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .45; transform: scale(.65); }
}
.payout-ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 52px, black calc(100% - 52px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, black 52px, black calc(100% - 52px), transparent 100%);
}
.payout-ticker-track:hover #payout-ticker-inner {
  animation-play-state: paused;
}
#payout-ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  white-space: nowrap;
  animation: ticker-scroll 35s linear infinite;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Ticker cards ── */
.ticker-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(77,217,255,.15);
  border-radius: 10px;
  padding: 0 9px;
  height: 46px;
  cursor: default;
  transition: border-color .15s;
}
.ticker-card:hover { border-color: rgba(77,217,255,.38); }
.ticker-card-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(77,217,255,.30);
}
.ticker-card-avatar--fb {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(77,217,255,.25);
  background: rgba(77,217,255,.10);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: .72rem; font-weight: 800;
  color: var(--accent);
}
.ticker-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ticker-card-name {
  font-family: var(--font-heading);
  font-size: .72rem; font-weight: 600;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ticker-card-name strong { font-weight: 800; color: var(--accent); }
.ticker-card-pts { color: #fcd34d; font-weight: 800; }
.ticker-card-sub {
  font-size: .6rem;
  color: var(--muted2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ticker-card-reward {
  font-family: var(--font-heading);
  font-size: .65rem; font-weight: 800;
  color: #fcd34d;
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 54px;
  flex-shrink: 0;
}
/* ── 9 · Footer ─────────────────────────────────────────────────────────── */
.footer {
  background: rgba(5,13,26,.85);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(77,217,255,.08);
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; align-items: center;
  gap: .6rem; text-align: center;
  font-size: .78rem; color: var(--muted2);
  position: relative; z-index: 2;
}
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.footer-link { color: var(--muted); font-size: .78rem; font-weight: 600; transition: color .15s; }
.footer-link:hover { color: var(--accent); text-decoration: none; }
.footer-copy { font-size: .75rem; color: var(--muted); }
.footer-social {
  display: flex; gap: .75rem; align-items: center; justify-content: center; flex-wrap: wrap;
}
.footer-social-link {
  color: var(--muted); transition: color .15s, transform .15s;
  display: flex; align-items: center;
}
.footer-social-link:hover { color: var(--accent); transform: translateY(-2px); }

/* ── 10 · Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: .45rem;
  padding: .6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 800;
  border: 1.5px solid transparent;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .18s, box-shadow .18s, border-color .18s, transform .12s, filter .15s;
  user-select: none;
  line-height: 1.4;
  cursor: pointer;
  letter-spacing: .03em;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, #4dd9ff, #00b4d8);
  color: #050d1a;
  border-color: transparent;
  font-family: var(--font-heading); font-weight: 900;
  box-shadow: 0 0 18px rgba(77,217,255,.30), 0 4px 14px rgba(0,0,0,.45);
}
.btn-primary:hover {
  filter: brightness(1.10);
  box-shadow: 0 0 36px rgba(77,217,255,.60), 0 6px 18px rgba(0,0,0,.5);
  transform: translateY(-2px);
  text-decoration: none !important;
}
.btn-secondary {
  background: rgba(0,180,216,.09);
  color: var(--accent2);
  border-color: rgba(0,180,216,.28);
}
.btn-secondary:hover {
  background: rgba(0,180,216,.16);
  border-color: var(--accent2);
  box-shadow: 0 0 20px rgba(0,180,216,.25);
  transform: translateY(-1px);
  text-decoration: none !important;
}
.btn-ghost {
  background: rgba(255,255,255,.05);
  color: var(--muted2);
  border-color: rgba(77,217,255,.14);
}
.btn-ghost:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(77,217,255,.30);
  text-decoration: none !important;
}
.btn-danger {
  background: rgba(248,113,113,.08);
  color: var(--danger);
  border-color: rgba(248,113,113,.22);
}
.btn-danger:hover { background: rgba(248,113,113,.16); box-shadow: 0 0 16px rgba(248,113,113,.22); text-decoration: none !important; }
.btn-success {
  background: rgba(52,211,153,.08);
  color: var(--success);
  border-color: rgba(52,211,153,.25);
}
.btn-success:hover { background: rgba(52,211,153,.16); text-decoration: none !important; }
.btn-lg { padding: .85rem 2.2rem; font-size: 1.05rem; border-radius: var(--radius); }
.btn-sm { padding: .28rem .7rem; font-size: .78rem; }

/* ── 11 · Cards ─────────────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(77,217,255,.12);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.card-glow:hover {
  border-color: rgba(77,217,255,.32);
  box-shadow: var(--shadow-md), 0 0 44px rgba(77,217,255,.10);
}
.card-header {
  font-family: var(--font-heading);
  font-size: .78rem; font-weight: 800;
  color: var(--accent);
  text-transform: uppercase; letter-spacing: .10em;
  margin-bottom: 1rem; padding-bottom: .65rem;
  border-bottom: 1px solid rgba(77,217,255,.08);
}
.card-title { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 800; }

.section-title {
  font-family: var(--font-heading);
  font-size: 1.65rem; font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--text);
  display: flex; align-items: center; gap: .75rem;
}
.section-title::after {
  content: ''; flex: 1; height: 2px; border-radius: 99px;
  background: linear-gradient(to right, var(--accent), var(--accent2), rgba(129,140,248,.4), transparent);
}

/* ── 12 · Item / Reward grid ────────────────────────────────────────────── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.item-card {
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(77,217,255,.12);
  border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .18s;
}
.item-card:hover {
  border-color: rgba(77,217,255,.35);
  box-shadow: 0 0 32px rgba(77,217,255,.12), var(--shadow-md);
  transform: translateY(-5px);
}
.item-card-img-wrap {
  aspect-ratio: 1; background: rgba(255,255,255,.05);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.item-card-img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; }
.item-card-placeholder { font-size: 3rem; color: var(--muted); user-select: none; }
.item-card-body { padding: .875rem; flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.item-card-name { font-family: var(--font-heading); font-size: 1rem; font-weight: 800; line-height: 1.3; }
.item-card-cost { font-family: var(--font-brand); font-size: .78rem; font-weight: 800; color: var(--accent); letter-spacing: .02em; margin-top: auto; padding-top: .3rem; }
.item-card-stock { font-size: .75rem; color: var(--muted); }
.item-card-footer { padding: .7rem .875rem; border-top: 1px solid rgba(77,217,255,.07); background: rgba(255,255,255,.02); }

/* ── 13 · Game badge pills ──────────────────────────────────────────────── */
.game-badge {
  display: inline-block;
  padding: .14rem .55rem; border-radius: var(--radius-sm);
  font-size: .65rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
}
.game-adopt-me    { background: rgba(249,168,212,.14); color: #f9a8d4; }
.game-mm2         { background: rgba(252,165,165,.14); color: #fca5a5; }
.game-blox-fruits { background: rgba(253,186,116,.14); color: #fdba74; }
.game-pet-sim     { background: rgba(103,232,249,.12); color: #67e8f9; }
.game-royale-high { background: rgba(196,181,253,.12); color: #c4b5fd; }
.game-default     { background: rgba(77,217,255,.10);  color: var(--accent); }

/* ── 14 · Lootbox case-opening cards ────────────────────────────────────── */
/*
 * CS:GO / hellcase / clash.gg style cases. Rarity tier is set in the template
 * from box.point_cost via .case-card--<tier>, which only assigns the two tier
 * variables below; every visual (ribbon, radial, glow, sparkles, divider,
 * thumb borders, button) reads from them. All motion is CSS-only and limited
 * to transform/opacity.
 *
 * Grid: auto-fill 3–4 cols desktop · 2 cols tablet (≤768px) · 1 col phone
 * (≤480px). Tablet/phone overrides live in the responsive media blocks.
 */
.lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.4rem;
}

.case-card {
  /* Rarity defaults (overridden per-tier). --tier-rgb feeds rgba() glows. */
  --tier-color: var(--accent);
  --tier-rgb: var(--accent-rgb);

  position: relative;
  /* Roughly 2:3 — fixed display height + natural info height so the OPEN
     button never clips under overflow:hidden. */
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(13,24,42,.92), rgba(6,13,24,.96));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(var(--tier-rgb), .3);
  border-radius: 8px;            /* sharper than soft cards */
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 16px 34px rgba(0,0,0,.6),
    0 4px 10px rgba(0,0,0,.5);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  will-change: transform;
}
.case-card:hover,
.case-card:active {
  transform: translateY(-4px);
  border-color: rgba(var(--tier-rgb), .65);
  box-shadow:
    0 22px 44px rgba(0,0,0,.66),
    0 0 30px rgba(var(--tier-rgb), .28);
}

/* Opening pulse driven by lootbox.js toggling .lb-spinning. */
.lb-spinning {
  animation: lb-opening-pulse .55s ease-in-out infinite alternate !important;
  transform: none !important;
}
@keyframes lb-opening-pulse {
  from { box-shadow: 0 0 14px rgba(var(--tier-rgb),.35); }
  to   { box-shadow: 0 0 52px rgba(var(--tier-rgb),.75), 0 0 80px rgba(var(--tier-rgb),.30); }
}

/* ── Rarity tiers (vivid) ── */
.case-card--common    { --tier-color: #9aa0a6; --tier-rgb: 154,160,166; }
.case-card--uncommon  { --tier-color: #4ade80; --tier-rgb: 74,222,128; }
.case-card--rare      { --tier-color: #4dd9ff; --tier-rgb: 77,217,255; }
.case-card--epic      { --tier-color: #a855f7; --tier-rgb: 168,85,247; }
.case-card--legendary { --tier-color: #f59e0b; --tier-rgb: 245,158,11; }

/* ── Case display area (angled top) ── */
.case-display {
  position: relative;
  flex: none;
  height: 190px;
  overflow: hidden;
  /* Sharp diagonal cut along the bottom edge. */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - 26px));
  background:
    radial-gradient(120% 95% at 50% 32%,
      rgba(var(--tier-rgb), .55) 0%,
      rgba(var(--tier-rgb), .2) 38%,
      rgba(6,13,24,.2) 68%,
      rgba(6,13,24,0) 100%),
    linear-gradient(180deg, rgba(var(--tier-rgb), .12), rgba(6,13,24,0));
}

/* Diagonal moving stripe overlay — translate (GPU), not background-position. */
.case-stripes {
  position: absolute; inset: -60%;
  background: repeating-linear-gradient(
    45deg,
    transparent 0 14px,
    rgba(255,255,255,.05) 14px 28px);
  opacity: .45;
  pointer-events: none;
  will-change: transform;
  animation: case-stripe 9s linear infinite;
}
@keyframes case-stripe { to { transform: translate(28px, 28px); } }

/* Angled corner ribbon (top-left). */
.case-ribbon {
  position: absolute;
  top: 16px; left: -36px;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, var(--tier-color), rgba(var(--tier-rgb), .65));
  color: #08111f;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: .58rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: .28rem 2.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  z-index: 3;
}

/* Chest + halo */
.case-chest-wrap {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding-bottom: 22px;   /* lift chest above the diagonal cut */
  z-index: 2;
}
.case-chest-wrap::before {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 210px; height: 210px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(var(--tier-rgb), .5) 0%,
    rgba(var(--tier-rgb), .16) 46%,
    transparent 70%);
  pointer-events: none;
}
.case-chest {
  position: relative;
  z-index: 1;
  height: 165px; width: auto;
  will-change: transform;
  filter: drop-shadow(0 8px 16px rgba(var(--tier-rgb), .55));
  animation: case-wobble 3s ease-in-out infinite;
}
@keyframes case-wobble {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

/* Sparkles — only on epic & legendary. */
.case-sparkle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,.9), 0 0 14px rgba(var(--tier-rgb), .8);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  display: none;
  animation: case-sparkle 2.3s ease-in-out infinite;
}
@keyframes case-sparkle {
  0%, 100% { opacity: 0; transform: scale(.3); }
  50%      { opacity: 1; transform: scale(1); }
}
.case-sparkle--1 { top: 24%; left: 26%; animation-delay: 0s;   }
.case-sparkle--2 { top: 30%; right: 24%; animation-delay: .5s;  }
.case-sparkle--3 { top: 58%; left: 30%; animation-delay: 1s;   width: 5px; height: 5px; }
.case-sparkle--4 { top: 50%; right: 28%; animation-delay: 1.5s; width: 5px; height: 5px; }
.case-sparkle--5 { top: 38%; left: 50%; animation-delay: .8s;  width: 7px; height: 7px; }
/* Epic: 3 sparkles. Legendary: all 5 + gold tint + brighter glow. */
.case-card--epic .case-sparkle--1,
.case-card--epic .case-sparkle--2,
.case-card--epic .case-sparkle--3,
.case-card--legendary .case-sparkle { display: block; }
.case-card--legendary .case-sparkle {
  background: #ffe9b0;
  box-shadow: 0 0 9px rgba(255,210,120,.95), 0 0 18px rgba(245,158,11,.85);
}

/* ── Bottom info area (dark glass; card bg shows through the diagonal) ── */
.case-info {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: .4rem;
  padding: .35rem 1rem 1rem;
  text-align: center;
}
.case-name {
  font-family: var(--font-heading);
  font-size: 1.12rem; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #fff;
  line-height: 1.15;
  margin-top: .1rem;
}
.case-divider {
  width: 46px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--tier-color), transparent);
  box-shadow: 0 0 6px rgba(var(--tier-rgb), .7);
}
.case-price {
  display: flex; align-items: baseline; gap: .3rem;
  font-family: var(--font-brand);
}
.case-price-icon { font-size: .95rem; }
.case-price-val  {
  font-size: 1.5rem; font-weight: 800;
  color: var(--tier-color);
  letter-spacing: .01em;
}
.case-price-unit {
  font-size: .68rem; font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
}

/* VIEW DROPS button (opens the drop-chances modal) */
.dc-view-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  margin: .05rem 0 .1rem;
  padding: .28rem .7rem;
  background: rgba(var(--tier-rgb), .1);
  border: 1px solid rgba(var(--tier-rgb), .4);
  border-radius: 999px;
  color: var(--tier-color);
  font-family: var(--font-brand);
  font-size: .68rem; font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}
.dc-view-btn:hover {
  background: rgba(var(--tier-rgb), .18);
  border-color: rgba(var(--tier-rgb), .65);
  transform: translateY(-1px);
}
.dc-view-icon { font-size: .8rem; line-height: 1; }

/* ── Open button ── */
.lb-open-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: .65rem 1rem;
  border-radius: 6px;
  font-family: var(--font-brand);
  font-size: .9rem; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter .15s ease, transform .12s ease, box-shadow .15s ease;
}
.lb-open-btn:not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, var(--tier-color), rgba(var(--tier-rgb), .7));
  border-color: rgba(var(--tier-rgb), .6);
  box-shadow: 0 0 18px rgba(var(--tier-rgb), .42);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.lb-open-btn:not(:disabled):hover {
  filter: brightness(1.1);
  transform: skewX(-3deg);
  box-shadow: 0 0 28px rgba(var(--tier-rgb), .6);
}
/* Shimmer sweep — transform only. */
.lb-open-btn:not(:disabled)::after {
  content: '';
  position: absolute;
  top: 0; left: -75%;
  width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-18deg);
  will-change: transform;
  animation: lb-shimmer 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lb-shimmer {
  0%        { transform: translateX(0) skewX(-18deg); }
  55%, 100% { transform: translateX(330%) skewX(-18deg); }
}
/* Locked state — dark, still styled. */
.lb-open-btn--locked {
  color: rgba(var(--tier-rgb), .8);
  background: rgba(8,16,28,.85);
  border-color: rgba(var(--tier-rgb), .25);
  cursor: not-allowed;
}

.lb-error { font-size: .8rem; color: var(--danger); font-weight: 600; margin-top: .15rem; min-height: 1.1em; text-align: center; }

/* ── Drop-chances modal (read-only; one element reused for all cases) ────── */
.dc-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dc-modal[hidden] { display: none !important; }
.dc-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(3,8,20,.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dc-modal-box {
  position: relative;
  width: 100%; max-width: 480px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  background: rgba(8,16,28,.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(77,217,255,.22);
  border-radius: 14px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(77,217,255,.12);
  overflow: hidden;
  animation: dc-modal-in .22s cubic-bezier(.34,1.4,.64,1);
}
@keyframes dc-modal-in {
  from { opacity: 0; transform: scale(.94) translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.dc-modal-header {
  position: sticky; top: 0;
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem;
  background: rgba(10,22,40,.98);
  border-bottom: 1px solid rgba(77,217,255,.16);
}
.dc-modal-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.dc-modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted2);
  font-size: 1.05rem; line-height: 1;
  padding: .35rem .55rem; border-radius: 6px;
  transition: color .15s, background .15s;
}
.dc-modal-close:hover { color: #fff; background: rgba(255,255,255,.07); }
.dc-modal-list {
  overflow-y: auto;
  padding: .7rem;
  display: flex; flex-direction: column; gap: .45rem;
}

/* Prize rows */
.dc-row {
  --row-rarity: var(--accent);
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .75rem .55rem .95rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.dc-row-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--row-rarity);
  box-shadow: 0 0 8px var(--row-rarity);
}
.dc-row--common    { --row-rarity: #9aa0a6; }
.dc-row--uncommon  { --row-rarity: #4ade80; }
.dc-row--rare      { --row-rarity: #4dd9ff; }
.dc-row--epic      { --row-rarity: #a855f7; }
.dc-row--legendary { --row-rarity: #f59e0b; }
.dc-row-thumb {
  width: 42px; height: 42px; flex: none;
  border-radius: 6px;
  border: 1px solid rgba(var(--accent-rgb), .2);
  background: rgba(var(--accent-rgb), .07);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.dc-row-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.dc-row-thumb-ph  { font-size: 1.05rem; color: rgba(var(--accent-rgb), .7); }
.dc-row-name {
  flex: 1; min-width: 0;
  font-size: .9rem; font-weight: 600;
  color: #fff;
  word-break: break-word;
}
.dc-row-pct {
  flex: none;
  font-family: var(--font-brand);
  font-size: .95rem; font-weight: 800;
  color: var(--row-rarity);
  white-space: nowrap;
}

/* Full-screen modal on phones */
@media (max-width: 480px) {
  .dc-modal { padding: 0; }
  .dc-modal-box {
    max-width: none; width: 100%; height: 100%; max-height: 100%;
    border: none; border-radius: 0;
  }
}

/* ── 15 · Lootbox reel overlay ──────────────────────────────────────────── */
#lb-reel-overlay {
  position: fixed; inset: 0;
  background: rgba(3,8,20,.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  z-index: 950;
  animation: overlay-in .22s ease;
}
#lb-reel-overlay[hidden] { display: none !important; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

#lb-reel-box {
  background: rgba(5,13,26,.96);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(77,217,255,.22);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(77,217,255,.12);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem 1.75rem;
  width: min(660px, 96vw);
  text-align: center;
  animation: reel-box-in .3s cubic-bezier(.34,1.4,.64,1);
}
@keyframes reel-box-in {
  from { opacity: 0; transform: scale(.88) translateY(28px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.lb-reel-header {
  font-family: var(--font-brand);
  font-size: 1.15rem; font-weight: 800;
  color: var(--text); margin-bottom: 1.25rem; letter-spacing: .04em;
}
.lb-reel-viewport {
  position: relative; width: 100%; height: 132px;
  overflow: hidden; border-radius: var(--radius);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(77,217,255,.15);
  box-shadow: inset 0 2px 14px rgba(77,217,255,.06);
}
.lb-reel-track { display: flex; align-items: center; height: 100%; gap: 8px; padding: 0 6px; will-change: transform; }
.lb-reel-tile {
  flex-shrink: 0; width: 110px; height: 116px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(77,217,255,.10);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .35rem; overflow: hidden; user-select: none;
  transition: border-color .15s;
}
.lb-reel-tile--win {
  border-color: var(--accent);
  background: rgba(77,217,255,.05);
  box-shadow: 0 0 22px rgba(77,217,255,.45), 0 0 55px rgba(77,217,255,.18);
  animation: lb-win-bounce .65s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes lb-win-bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.09); }
  70%  { transform: scale(.97); }
  100% { transform: scale(1.04); }
}
.lb-reel-tile-img-wrap {
  width: 64px; height: 64px;
  background: rgba(255,255,255,.06); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
}
.lb-reel-tile-img  { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.lb-reel-tile-name {
  font-size: .6rem; font-weight: 700; color: var(--muted2);
  text-align: center; line-height: 1.2; max-width: 96px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.lb-reel-marker {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%); width: 118px;
  border-left: 2px solid rgba(77,217,255,.65);
  border-right: 2px solid rgba(77,217,255,.65);
  pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 20px rgba(77,217,255,.06);
}
.lb-reel-marker::before, .lb-reel-marker::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); width: 0; height: 0;
}
.lb-reel-marker::before { top: -1px; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid rgba(77,217,255,.70); }
.lb-reel-marker::after  { bottom: -1px; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid rgba(77,217,255,.70); }
.lb-reel-fade { position: absolute; top: 0; bottom: 0; width: 90px; z-index: 3; pointer-events: none; }
.lb-reel-fade--left  { left: 0;  background: linear-gradient(to right, rgba(5,13,26,.95), transparent); }
.lb-reel-fade--right { right: 0; background: linear-gradient(to left,  rgba(5,13,26,.95), transparent); }

.lb-reel-result {
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  margin-top: 1.5rem;
  animation: result-slide-in .45s cubic-bezier(.34,1.4,.64,1);
}
.lb-reel-result[hidden] { display: none !important; }
@keyframes result-slide-in {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.lb-reel-won-label {
  font-family: var(--font-brand); font-size: 1.7rem; font-weight: 900;
  background: linear-gradient(135deg, #4dd9ff, #00b4d8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.lb-reel-won-img   { width: 100px; height: 100px; object-fit: contain; margin: 0 auto; border-radius: var(--radius); background: rgba(255,255,255,.05); padding: .5rem; border: 1px solid rgba(77,217,255,.22); box-shadow: var(--shadow-md), 0 0 28px rgba(77,217,255,.16); }
.lb-reel-won-name  { font-family: var(--font-heading); font-size: 1.3rem; font-weight: 800; color: var(--text); }
.lb-reel-won-game  { display: inline-block; padding: .18rem .65rem; border-radius: var(--radius-sm); font-size: .75rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; background: rgba(77,217,255,.10); color: var(--accent); border: 1px solid rgba(77,217,255,.22); }
.lb-reel-won-sub   { font-size: .82rem; font-weight: 600; color: var(--success); display: flex; align-items: center; gap: .3rem; }
.lb-reel-won-sub::before { content: "✓"; font-weight: 800; }
.lb-reel-result-btns { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; margin-top: .25rem; }

/* ── 16 · SVG icon masks ─────────────────────────────────────────────────── */
.inv-src-icon {
  display: inline-block; width: 11px; height: 11px;
  vertical-align: text-bottom; flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: contain;
  mask-repeat: no-repeat; mask-position: center; mask-size: contain;
}
.inv-src-icon--lootbox { -webkit-mask-image: url('/static/images/lootbox-chest.svg'); mask-image: url('/static/images/lootbox-chest.svg'); }
.inv-src-icon--reward  { -webkit-mask-image: url('/static/images/reward-trophy2.svg'); mask-image: url('/static/images/reward-trophy2.svg'); }

.svg-placeholder {
  display: inline-block;
  background-color: rgba(77,217,255,.20);
  -webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: contain;
  mask-repeat: no-repeat; mask-position: center; mask-size: contain;
}
.svg-placeholder--box      { -webkit-mask-image: url('/static/images/lootbox-chest.svg');      mask-image: url('/static/images/lootbox-chest.svg'); }
.svg-placeholder--item     { -webkit-mask-image: url('/static/images/reward-star.svg');         mask-image: url('/static/images/reward-star.svg'); }
.svg-placeholder--backpack { -webkit-mask-image: url('/static/images/inventory-backpack.svg');  mask-image: url('/static/images/inventory-backpack.svg'); }
.svg-placeholder--notes    { -webkit-mask-image: url('/static/images/coin-banknotes.svg');      mask-image: url('/static/images/coin-banknotes.svg'); }
.svg-placeholder--gift     { -webkit-mask-image: url('/static/images/reward-gift.svg');         mask-image: url('/static/images/reward-gift.svg'); }
.svg-placeholder--wallet   { -webkit-mask-image: url('/static/images/withdrawal-wallet.svg');   mask-image: url('/static/images/withdrawal-wallet.svg'); }

/* ── 17 · Leaderboard rank badges ───────────────────────────────────────── */
.lb-rank-badge {
  display: inline-flex; width: 28px; height: 28px;
  border-radius: 50%; font-size: .8rem; font-weight: 900;
  font-family: var(--font-heading);
  align-items: center; justify-content: center; letter-spacing: 0;
}
.lb-rank--gold   { background: rgba(252,211,77,.14); color: var(--gold);   border: 1.5px solid rgba(252,211,77,.32); box-shadow: 0 0 10px rgba(252,211,77,.20); }
.lb-rank--silver { background: rgba(148,163,184,.10); color: var(--silver); border: 1.5px solid rgba(148,163,184,.24); }
.lb-rank--bronze { background: rgba(215,119,6,.10);   color: var(--bronze); border: 1.5px solid rgba(215,119,6,.24); }

/* ── 18 · Stat cards ────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 1rem; }
.stat-card {
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(77,217,255,.12); border-radius: var(--radius);
  padding: 1.1rem; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .18s;
}
.stat-card:hover {
  border-color: rgba(77,217,255,.32);
  box-shadow: 0 0 28px rgba(77,217,255,.10), var(--shadow-md);
  transform: translateY(-2px);
}
.stat-val   { display: block; font-family: var(--font-brand); font-size: 1.9rem; font-weight: 800; color: var(--accent); letter-spacing: .01em; }
.stat-label { display: block; font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-top: .25rem; }

/* ── 19 · Empty states ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 2rem; color: var(--muted2);
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
.empty-state p { margin: 0; }
.empty-state-icon { display: block; }

/* ── 20 · Form elements ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-label { font-size: .8rem; font-weight: 700; color: var(--muted2); letter-spacing: .04em; text-transform: uppercase; }
.form-input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(77,217,255,.15);
  border-radius: var(--radius-sm);
  color: var(--text); padding: .6rem .9rem; font-size: .9rem;
  transition: border-color .18s, box-shadow .18s, background .18s;
  outline: none;
}
.form-input::placeholder { color: var(--muted); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77,217,255,.12);
  background: rgba(255,255,255,.09);
}

/* ── 21 · Prize pool chips ──────────────────────────────────────────────── */
.lb-prizes { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .25rem; }
.lb-prizes-label { width: 100%; font-size: .67rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .15rem; }
.lb-prize-chip { font-size: .72rem; padding: .11rem .44rem; border-radius: var(--radius-sm); background: rgba(255,255,255,.06); color: var(--muted2); border: 1px solid rgba(77,217,255,.10); white-space: nowrap; }
.lb-prize-more { background: rgba(77,217,255,.10); color: var(--accent); border-color: rgba(77,217,255,.22); }

/* ── 22 · Rarity badges ─────────────────────────────────────────────────── */
.rarity-badge {
  display: inline-block;
  padding: .12rem .52rem;
  border-radius: var(--radius-sm);
  font-size: .62rem; font-weight: 900;
  letter-spacing: .07em; text-transform: uppercase; white-space: nowrap;
}
.rarity-legendary { background: rgba(255,215,0,.16); color: var(--rarity-legendary); border: 1px solid rgba(255,215,0,.32); box-shadow: 0 0 8px rgba(255,215,0,.20); }
.rarity-godly     { background: rgba(255,68,68,.16);  color: var(--rarity-godly);    border: 1px solid rgba(255,68,68,.32); box-shadow: 0 0 8px rgba(255,68,68,.18); }
.rarity-rare      { background: rgba(77,121,255,.16); color: var(--rarity-rare);     border: 1px solid rgba(77,121,255,.32); }
.rarity-uncommon  { background: rgba(155,89,182,.16); color: var(--rarity-uncommon); border: 1px solid rgba(155,89,182,.28); }
.rarity-common    { background: rgba(170,170,170,.10); color: var(--rarity-common);  border: 1px solid rgba(170,170,170,.20); }

/* ── 23 · Animations ────────────────────────────────────────────────────── */
@keyframes float-bob {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-14px); }
}
@keyframes float-bob-2 {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,.05) 25%,
    rgba(255,255,255,.11) 50%,
    rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shine-sweep {
  0%   { transform: translateX(-100%) skewX(-15deg); }
  100% { transform: translateX(300%) skewX(-15deg); }
}

/* ── 24 · Utility ───────────────────────────────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warn     { color: var(--warn); }
.text-gold     { color: var(--gold); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }

/* ── 25 · Responsive — base (legacy kept) ───────────────────────────────── */
@media (max-width: 768px) {
  .nav-username { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE v2 — Full Mobile-First Overhaul + Performance
   Breakpoints: 480px · 768px · 769px+ · 1200px+
─────────────────────────────────────────────────────────────────────────── */

/* ── Touch: remove 300ms tap delay everywhere ───────────────────────────── */
button, a, [role="button"], input[type="submit"], input[type="button"] {
  touch-action: manipulation;
}

/* ── Prevent iOS zoom on input focus ────────────────────────────────────── */
input, select, textarea { font-size: max(16px, 1em); }

/* ── iOS momentum scroll on scrollable containers ───────────────────────── */
.payout-ticker-track,
.lp-games-marquee-wrap,
.rw-stepper,
.wd-history-table-wrap,
.earn-recent-list,
.lp-activity-list,
.lb-table-wrap { -webkit-overflow-scrolling: touch; }

/* ── Performance: contain heavy card grids ──────────────────────────────── */
.item-grid,
.lb-grid,
.dash-stats,
.dash-actions,
.earn-missions-grid { contain: layout style; }

/* ── Hamburger button ───────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: rgba(77,217,255,.06);
  border: 1px solid rgba(77,217,255,.14);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  touch-action: manipulation;
}
.nav-hamburger:hover { background: rgba(77,217,255,.12); border-color: rgba(77,217,255,.28); }
.nav-hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--muted2);
  border-radius: 2px;
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .2s, background .15s;
  pointer-events: none;
}
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--accent); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--accent); }

/* Mobile-only points badge shown next to logo */
.nav-pts-mobile { display: none; }

/* ── Mobile slide-down menu ─────────────────────────────────────────────── */
.nav-mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: rgba(4,11,23,.98);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-bottom: 1px solid rgba(77,217,255,.14);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 201;
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), opacity .28s;
  opacity: 0;
  pointer-events: none;
}
.nav-mobile-menu.is-open { max-height: 100vh; opacity: 1; pointer-events: auto; }
.nav-mobile-inner { display: flex; flex-direction: column; padding: .5rem 0 1rem; }
.nav-mobile-link {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 1.5rem;
  font-family: var(--font-heading);
  font-size: .95rem; font-weight: 800;
  color: var(--muted2);
  letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid rgba(77,217,255,.06);
  text-decoration: none !important;
  transition: color .15s, background .15s;
}
.nav-mobile-link:hover, .nav-mobile-link:active {
  color: var(--accent);
  background: rgba(77,217,255,.06);
  text-decoration: none !important;
}
.nav-mobile-link--active { color: var(--accent); }
.nav-mobile-logout {
  display: block;
  margin: .75rem 1.5rem 0;
  text-align: center;
  color: var(--danger);
  font-family: var(--font-heading); font-size: .85rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .65rem;
  border: 1px solid rgba(248,113,113,.22);
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  transition: background .15s, border-color .15s;
  touch-action: manipulation;
}
.nav-mobile-logout:hover { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.4); text-decoration: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   TABLET — max-width: 768px
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Nav: switch to hamburger */
  .nav-hamburger  { display: flex; }
  .nav-links      { display: none !important; }
  .nav-right      { display: none !important; }
  .nav-pts-mobile {
    display: inline-flex;
    margin-left: auto;
    margin-right: .4rem;
    font-size: .72rem;
    padding: .22rem .65rem;
    animation: none;
  }
  .nav-brand { margin-right: 0; }

  /* Ticker: compact cards */
  .ticker-card { width: 175px; padding: 0 7px; }
  .ticker-card-avatar, .ticker-card-avatar--fb { width: 24px; height: 24px; font-size: .62rem; }
  .ticker-card-name   { font-size: .65rem; }
  .ticker-card-sub    { font-size: .55rem; }

  /* Aurora off on mobile — huge paint savings */
  .aurora-bg::before, .aurora-bg::after { animation: none; }

  /* Disable heavy float/bob animations */
  .lp-float-card { animation: none !important; }

  /* Cases: 2 columns on tablet, lighter motion */
  .lb-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .case-card { will-change: auto; }
  .case-chest { animation: none; }              /* disable wobble on mobile */
  .case-stripes { animation-duration: 14s; }    /* slower stripe drift */
  .lb-open-btn:not(:disabled)::after { animation-duration: 4s; } /* slower shimmer */
  /* Reduce sparkles to 2 on small screens */
  .case-card--epic .case-sparkle--3,
  .case-card--legendary .case-sparkle--3,
  .case-card--legendary .case-sparkle--4,
  .case-card--legendary .case-sparkle--5 { display: none; }

  /* Layout */
  .main { padding: 1rem; }

  /* Item grid: 2 columns */
  .item-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

  /* Stats grid: 2x2 */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Section titles */
  .section-title { font-size: 1.35rem; }

  /* Tap targets: 44px min */
  .btn      { min-height: 44px; }
  .btn-sm   { min-height: 36px; }
  .nav-link { min-height: 44px; display: inline-flex; align-items: center; }

  /* ── Index landing ── */
  .lp { gap: 3.5rem; }
  .lp-hero { padding: 1.5rem 0 0; min-height: auto; }
  .lp-cta-row { flex-direction: column; }
  .lp-cta-row .btn { width: 100%; justify-content: center; }
  .lp-title { font-size: clamp(2.2rem, 9vw, 3rem); }
  .lp-final-cta { padding: 3rem 1rem; }
  .lp-rewards-grid { grid-template-columns: repeat(2, 1fr); }
  .lp-how-steps { flex-direction: column; align-items: stretch; }
  .lp-how-arrow { transform: rotate(90deg); align-self: center; }
  .lp-activity { max-width: 100%; }

  /* ── Dashboard ── */
  .dash-hero-inner  { flex-direction: column; align-items: flex-start; }
  .dash-hero-right  { display: block !important; width: 100%; margin-top: 1rem; }
  .dash-pts-display { padding: 1rem 1.5rem; flex-direction: row; align-items: center; gap: 1rem; justify-content: center; }
  .dash-pts-num     { font-size: clamp(2rem, 8vw, 3rem); }
  .dash-stats       { grid-template-columns: repeat(2, 1fr); }
  .dash-actions     { grid-template-columns: 1fr; }
  .dash-cols        { grid-template-columns: 1fr; }

  /* ── Earn ── */
  .earn-missions-grid { grid-template-columns: 1fr; }
  .earn-quest-steps   { flex-direction: column; }
  .earn-quest-arrow   { transform: rotate(90deg); padding: .3rem 0; align-self: center; }
  .earn-offerwall-inner { min-height: 260px; }
  .earn-header-title  { font-size: clamp(2rem, 8vw, 3.5rem); }

  /* ── Leaderboard ── */
  .lb-tabs { width: 100%; }
  .lb-tab  { flex: 1; text-align: center; }
  .lb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Withdrawal ── */
  .wd-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .wd-tab  { white-space: nowrap; flex-shrink: 0; }
  .inv-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .rw-grid  { grid-template-columns: repeat(2, 1fr); }
  .rw-stepper-label { font-size: .55rem; }
  .im-steps-mini { flex-direction: column; gap: .2rem; }
  .im-steps-mini span:nth-child(even) { display: none; }

  /* ── Lootbox grid ── */
  .lb-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 1rem; }
}

/* Earn missions: 2-col on mid-size tablets */
@media (min-width: 481px) and (max-width: 768px) {
  .earn-missions-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE — max-width: 480px
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  :root { --nav-h: 56px; --ticker-h: 50px; }

  .nav-brand      { font-size: 1.2rem; }
  .nav-pts-mobile { font-size: .66rem; padding: .18rem .5rem; }

  /* Ticker */
  .ticker-card { width: 160px; height: 40px; padding: 0 6px; }

  /* Layout */
  .main { padding: .75rem; }
  .card { padding: 1rem; }
  .section-title { font-size: 1.1rem; margin-bottom: .9rem; }

  /* Item grid */
  .item-grid { gap: .75rem; }
  .item-card-body  { padding: .65rem; }
  .item-card-name  { font-size: .88rem; }
  .item-card-cost  { font-size: .72rem; }
  .item-card-footer { padding: .55rem .65rem; }

  /* Lootbox: 1 col on very small screens */
  .lb-grid { grid-template-columns: 1fr !important; }

  /* Lootbox reel modal */
  #lb-reel-box { padding: 1.5rem 1rem 1.25rem; }
  .lb-reel-viewport { height: 110px; }
  .lb-reel-tile { width: 88px; height: 94px; }
  .lb-reel-tile-img-wrap { width: 50px; height: 50px; }
  .lb-reel-marker { width: 96px; }

  /* Stats */
  .stat-val { font-size: 1.6rem; }

  /* Index */
  .lp-title { font-size: clamp(1.9rem, 11vw, 2.6rem); }
  .lp-sub   { font-size: .9rem; }
  .lp-social-proof { font-size: .74rem; gap: .3rem; }
  .lp-rewards-grid { gap: .75rem; }
  .lp-rw-card  { padding: 1rem .75rem; }
  .lp-rw-emoji { font-size: 2.2rem; }
  .lp-final-cta { padding: 2.5rem .75rem; }
  .lp-final-heading { font-size: clamp(1.6rem, 8vw, 2.4rem); }

  /* Dashboard */
  .dash-hero      { padding: 1.25rem; }
  .dash-hero-name { font-size: 1.5rem; }
  .dash-pts-num   { font-size: 2rem; }
  .dash-pts-display { padding: .85rem 1rem; gap: .75rem; }
  .dash-action    { padding: 1rem; gap: .75rem; }
  .dash-action-icon { width: 44px; height: 44px; font-size: 1.5rem; }

  /* Earn */
  .earn-missions-grid { grid-template-columns: 1fr; }
  .mission-card   { flex-wrap: wrap; gap: .75rem; }
  .mission-pts    { font-size: 1rem; }
  .mission-btn    { width: 100%; justify-content: center; }
  .earn-balance-inner { font-size: clamp(1.4rem, 6vw, 2rem); padding: .4rem 1rem; }

  /* Withdrawal */
  .wd-page { padding: 0; }
  .inv-grid { gap: .75rem; }
  .rw-balance-strip { flex-direction: column; }
  .rw-summary { max-width: 100%; }
  .rw-checkbox-label { max-width: 100%; }
  .rw-step-nav { flex-direction: column; }
  .rw-step-nav .btn { width: 100%; justify-content: center; }
  .rw-step-nav--right { flex-direction: row !important; }

  /* Legal */
  .legal-page { padding: 1rem .75rem; }
  .legal-card  { padding: 1.25rem 1rem; }
  .legal-title { font-size: 1.4rem; }

  /* Rewards header */
  .rwd-header { flex-direction: column; align-items: flex-start; }
  .lb-header  { flex-direction: column; align-items: flex-start; }

  /* Form inputs: exactly 16px to block iOS zoom */
  .form-input, .lm-input { font-size: 16px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   LARGE DESKTOP — min-width: 1200px
══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1200px) {
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .lb-grid   { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; }
}

/* ── Admin panel — mobile sidebar ───────────────────────────────────────── */
.adm-ham {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer; color: var(--text);
  font-size: 1.1rem; flex-shrink: 0;
  touch-action: manipulation;
}
.adm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 49;
}
.adm-overlay.is-open { display: block; }
@media (max-width: 900px) {
  .adm-sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 50;
  }
  .adm-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.7);
  }
  .adm-main    { margin-left: 0; }
  .adm-topbar  { padding: .75rem 1rem; }
  .adm-content { padding: 1.25rem 1rem; overflow-x: auto; }
  .adm-ham     { display: flex !important; }
  .adm-table   { min-width: 520px; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── 26 · Avatar components ─────────────────────────────────────────────── */
.avatar-circle {
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  box-shadow: 0 0 8px rgba(77,217,255,.35);
  flex-shrink: 0;
  display: block;
}
.avatar-fallback {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Exo 2', sans-serif;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  font-size: .85em;
}

/* Leaderboard avatars */
.lb-player-cell { display: flex; align-items: center; gap: .65rem; }
.lb-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 8px rgba(77,217,255,.35);
  flex-shrink: 0;
  object-fit: cover;
}
div.lb-avatar {
  background: linear-gradient(135deg, rgba(77,217,255,.25), rgba(129,140,248,.25));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 1rem; font-weight: 800; color: var(--accent);
}
.lb-avatar--gold   { border-color: #FFD700; box-shadow: 0 0 14px rgba(255,215,0,.50); }
.lb-avatar--silver { border-color: #C0C0C0; box-shadow: 0 0 14px rgba(192,192,192,.50); }
.lb-avatar--bronze { border-color: #CD7F32; box-shadow: 0 0 14px rgba(205,127,50,.50); }

