/* =====================================================
   VIBRAMISSIONS — Daily Missions, XP, Achievements
   ===================================================== */

/* ── FAB Button ── */
.vm-fab {
  position: fixed;
  bottom: 90px;
  right: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border: none;
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(168,85,247,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}
.vm-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(168,85,247,0.7); }
.vm-fab-icon { font-size: 22px; }
.vm-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f43f5e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d0d1a;
  animation: vm-badge-pulse 2s ease-in-out infinite;
}
@keyframes vm-badge-pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ── Overlay & Panel ── */
.vm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.vm-overlay.vm-open { opacity: 1; pointer-events: all; }

.vm-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: #0d0d1a;
  border-left: 1px solid rgba(168,85,247,0.25);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.vm-panel.vm-open { transform: translateX(0); }

/* ── Header ── */
.vm-header {
  padding: 20px 20px 0;
  background: linear-gradient(180deg, rgba(124,58,237,0.15) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.vm-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.vm-title { font-size: 20px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.vm-title-icon { font-size: 24px; }
.vm-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.vm-close:hover { background: rgba(255,255,255,0.15); }

/* ── XP / Level Bar ── */
.vm-level-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.vm-level-badge {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(168,85,247,0.5);
}
.vm-level-badge span:first-child { font-size: 7px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.vm-level-badge span:last-child { font-size: 16px; font-weight: 900; line-height: 1; }
.vm-xp-col { flex: 1; }
.vm-xp-label { display: flex; justify-content: space-between; font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 5px; }
.vm-xp-bar {
  height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden;
}
.vm-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a855f7, #c084fc);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.vm-xp-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 6px;
  background: #fff;
  border-radius: 3px;
  opacity: 0.6;
  filter: blur(1px);
}
.vm-vbc-pill {
  display: flex; align-items: center; gap: 4px;
  background: rgba(251,191,36,0.12);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px; font-weight: 700; color: #fbbf24;
}

/* ── Tabs ── */
.vm-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 0 0;
  margin-bottom: -1px;
}
.vm-tab {
  padding: 8px 16px;
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.4);
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.vm-tab.active { color: #a855f7; border-bottom-color: #a855f7; }

/* ── Scroll Body ── */
.vm-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(168,85,247,0.3) transparent;
}
.vm-body::-webkit-scrollbar { width: 4px; }
.vm-body::-webkit-scrollbar-track { background: transparent; }
.vm-body::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.3); border-radius: 2px; }

/* ── Sections ── */
.vm-section { margin-bottom: 20px; }
.vm-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,0.35);
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.vm-section-title::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(255,255,255,0.06);
}

/* ── Streak Banner ── */
.vm-streak {
  background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(249,115,22,0.12));
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.vm-streak-fire { font-size: 32px; animation: vm-fire 1.5s ease-in-out infinite; }
@keyframes vm-fire {
  0%,100% { transform: scale(1) rotate(-3deg); }
  50% { transform: scale(1.15) rotate(3deg); }
}
.vm-streak-info { flex: 1; }
.vm-streak-count { font-size: 22px; font-weight: 900; color: #fbbf24; line-height: 1; }
.vm-streak-label { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.vm-streak-bonus {
  font-size: 11px; font-weight: 700; color: #fb923c;
  background: rgba(251,146,60,0.15); border: 1px solid rgba(251,146,60,0.3);
  border-radius: 8px; padding: 4px 8px; text-align: center;
}

/* ── Mission Card ── */
.vm-mission {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 8px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}
.vm-mission:hover { border-color: rgba(168,85,247,0.3); background: rgba(168,85,247,0.06); }
.vm-mission.vm-done { opacity: 0.55; }
.vm-mission.vm-done::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.1);
}
.vm-mission-top { display: flex; align-items: flex-start; gap: 10px; }
.vm-mission-icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.vm-mission-info { flex: 1; }
.vm-mission-name { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.vm-mission-desc { font-size: 12px; color: rgba(255,255,255,0.45); line-height: 1.4; }
.vm-mission-rewards {
  display: flex; gap: 6px; align-items: center; flex-shrink: 0;
}
.vm-reward-xp {
  font-size: 11px; font-weight: 700; color: #818cf8;
  background: rgba(129,140,248,0.12); border: 1px solid rgba(129,140,248,0.2);
  border-radius: 6px; padding: 2px 6px;
}
.vm-reward-vbc {
  font-size: 11px; font-weight: 700; color: #fbbf24;
  background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.2);
  border-radius: 6px; padding: 2px 6px;
}
.vm-mission-progress { margin-top: 10px; }
.vm-progress-row {
  display: flex; justify-content: space-between;
  font-size: 11px; color: rgba(255,255,255,0.35); margin-bottom: 5px;
}
.vm-progress-bar {
  height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; overflow: hidden;
}
.vm-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.vm-claim-btn {
  margin-top: 10px;
  width: 100%; padding: 8px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none; border-radius: 8px;
  color: #fff; font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.vm-claim-btn:hover { opacity: 0.9; transform: scale(1.02); }
.vm-claim-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.vm-done-check {
  margin-top: 10px; text-align: center;
  font-size: 12px; color: #4ade80; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}

/* ── Achievement Badge ── */
.vm-badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.vm-badge-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.vm-badge-card.vm-unlocked {
  border-color: rgba(168,85,247,0.35);
  background: rgba(168,85,247,0.07);
}
.vm-badge-card.vm-unlocked:hover { transform: translateY(-3px); }
.vm-badge-card.vm-locked { filter: grayscale(1); opacity: 0.4; }
.vm-badge-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(168,85,247,0.2), transparent 70%);
  pointer-events: none;
}
.vm-badge-emoji { font-size: 28px; display: block; margin-bottom: 6px; }
.vm-badge-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.8); line-height: 1.3; }
.vm-badge-desc { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 3px; line-height: 1.3; }
.vm-badge-unlocked-tag {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px; background: rgba(74,222,128,0.2);
  color: #4ade80; border: 1px solid rgba(74,222,128,0.3);
  border-radius: 4px; padding: 1px 4px; font-weight: 700;
}

/* ── Leaderboard ── */
.vm-leaderboard { }
.vm-lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  transition: background 0.2s;
}
.vm-lb-row:hover { background: rgba(255,255,255,0.06); }
.vm-lb-row.vm-me {
  background: rgba(168,85,247,0.1);
  border-color: rgba(168,85,247,0.25);
}
.vm-lb-rank { font-size: 14px; font-weight: 900; color: rgba(255,255,255,0.25); width: 22px; text-align: center; }
.vm-lb-rank.top1 { color: #fbbf24; }
.vm-lb-rank.top2 { color: #94a3b8; }
.vm-lb-rank.top3 { color: #fb923c; }
.vm-lb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.vm-lb-name { flex: 1; font-size: 13px; font-weight: 600; color: #fff; }
.vm-lb-xp { font-size: 12px; font-weight: 700; color: #818cf8; }

/* ── Toast / Level-Up Overlay ── */
.vm-toast {
  position: fixed;
  bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: linear-gradient(135deg, #1e1b4b, #2e1065);
  border: 1px solid rgba(168,85,247,0.5);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(168,85,247,0.4);
}
.vm-toast.vm-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.vm-toast-icon { font-size: 28px; }
.vm-toast-text { }
.vm-toast-title { font-size: 14px; font-weight: 700; color: #fff; }
.vm-toast-sub { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }

/* ── Level-Up Full Screen ── */
.vm-levelup {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 3000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.vm-levelup.vm-show { opacity: 1; pointer-events: all; }
.vm-levelup-orb {
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, #c084fc, #7c3aed);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  box-shadow: 0 0 60px rgba(168,85,247,0.8), 0 0 120px rgba(168,85,247,0.3);
  animation: vm-orb-pulse 1s ease-in-out infinite alternate;
  margin-bottom: 28px;
}
@keyframes vm-orb-pulse {
  from { box-shadow: 0 0 40px rgba(168,85,247,0.6), 0 0 80px rgba(168,85,247,0.2); }
  to { box-shadow: 0 0 80px rgba(168,85,247,0.9), 0 0 160px rgba(168,85,247,0.4); }
}
.vm-levelup-n { font-size: 52px; font-weight: 900; color: #fff; line-height: 1; }
.vm-levelup-sub { font-size: 12px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 2px; }
.vm-levelup-title { font-size: 32px; font-weight: 900; color: #fff; margin-bottom: 8px; }
.vm-levelup-desc { font-size: 15px; color: rgba(255,255,255,0.5); margin-bottom: 28px; }
.vm-levelup-close {
  padding: 12px 32px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none; border-radius: 12px;
  color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform 0.15s;
}
.vm-levelup-close:hover { transform: scale(1.05); }

/* ── Confetti Canvas ── */
#vm-confetti {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 2999;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .vm-panel { width: 100vw; }
  .vm-badges-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
