/* ==========================================================================
   AOI MINI-APP v3 — RECREATED MIDNIGHT OBSIDIAN & FROST CYAN UI (60FPS)
   - Zero light-theme color clashes (crisp AAA contrast across every card)
   - Zero wasted top whitespace (clean compact 58px glass header)
   - Zero scroll lag (no background-attachment:fixed, no heavy blur blobs)
   - Zero invisible avatars (always opacity: 1, crisp circular crop)
   - Zero Rank #1 crown overlap
   ========================================================================== */

:root {
  --bg-color: #060d19 !important;
  --bg-elevated: #0c172a !important;
  --bg-card: #101f38 !important;
  --bg-card-hover: #152847 !important;
  --panel-bg: rgba(16, 31, 56, 0.94) !important;
  --glass-bg: rgba(16, 31, 56, 0.94) !important;
  --glass-border: rgba(125, 211, 252, 0.16) !important;
  --glass-border-strong: rgba(125, 211, 252, 0.34) !important;
  --text-primary: #f1f7ff !important;
  --text-secondary: #93adc9 !important;
  --accent-cyan: #38bdf8;
  --accent-ice: #7dd3fc;
  --accent-gold: #fbbf24;
  --accent-rose: #fb7185;
  --header-height: 60px !important;
  --nav-height: 66px !important;
}

html,
body {
  background: linear-gradient(180deg, #060d19 0%, #091529 55%, #0b1b33 100%) !important;
  background-attachment: scroll !important;
  color: var(--text-primary) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Remove heavy lag-inducing blobs & invisible frost strip */
.bg-blobs,
.winter-frost-banner,
#splash-screen,
.splash-screen {
  display: none !important;
}

.app-container {
  background: transparent !important;
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

/* ---------- 1. Compact Crisp Top Header ---------- */
.top-bar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--header-height) !important;
  background: rgba(8, 17, 32, 0.96) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid rgba(125, 211, 252, 0.16) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45) !important;
  padding: 0 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  z-index: 900 !important;
}

.top-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #fde68a, transparent);
  opacity: 0.85;
}

.stat-item {
  background: rgba(16, 33, 60, 0.95) !important;
  border: 1px solid rgba(125, 211, 252, 0.2) !important;
  border-radius: 999px !important;
  padding: 5px 10px !important;
  color: #f8fbff !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  box-shadow: none !important;
}

.user-meta {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
}

.top-bar #header-name,
.top-bar .user-info span {
  color: #f8fbff !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  line-height: 1.2 !important;
}

.top-bar .uid-tag,
#header-uid {
  color: #7dd3fc !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  opacity: 0.9 !important;
}

/* ---------- 2. Zero-Gap Main Scroll Area ---------- */
#main-content {
  margin-top: var(--header-height) !important;
  padding: 12px 14px 96px !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.panel-header,
.lb-header {
  margin: 0 0 12px 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.panel-header h2,
.lb-header h2 {
  margin: 0 !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em !important;
  color: #f8fbff !important;
}

/* ---------- 3. Recreated Feature Banners (Winter + Waifu Pass) ---------- */
.winter-entry-banner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 14px 15px !important;
  margin: 0 0 10px 0 !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, #0d2b4e 0%, #123c69 60%, #164e7a 100%) !important;
  border: 1px solid rgba(125, 211, 252, 0.42) !important;
  box-shadow: 0 8px 20px rgba(2, 10, 24, 0.45) !important;
  cursor: pointer;
}

.winter-entry-icon {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  background: rgba(56, 189, 248, 0.2) !important;
  border: 1px solid rgba(125, 211, 252, 0.4) !important;
  font-size: 22px !important;
}

.winter-entry-details h4 {
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  margin: 0 !important;
}

.winter-entry-details p {
  color: #bae6fd !important;
  font-size: 11.5px !important;
  margin: 3px 0 0 !important;
}

.winter-entry-cta {
  background: linear-gradient(90deg, #7dd3fc, #fde68a) !important;
  color: #061224 !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  padding: 6px 12px !important;
  border-radius: 999px !important;
}

.waifu-pass-banner {
  background: linear-gradient(135deg, #27122a 0%, #171c36 100%) !important;
  border: 1px solid rgba(251, 113, 133, 0.35) !important;
  border-radius: 16px !important;
  padding: 12px 15px !important;
  margin: 0 0 14px 0 !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35) !important;
}

.waifu-pass-banner h4 {
  color: #fff1f2 !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  margin: 0 !important;
}

.waifu-pass-banner p {
  color: #fda4af !important;
  font-size: 11.5px !important;
  margin: 2px 0 0 !important;
}

/* ---------- 4. Segmented Pill Switcher (Hunters / Guilds) ---------- */
.lb-switch {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
  padding: 4px !important;
  border-radius: 12px !important;
  background: #0c192e !important;
  border: 1px solid rgba(125, 211, 252, 0.16) !important;
  width: 100% !important;
}

.lb-btn {
  border: none !important;
  border-radius: 9px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #93adc9 !important;
  background: transparent !important;
  cursor: pointer;
}

.lb-btn.active {
  background: linear-gradient(90deg, #0284c7, #38bdf8) !important;
  color: #051120 !important;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3) !important;
}

/* ---------- 5. Clean 60fps Leaderboard Rows & Avatars ---------- */
.leaderboard-item,
.card,
.glass-card,
.guild-card,
.mission-card,
.shop-item {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.leaderboard-item {
  background: #101f38 !important;
  border: 1px solid rgba(125, 211, 252, 0.14) !important;
  border-radius: 15px !important;
  padding: 12px 14px !important;
  margin-bottom: 9px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28) !important;
  position: relative !important;
}

.leaderboard-item.rank-1 {
  background: linear-gradient(135deg, #1b2842 0%, #101f38 100%) !important;
  border-color: rgba(251, 191, 36, 0.42) !important;
}

/* Put #1 crown cleanly on top-left corner so it NEVER overlaps PTS */
.leaderboard-item.rank-1::after {
  content: '👑' !important;
  position: absolute !important;
  top: 4px !important;
  left: 8px !important;
  right: auto !important;
  transform: none !important;
  font-size: 11px !important;
  pointer-events: none !important;
}

.lb-rank {
  min-width: 30px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  color: #fbbf24 !important;
}

.lb-info {
  flex: 1 !important;
  min-width: 0 !important;
}

.lb-name {
  color: #f8fbff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.lb-meta {
  color: #93adc9 !important;
  font-size: 11.5px !important;
  margin-top: 2px !important;
}

.lb-score {
  text-align: right !important;
  flex-shrink: 0 !important;
}

.lb-xp {
  color: #7dd3fc !important;
  font-size: 14.5px !important;
  font-weight: 800 !important;
}

/* Guarantee EVERY avatar is visible, crisp, and never hidden at opacity: 0 */
img.winter-lazy-img,
img.winter-lazy-img.winter-lazy-loaded,
#user-avatar,
.lb-avatar,
.avatar,
.profile-avatar {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  animation: none !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  background: #0c2240 !important;
}

#user-avatar {
  width: 38px !important;
  height: 38px !important;
  border: 2px solid #38bdf8 !important;
}

.lb-avatar {
  width: 42px !important;
  height: 42px !important;
  flex-shrink: 0 !important;
  border: 1.5px solid rgba(125, 211, 252, 0.35) !important;
}

/* ---------- 6. Perfectly Centered 5-Tab Floating Bottom Nav ---------- */
.app-container {
  width: 100% !important;
  max-width: 520px !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#main-content {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 108px !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.bottom-nav {
  position: fixed !important;
  bottom: 12px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 24px) !important;
  max-width: 480px !important;
  margin: 0 !important;
  height: 62px !important;
  padding: 0 6px !important;
  border-radius: 22px !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: center !important;
  justify-items: center !important;
  background: rgba(9, 19, 36, 0.97) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(125, 211, 252, 0.22) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55) !important;
  box-sizing: border-box !important;
  z-index: 950 !important;
}

.nav-item {
  width: 100% !important;
  height: 50px !important;
  margin: 0 !important;
  padding: 4px 2px !important;
  border-radius: 14px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  color: #93adc9 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.nav-item.active {
  color: #7dd3fc !important;
  background: rgba(56, 189, 248, 0.12) !important;
}

/* Ensure all other tabs (Tasks, Shop, Guild, Games, Profile) also stay crisp dark-frost */
.task-card,
.shop-hub-card,
.guild-item,
.game-card,
.profile-section,
.profile-header-card {
  background: #101f38 !important;
  border: 1px solid rgba(125, 211, 252, 0.16) !important;
  color: #f1f7ff !important;
  box-sizing: border-box !important;
}
