/**
 * VapeVerse Gamification — Frontend CSS
 * Dark theme: #1a1a2e primary, #16213e secondary, #0f3460 accent, #e94560 highlight
 * Mobile-first, breakpoints: 480px, 768px, 1024px
 */

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --vv-bg-primary:    #1a1a2e;
  --vv-bg-secondary:  #16213e;
  --vv-bg-accent:     #0f3460;
  --vv-highlight:     #e94560;
  --vv-highlight-dim: rgba(233, 69, 96, 0.15);

  --vv-text-primary:  #e2e8f0;
  --vv-text-muted:    #94a3b8;
  --vv-text-dim:      #64748b;

  --vv-border:        rgba(255, 255, 255, 0.08);
  --vv-border-accent: rgba(233, 69, 96, 0.3);
  --vv-card-bg:       rgba(15, 52, 96, 0.4);
  --vv-glass:         rgba(22, 33, 62, 0.85);

  --vv-radius-sm:  6px;
  --vv-radius-md:  12px;
  --vv-radius-lg:  20px;
  --vv-radius-xl:  32px;
  --vv-radius-full: 9999px;

  --vv-shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --vv-shadow-md:  0 8px 24px rgba(0,0,0,0.4);
  --vv-shadow-lg:  0 16px 48px rgba(0,0,0,0.5);
  --vv-glow:       0 0 20px rgba(233, 69, 96, 0.25);
  --vv-glow-blue:  0 0 20px rgba(15, 52, 96, 0.6);

  --vv-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --vv-font-mono:   'SF Mono', 'Fira Code', Consolas, monospace;

  --vv-transition: 0.2s ease;
  --vv-transition-slow: 0.4s ease;

  /* Rank tier colors */
  --vv-rank-fresh:    #94a3b8;
  --vv-rank-regular:  #22c55e;
  --vv-rank-heavy:    #f59e0b;
  --vv-rank-elite:    #8b5cf6;
  --vv-rank-legend:   #ef4444;

  /* Rarity colors */
  --vv-rarity-common:    #94a3b8;
  --vv-rarity-uncommon:  #22c55e;
  --vv-rarity-rare:      #3b82f6;
  --vv-rarity-epic:      #8b5cf6;
  --vv-rarity-legendary: #f59e0b;

  /* Coin color */
  --vv-coin-color: #fbbf24;
}

/* ============================================================
   Base Reset (scoped to .vapeverse-* and .vv-*)
   ============================================================ */
.vapeverse-profile *,
.vv-myaccount-tab *,
.vv-popup *,
.vv-age-gate * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.vapeverse-profile,
.vv-myaccount-tab {
  font-family: var(--vv-font);
  color: var(--vv-text-primary);
  background-color: var(--vv-bg-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding: 16px;
}

@media (min-width: 768px) {
  .vapeverse-profile,
  .vv-myaccount-tab {
    padding: 32px;
  }
}

@media (min-width: 1024px) {
  .vapeverse-profile,
  .vv-myaccount-tab {
    padding: 40px;
    max-width: 1100px;
    margin: 0 auto;
  }
}

/* ============================================================
   Age Gate
   ============================================================ */
.vv-age-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 24px;
}

.vv-age-gate__inner {
  text-align: center;
  max-width: 400px;
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border-accent);
  border-radius: var(--vv-radius-lg);
  padding: 48px 32px;
  box-shadow: var(--vv-shadow-lg), var(--vv-glow);
  animation: vv-slide-up 0.4s ease;
}

.vv-age-gate__icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(233, 69, 96, 0.4));
}

.vv-age-gate__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--vv-highlight);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.vv-age-gate__text {
  color: var(--vv-text-muted);
  font-size: 15px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.vv-age-gate__actions {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

@media (min-width: 480px) {
  .vv-age-gate__actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* Blurred content behind age gate */
.vv-profile-content--blurred {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   Buttons
   ============================================================ */
.vv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--vv-radius-full);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--vv-font);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--vv-transition), box-shadow var(--vv-transition), background var(--vv-transition);
  border: 2px solid transparent;
  white-space: nowrap;
  line-height: 1;
}

.vv-btn--primary {
  background: var(--vv-highlight);
  color: #fff;
  border-color: var(--vv-highlight);
}

.vv-btn--primary:hover,
.vv-btn--primary:focus {
  background: #c73652;
  border-color: #c73652;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
  color: #fff;
  text-decoration: none;
}

.vv-btn--outline {
  background: transparent;
  color: var(--vv-text-primary);
  border-color: var(--vv-border);
}

.vv-btn--outline:hover,
.vv-btn--outline:focus {
  border-color: var(--vv-highlight);
  color: var(--vv-highlight);
  transform: translateY(-1px);
  text-decoration: none;
}

/* ============================================================
   Profile Page Layout
   ============================================================ */
.vv-profile-content {
  transition: filter var(--vv-transition-slow);
}

/* Profile Header */
.vv-profile-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--vv-shadow-md);
}

@media (min-width: 768px) {
  .vv-profile-header {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
}

.vv-profile-header--compact {
  padding: 20px;
}

.vv-profile-header__avatar {
  display: flex;
  justify-content: center;
}

@media (min-width: 768px) {
  .vv-profile-header__avatar {
    justify-content: flex-start;
  }
}

.vv-profile-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

@media (min-width: 768px) {
  .vv-profile-name {
    font-size: 30px;
  }
}

.vv-profile-city,
.vv-profile-since {
  font-size: 14px;
  color: var(--vv-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.vv-profile-header__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vv-profile-header__stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (min-width: 768px) {
  .vv-profile-header__stats {
    flex-direction: column;
    align-items: flex-end;
  }
}

/* Stat Boxes */
.vv-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--vv-bg-accent);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 12px 20px;
  min-width: 120px;
  transition: border-color var(--vv-transition), box-shadow var(--vv-transition);
}

.vv-stat-box:hover {
  border-color: var(--vv-border-accent);
  box-shadow: var(--vv-glow);
}

.vv-stat-box__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--vv-text-primary);
  font-family: var(--vv-font-mono);
  letter-spacing: -0.5px;
}

.vv-stat-box__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vv-text-muted);
  margin-top: 4px;
}

/* ============================================================
   Rank Badge
   ============================================================ */
.vv-rank-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--vv-radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
  margin-top: 8px;
  width: fit-content;
}

.vv-rank-badge--fresh_cloud {
  color: var(--vv-rank-fresh);
  background: rgba(148, 163, 184, 0.12);
  border-color: var(--vv-rank-fresh);
}

.vv-rank-badge--regular_clouder {
  color: var(--vv-rank-regular);
  background: rgba(34, 197, 94, 0.12);
  border-color: var(--vv-rank-regular);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.vv-rank-badge--heavy_vaper {
  color: var(--vv-rank-heavy);
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--vv-rank-heavy);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.vv-rank-badge--bahrain_vapor_elite {
  color: var(--vv-rank-elite);
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--vv-rank-elite);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}

.vv-rank-badge--cloud_legend {
  color: var(--vv-rank-legend);
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--vv-rank-legend);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
  animation: vv-legend-pulse 2.5s ease-in-out infinite;
}

@keyframes vv-legend-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.35); }
  50%       { box-shadow: 0 0 28px rgba(239, 68, 68, 0.65); }
}

/* ============================================================
   Progress Bar
   ============================================================ */
.vv-progress-section {
  margin-bottom: 24px;
}

.vv-progress-bar {
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 16px 20px;
}

.vv-progress-bar__track {
  background: rgba(255,255,255,0.07);
  border-radius: var(--vv-radius-full);
  height: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.vv-progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vv-bg-accent), var(--vv-highlight));
  border-radius: var(--vv-radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.vv-progress-bar__fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.6);
}

.vv-progress-bar__labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--vv-text-muted);
}

/* ============================================================
   Section Layout
   ============================================================ */
.vv-section {
  margin-bottom: 32px;
}

.vv-section__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--vv-border-accent);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

@media (min-width: 768px) {
  .vv-section__title {
    font-size: 20px;
  }
}

/* ============================================================
   Card Grid
   ============================================================ */
.vv-collection__header {
  margin-bottom: 20px;
}

.vv-collection__stats {
  font-size: 14px;
  color: var(--vv-text-muted);
  margin-bottom: 8px;
}

.vv-collection__progress-bar {
  background: rgba(255,255,255,0.07);
  border-radius: var(--vv-radius-full);
  height: 6px;
  overflow: hidden;
}

.vv-collection__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vv-bg-accent), var(--vv-highlight));
  border-radius: var(--vv-radius-full);
  transition: width 1s ease;
}

.vv-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 480px) {
  .vv-card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 768px) {
  .vv-card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .vv-card-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
  }
}

/* Individual Card */
.vv-card {
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  overflow: hidden;
  transition: transform var(--vv-transition), box-shadow var(--vv-transition), border-color var(--vv-transition);
  cursor: pointer;
  position: relative;
}

.vv-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--vv-shadow-lg);
}

.vv-card__image-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--vv-bg-accent);
}

.vv-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.vv-card:hover .vv-card__image {
  transform: scale(1.06);
}

.vv-card__body {
  padding: 10px;
}

.vv-card__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--vv-text-primary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .vv-card__name {
    font-size: 13px;
  }
}

.vv-card__badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.vv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--vv-radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid currentColor;
}

/* Rarity badges */
.vv-badge--rarity-common   { color: var(--vv-rarity-common);    background: rgba(148,163,184,0.1); }
.vv-badge--rarity-uncommon { color: var(--vv-rarity-uncommon);  background: rgba(34,197,94,0.1); }
.vv-badge--rarity-rare     { color: var(--vv-rarity-rare);      background: rgba(59,130,246,0.1); }
.vv-badge--rarity-epic     { color: var(--vv-rarity-epic);      background: rgba(139,92,246,0.1); }
.vv-badge--rarity-legendary { color: var(--vv-rarity-legendary); background: rgba(251,191,36,0.1); }

/* Variant badges */
.vv-badge--variant-normal { color: var(--vv-text-dim); background: rgba(100,116,139,0.1); }
.vv-badge--variant-foil   { color: #d4af37; background: rgba(212,175,55,0.1); }
.vv-badge--variant-holo   { color: #c084fc; background: rgba(192,132,252,0.1); }

.vv-card__copies {
  font-size: 11px;
  color: var(--vv-text-dim);
  font-family: var(--vv-font-mono);
}

/* Card Variant Glow Effects */
.vv-card--normal {
  border-color: var(--vv-border);
}

.vv-card--foil {
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.vv-card--foil:hover {
  box-shadow: 0 0 24px rgba(212, 175, 55, 0.4), var(--vv-shadow-lg);
}

.vv-card--holo {
  border-color: rgba(192, 132, 252, 0.5);
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.2);
}

.vv-card--holo:hover {
  box-shadow: 0 0 32px rgba(192, 132, 252, 0.5), var(--vv-shadow-lg);
}

/* Foil shimmer overlay */
.vv-card__variant-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.vv-card__variant-overlay--foil {
  background: linear-gradient(135deg,
    transparent 25%,
    rgba(212,175,55,0.15) 40%,
    rgba(255,255,255,0.12) 50%,
    rgba(212,175,55,0.1) 60%,
    transparent 75%
  );
  animation: vv-foil-shimmer 3s ease-in-out infinite;
}

.vv-card__variant-overlay--holo {
  background: linear-gradient(135deg,
    transparent 20%,
    rgba(255,100,180,0.12) 30%,
    rgba(100,180,255,0.12) 45%,
    rgba(180,100,255,0.12) 60%,
    rgba(100,255,180,0.12) 75%,
    transparent 85%
  );
  animation: vv-holo-shimmer 3.5s ease-in-out infinite;
}

@keyframes vv-foil-shimmer {
  0%, 100% { opacity: 0.6; transform: translateX(-10%); }
  50%       { opacity: 1;   transform: translateX(10%); }
}

@keyframes vv-holo-shimmer {
  0%   { filter: hue-rotate(0deg);   opacity: 0.7; }
  50%  { filter: hue-rotate(180deg); opacity: 1; }
  100% { filter: hue-rotate(360deg); opacity: 0.7; }
}

/* ============================================================
   Flavor DNA Chart
   ============================================================ */
.vv-flavor-chart {
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-lg);
  padding: 24px;
}

.vv-flavor-chart__canvas-wrap {
  max-width: 320px;
  margin: 0 auto 20px;
  position: relative;
}

.vv-flavor-chart-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
}

.vv-flavor-chart__top-flavor {
  text-align: center;
  font-size: 14px;
  color: var(--vv-text-muted);
  margin-top: 8px;
}

.vv-flavor-tag {
  display: inline-block;
  padding: 2px 12px;
  border-radius: var(--vv-radius-full);
  font-weight: 700;
  margin-left: 6px;
  font-size: 13px;
}

.vv-flavor-tag--fruit   { background: rgba(255,99,132,0.2);  color: #ff6384; }
.vv-flavor-tag--mint    { background: rgba(54,162,235,0.2);  color: #36a2eb; }
.vv-flavor-tag--tobacco { background: rgba(204,153,102,0.2); color: #cc9966; }
.vv-flavor-tag--dessert { background: rgba(255,159,64,0.2);  color: #ff9f40; }
.vv-flavor-tag--ice     { background: rgba(75,192,192,0.2);  color: #4bc0c0; }
.vv-flavor-tag--unknown { background: rgba(153,153,153,0.2); color: #999999; }

/* ============================================================
   Share Buttons
   ============================================================ */
.vv-share-section,
.vapeverse-share-buttons {
  margin-bottom: 24px;
}

.vv-share-buttons,
.vapeverse-share-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.vv-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--vv-radius-full);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--vv-transition), box-shadow var(--vv-transition);
  border: 1px solid var(--vv-border);
  background: var(--vv-card-bg);
  color: var(--vv-text-primary);
}

.vv-share-btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.vv-share-whatsapp:hover {
  background: rgba(37,211,102,0.15);
  border-color: #25d366;
  color: #25d366;
  box-shadow: 0 4px 12px rgba(37,211,102,0.2);
}

.vv-share-instagram:hover {
  background: rgba(225,48,108,0.15);
  border-color: #e1306c;
  color: #e1306c;
  box-shadow: 0 4px 12px rgba(225,48,108,0.2);
}

.vv-share-download:hover {
  background: rgba(59,130,246,0.15);
  border-color: #3b82f6;
  color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59,130,246,0.2);
}

/* ============================================================
   Badges Grid
   ============================================================ */
.vv-badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (min-width: 480px) {
  .vv-badge-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) {
  .vv-badge-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
  }
}

.vv-badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 12px 8px;
  text-align: center;
  transition: transform var(--vv-transition), box-shadow var(--vv-transition);
}

.vv-badge-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--vv-shadow-md);
  border-color: var(--vv-border-accent);
}

.vv-badge-item--locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.vv-badge-item__icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.vv-badge-item__name {
  font-size: 11px;
  color: var(--vv-text-muted);
  line-height: 1.3;
}

/* ============================================================
   Quest List
   ============================================================ */
.vv-quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vv-quest-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 14px 16px;
  transition: border-color var(--vv-transition);
}

.vv-quest-item:hover {
  border-color: var(--vv-border-accent);
}

.vv-quest-item--complete {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.05);
}

.vv-quest-item__icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--vv-bg-accent);
  border-radius: var(--vv-radius-md);
}

.vv-quest-item__info {
  flex: 1;
  min-width: 0;
}

.vv-quest-item__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--vv-text-primary);
  margin-bottom: 4px;
}

.vv-quest-item__desc {
  font-size: 12px;
  color: var(--vv-text-muted);
  margin-bottom: 6px;
}

.vv-quest-item__progress-bar {
  background: rgba(255,255,255,0.07);
  border-radius: var(--vv-radius-full);
  height: 5px;
  overflow: hidden;
}

.vv-quest-item__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vv-bg-accent), var(--vv-highlight));
  border-radius: var(--vv-radius-full);
  transition: width 0.8s ease;
}

.vv-quest-item__reward {
  font-size: 12px;
  font-weight: 700;
  color: var(--vv-coin-color);
  flex-shrink: 0;
  text-align: right;
}

/* ============================================================
   Leaderboard
   ============================================================ */
.vv-leaderboard {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.vv-leaderboard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.vv-leaderboard thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.vv-leaderboard thead th {
  background: var(--vv-bg-accent);
  color: var(--vv-text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--vv-border);
}

.vv-leaderboard tbody tr {
  background: var(--vv-bg-secondary);
  border-bottom: 1px solid var(--vv-border);
  transition: background var(--vv-transition);
}

.vv-leaderboard tbody tr:hover {
  background: rgba(15, 52, 96, 0.6);
}

.vv-leaderboard tbody tr.vv-leaderboard__row--current {
  background: rgba(233, 69, 96, 0.08);
  border-left: 3px solid var(--vv-highlight);
}

.vv-leaderboard tbody td {
  padding: 12px 16px;
  color: var(--vv-text-primary);
  vertical-align: middle;
}

.vv-leaderboard__rank-num {
  font-family: var(--vv-font-mono);
  font-weight: 700;
  color: var(--vv-text-muted);
  font-size: 15px;
}

.vv-leaderboard__rank-num--gold   { color: #fbbf24; }
.vv-leaderboard__rank-num--silver { color: #94a3b8; }
.vv-leaderboard__rank-num--bronze { color: #cd7f32; }

.vv-leaderboard__user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vv-leaderboard__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--vv-border);
}

.vv-leaderboard__name {
  font-weight: 600;
}

.vv-leaderboard__score {
  font-family: var(--vv-font-mono);
  font-weight: 700;
  color: var(--vv-highlight);
}

/* ============================================================
   Duel
   ============================================================ */
.vv-duel {
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border-accent);
  border-radius: var(--vv-radius-lg);
  padding: 24px;
  text-align: center;
}

.vv-duel__arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.vv-duel__player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.vv-duel__player-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--vv-border);
  object-fit: cover;
}

.vv-duel__player--challenger .vv-duel__player-avatar {
  border-color: var(--vv-highlight);
  box-shadow: 0 0 16px rgba(233, 69, 96, 0.4);
}

.vv-duel__player--defender .vv-duel__player-avatar {
  border-color: var(--vv-bg-accent);
  box-shadow: 0 0 16px rgba(15, 52, 96, 0.6);
}

.vv-duel__player-name {
  font-size: 14px;
  font-weight: 600;
}

.vv-duel__vs {
  font-size: 28px;
  font-weight: 900;
  color: var(--vv-highlight);
  flex-shrink: 0;
  text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
  animation: vv-vs-pulse 1.5s ease-in-out infinite;
}

@keyframes vv-vs-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}

.vv-duel__score-display {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 16px 0;
  font-size: 36px;
  font-weight: 900;
  font-family: var(--vv-font-mono);
}

.vv-duel__score--challenger { color: var(--vv-highlight); }
.vv-duel__score--separator  { color: var(--vv-text-dim); }
.vv-duel__score--defender   { color: #3b82f6; }

.vv-duel__status {
  font-size: 14px;
  color: var(--vv-text-muted);
  margin-bottom: 20px;
}

.vv-duel__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   Equipment Shop
   ============================================================ */
.vv-equipment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 480px) {
  .vv-equipment-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .vv-equipment-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .vv-equipment-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.vv-equipment-item {
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  overflow: hidden;
  transition: transform var(--vv-transition), box-shadow var(--vv-transition), border-color var(--vv-transition);
  display: flex;
  flex-direction: column;
}

.vv-equipment-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--vv-shadow-md);
  border-color: var(--vv-border-accent);
}

.vv-equipment-item--locked {
  opacity: 0.6;
}

.vv-equipment-item__image {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: var(--vv-bg-accent);
}

.vv-equipment-item__body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.vv-equipment-item__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--vv-text-primary);
  margin-bottom: 4px;
}

.vv-equipment-item__desc {
  font-size: 12px;
  color: var(--vv-text-muted);
  flex: 1;
  margin-bottom: 12px;
  line-height: 1.5;
}

.vv-equipment-item__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vv-equipment-item__price {
  font-size: 16px;
  font-weight: 700;
  color: var(--vv-coin-color);
  font-family: var(--vv-font-mono);
}

.vv-equipment-item__rank-req {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--vv-text-dim);
  padding: 2px 8px;
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-full);
}

/* ============================================================
   Avatar
   ============================================================ */
.vv-avatar {
  border-radius: 50%;
  border: 3px solid var(--vv-border);
  display: block;
  object-fit: cover;
  transition: border-color var(--vv-transition), box-shadow var(--vv-transition);
}

.vv-avatar:hover {
  border-color: var(--vv-highlight);
  box-shadow: var(--vv-glow);
}

.vv-avatar--sm  { width: 40px;  height: 40px; }
.vv-avatar--md  { width: 80px;  height: 80px; }
.vv-avatar--lg  { width: 120px; height: 120px; }
.vv-avatar--xl  { width: 160px; height: 160px; }

.vv-avatar-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.vv-avatar-change-btn {
  font-size: 12px;
  padding: 6px 14px;
}

/* Avatar equipped items overlay area */
.vv-avatar-wrap {
  position: relative;
  display: inline-flex;
}

.vv-avatar-equipment-overlay {
  position: absolute;
  bottom: 0;
  right: -4px;
}

/* ============================================================
   VaporCoins Display
   ============================================================ */
.vv-coins {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--vv-radius-full);
  padding: 6px 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--vv-coin-color);
  font-family: var(--vv-font-mono);
  transition: box-shadow var(--vv-transition);
}

.vv-coins:hover {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
}

.vv-coins__icon {
  font-size: 18px;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.6));
}

.vv-coins__amount {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.vv-coins__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(251, 191, 36, 0.7);
}

.vv-coins-balance-block {
  background: var(--vv-bg-secondary);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: var(--vv-radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.vv-coins-balance-block .vv-coins-icon-large {
  font-size: 40px;
  filter: drop-shadow(0 0 12px rgba(251,191,36,0.5));
}

.vv-coins-balance-block .vv-coins-value {
  font-size: 36px;
  font-weight: 900;
  color: var(--vv-coin-color);
  font-family: var(--vv-font-mono);
  letter-spacing: -1px;
}

.vv-coins-balance-block .vv-coins-sub {
  font-size: 13px;
  color: var(--vv-text-muted);
  margin-top: 2px;
}

/* ============================================================
   My Account Tab
   ============================================================ */
.vv-myaccount-tab {
  padding: 0;
  background: transparent;
}

.vv-public-profile-link {
  margin-bottom: 20px;
}

/* ============================================================
   Rank Change Popup
   ============================================================ */
.vv-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px;
  animation: vv-fade-in 0.3s ease;
}

.vv-popup__inner {
  position: relative;
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border-accent);
  border-radius: var(--vv-radius-xl);
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--vv-shadow-lg), var(--vv-glow);
  animation: vv-slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vv-popup__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--vv-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--vv-transition), color var(--vv-transition);
  line-height: 1;
  padding: 0;
}

.vv-popup__close:hover {
  background: rgba(233, 69, 96, 0.15);
  color: var(--vv-highlight);
}

.vv-popup__icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
  filter: drop-shadow(0 0 16px rgba(251,191,36,0.5));
  animation: vv-bounce-in 0.6s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.vv-popup__title {
  font-size: 24px;
  font-weight: 800;
  color: var(--vv-text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.vv-popup__message {
  font-size: 15px;
  color: var(--vv-text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

@keyframes vv-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes vv-slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes vv-bounce-in {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ============================================================
   Empty State
   ============================================================ */
.vv-empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--vv-text-muted);
  font-size: 14px;
  background: var(--vv-bg-secondary);
  border: 1px dashed var(--vv-border);
  border-radius: var(--vv-radius-md);
}

/* ============================================================
   Notification / Toast
   ============================================================ */
.vv-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  max-width: 340px;
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 14px 18px;
  color: var(--vv-text-primary);
  font-size: 14px;
  box-shadow: var(--vv-shadow-lg);
  animation: vv-toast-in 0.3s ease;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.vv-notification--success { border-left: 4px solid #22c55e; }
.vv-notification--error   { border-left: 4px solid var(--vv-highlight); }
.vv-notification--info    { border-left: 4px solid #3b82f6; }

@keyframes vv-toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   Utility / Loading
   ============================================================ */
.vv-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--vv-highlight);
  border-radius: 50%;
  animation: vv-spin 0.7s linear infinite;
}

@keyframes vv-spin {
  to { transform: rotate(360deg); }
}

.vv-skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--vv-radius-sm);
  animation: vv-skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes vv-skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ============================================================
   Responsive Adjustments
   ============================================================ */
@media (max-width: 479px) {
  .vv-profile-name { font-size: 20px; }
  .vv-stat-box__value { font-size: 18px; }
  .vv-share-btn span:last-child { display: none; } /* hide text labels on very small screens */
}

@media (min-width: 480px) {
  .vv-share-btn span:last-child { display: inline; }
}

/* Print styles — hide all VapeVerse UI chrome */
@media print {
  .vv-age-gate,
  .vv-popup,
  .vv-share-section,
  .vv-share-buttons,
  .vapeverse-share-buttons { display: none !important; }
}

/* ============================================================
   Feature 15: Vapor Arena — Battle System
   ============================================================ */

/* ── Arena wrapper ─────────────────────────────────────────── */
.vv-arena *,
.vv-battle-overlay * {
  box-sizing: border-box;
}

.vv-arena {
  font-family: var(--vv-font);
  color: var(--vv-text-primary);
  background: var(--vv-bg-primary);
  min-height: 100vh;
  padding: 0 0 40px;
}

/* ── Arena Header ──────────────────────────────────────────── */
.vv-arena__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--vv-bg-secondary);
  border-bottom: 1px solid var(--vv-border);
  flex-wrap: wrap;
  gap: 12px;
}

.vv-arena__title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--vv-highlight);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.vv-arena__title-icon {
  font-size: 1.4rem;
}

.vv-arena__balance {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-full);
  padding: 8px 16px;
}

.vv-arena__coin-icon {
  color: var(--vv-coin-color);
  font-size: 1.1rem;
}

.vv-arena__coin-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--vv-coin-color);
  transition: transform 0.3s ease;
}

.vv-coin-bump {
  animation: vv-coin-bump 0.5s ease;
}

@keyframes vv-coin-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); color: #ffd700; }
  100% { transform: scale(1); }
}

.vv-arena__coin-label {
  font-size: 0.85rem;
  color: var(--vv-text-muted);
}

/* ── Arena Sections ────────────────────────────────────────── */
.vv-arena__section {
  padding: 24px;
  border-bottom: 1px solid var(--vv-border);
}

.vv-arena__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.vv-arena__section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0 0 16px;
}

.vv-arena__section-header h3 {
  margin-bottom: 0;
}

.vv-arena__deck-counter {
  font-size: 0.85rem;
  color: var(--vv-text-muted);
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-full);
  padding: 4px 12px;
}

.vv-arena__deck-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border-accent);
  border-radius: var(--vv-radius-md);
  flex-wrap: wrap;
}

.vv-arena__empty {
  color: var(--vv-text-muted);
  font-style: italic;
  padding: 16px 0;
}

/* ── Stat Badges ───────────────────────────────────────────── */
.vv-stat {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--vv-radius-sm);
}

.vv-stat--atk {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.vv-stat--def {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.vv-stat--hp {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

/* ── Card Grid ─────────────────────────────────────────────── */
.vv-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.vv-card-item {
  background: var(--vv-card-bg);
  border: 2px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--vv-transition), transform var(--vv-transition), box-shadow var(--vv-transition);
  position: relative;
  user-select: none;
}

.vv-card-item:hover {
  border-color: rgba(233, 69, 96, 0.5);
  transform: translateY(-2px);
  box-shadow: var(--vv-shadow-md);
}

.vv-card-item--selected {
  border-color: var(--vv-highlight) !important;
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.3), var(--vv-shadow-md);
}

.vv-card-item--foil {
  background: linear-gradient(135deg, var(--vv-card-bg) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.vv-card-item--holo {
  background: linear-gradient(135deg, var(--vv-card-bg) 0%, rgba(251, 191, 36, 0.12) 100%);
}

.vv-card-item__thumb {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--vv-bg-accent);
}

.vv-card-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vv-card-item__info {
  padding: 6px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vv-card-item__name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--vv-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-card-item__stats {
  padding: 0 6px 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.vv-card-item__select-overlay {
  position: absolute;
  inset: 0;
  background: rgba(233, 69, 96, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--vv-transition);
  pointer-events: none;
}

.vv-card-item--selected .vv-card-item__select-overlay {
  opacity: 1;
}

.vv-card-item__check {
  background: var(--vv-highlight);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(233,69,96,0.4);
}

/* ── Variant badges ────────────────────────────────────────── */
.vv-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--vv-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.vv-badge--normal {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.vv-badge--foil {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.vv-badge--holo {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.vv-badge--boss {
  background: var(--vv-highlight);
  color: #fff;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

/* ── Tier headings ─────────────────────────────────────────── */
.vv-tier-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--vv-border);
}

.vv-tier-heading__stars {
  font-size: 1rem;
}

.vv-tier-heading__label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vv-text-muted);
}

.vv-tier-heading--1 .vv-tier-heading__stars { color: #94a3b8; }
.vv-tier-heading--2 .vv-tier-heading__stars { color: #22c55e; }
.vv-tier-heading--3 .vv-tier-heading__stars { color: #f59e0b; }
.vv-tier-heading--4 .vv-tier-heading__stars { color: #8b5cf6; }
.vv-tier-heading--5 .vv-tier-heading__stars { color: #ef4444; }

/* ── Monster Cards ─────────────────────────────────────────── */
.vv-monster-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color var(--vv-transition), box-shadow var(--vv-transition);
  position: relative;
}

.vv-monster-card:hover {
  border-color: rgba(233, 69, 96, 0.3);
  box-shadow: var(--vv-shadow-md);
}

.vv-monster-card--boss {
  border-color: rgba(233, 69, 96, 0.35);
  background: linear-gradient(135deg, var(--vv-card-bg) 0%, rgba(233,69,96,0.05) 100%);
}

.vv-monster-card--cooldown {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.vv-monster-card__image {
  width: 80px;
  height: 80px;
  border-radius: var(--vv-radius-sm);
  overflow: hidden;
  background: var(--vv-bg-accent);
  flex-shrink: 0;
}

.vv-monster-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.vv-monster-card__content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vv-monster-card__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0;
}

.vv-monster-card__desc {
  font-size: 0.8rem;
  color: var(--vv-text-muted);
  margin: 0;
  line-height: 1.4;
}

.vv-monster-card__stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.vv-monster-card__reward {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--vv-coin-color);
  font-weight: 600;
}

.vv-coin-icon {
  color: var(--vv-coin-color);
}

.vv-monster-card__action {
  flex-shrink: 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.vv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--vv-radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background var(--vv-transition), transform var(--vv-transition), box-shadow var(--vv-transition);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--vv-font);
}

.vv-btn--primary {
  background: var(--vv-highlight);
  color: #fff;
}

.vv-btn--primary:hover {
  background: #c73652;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.35);
}

.vv-btn--fight {
  background: linear-gradient(135deg, #e94560, #c73652);
  color: #fff;
  box-shadow: 0 2px 12px rgba(233, 69, 96, 0.3);
  animation: vv-fight-pulse 2.5s ease-in-out infinite;
}

.vv-btn--fight:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.vv-btn--fight:disabled {
  animation: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.vv-btn--disabled {
  background: var(--vv-bg-secondary);
  color: var(--vv-text-dim);
  cursor: not-allowed;
  border: 1px solid var(--vv-border);
}

@keyframes vv-fight-pulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(233, 69, 96, 0.3); }
  50%       { box-shadow: 0 4px 24px rgba(233, 69, 96, 0.55); }
}

/* ── Arena gate ────────────────────────────────────────────── */
.vv-arena-gate {
  padding: 48px 24px;
  text-align: center;
  color: var(--vv-text-muted);
}

/* ── Notice banner ─────────────────────────────────────────── */
.vv-notice {
  padding: 12px 20px;
  border-radius: var(--vv-radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.vv-notice--warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.vv-notice--error {
  background: rgba(233, 69, 96, 0.12);
  border: 1px solid var(--vv-border-accent);
  color: var(--vv-highlight);
}

.vv-notice--info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

/* ============================================================
   Battle Overlay / Modal
   ============================================================ */
body.vv-overlay-open {
  overflow: hidden;
}

.vv-battle-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.vv-battle-modal {
  background: var(--vv-bg-secondary);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--vv-shadow-lg), 0 0 60px rgba(233,69,96,0.1);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Battle Arena (the two-side layout) ──────────────────── */
.vv-battle-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 28px 24px 20px;
  background: linear-gradient(180deg, #0d1b3e 0%, var(--vv-bg-secondary) 100%);
  border-bottom: 1px solid var(--vv-border);
  min-height: 220px;
}

/* ── Battle sides ────────────────────────────────────────── */
.vv-battle-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.vv-battle-side__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vv-text-muted);
}

.vv-battle-side__sprite {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vv-deck-icon {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 12px rgba(59,130,246,0.4));
}

.vv-monster-sprite-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(233,69,96,0.35));
}

/* ── HP bars ─────────────────────────────────────────────── */
.vv-hp-bar-wrap {
  width: 100%;
  max-width: 120px;
  text-align: center;
}

.vv-hp-bar {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--vv-radius-full);
  overflow: hidden;
  margin-bottom: 4px;
}

.vv-hp-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: var(--vv-radius-full);
  transition: width 0.35s ease;
}

.vv-hp-bar__fill--monster {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.vv-hp-bar__fill--low {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
  animation: vv-hp-flicker 0.8s ease infinite;
}

@keyframes vv-hp-flicker {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

.vv-hp-bar__text {
  font-size: 0.72rem;
  color: var(--vv-text-muted);
  font-weight: 600;
}

/* ── VS divider ──────────────────────────────────────────── */
.vv-battle-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.vv-battle-vs__text {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--vv-highlight);
  text-shadow: 0 0 20px rgba(233,69,96,0.5);
  letter-spacing: 0.05em;
}

.vv-battle-round-info {
  font-size: 0.75rem;
  color: var(--vv-text-muted);
  text-align: center;
  min-height: 18px;
  font-weight: 600;
}

.vv-battle-loading {
  animation: vv-dots 1.2s ease infinite;
}

@keyframes vv-dots {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Sprite attack animations ────────────────────────────── */
@keyframes vv-attack-right {
  0%   { transform: translateX(0)   scale(1); }
  40%  { transform: translateX(24px) scale(1.08); }
  70%  { transform: translateX(16px) scale(1.04); }
  100% { transform: translateX(0)   scale(1); }
}

@keyframes vv-attack-left {
  0%   { transform: translateX(0)    scale(1); }
  40%  { transform: translateX(-24px) scale(1.08); }
  70%  { transform: translateX(-16px) scale(1.04); }
  100% { transform: translateX(0)    scale(1); }
}

@keyframes vv-hit-shake {
  0%, 100% { transform: translateX(0)  rotate(0deg); }
  20%       { transform: translateX(-6px) rotate(-2deg); }
  40%       { transform: translateX(6px)  rotate(2deg); }
  60%       { transform: translateX(-4px) rotate(-1deg); }
  80%       { transform: translateX(4px)  rotate(1deg); }
}

.vv-attack-right { animation: vv-attack-right 0.28s ease forwards; }
.vv-attack-left  { animation: vv-attack-left  0.28s ease forwards; }
.vv-hit-shake    { animation: vv-hit-shake    0.3s  ease forwards; }

/* ── Floating damage numbers ─────────────────────────────── */
.vv-floating-dmg {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  font-size: 1rem;
  font-weight: 900;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  transition: none;
}

.vv-floating-dmg--player  { color: #f87171; }
.vv-floating-dmg--monster { color: #60a5fa; }

.vv-floating-dmg--active {
  animation: vv-float-up 0.9s ease forwards;
}

@keyframes vv-float-up {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(-10px); }
  70%  { opacity: 1; transform: translateX(-50%) translateY(-32px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-44px); }
}

/* ── Battle Log ──────────────────────────────────────────── */
.vv-battle-log {
  padding: 12px 20px;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--vv-border);
  background: rgba(0,0,0,0.2);
}

.vv-log-row {
  padding: 4px 8px;
  border-radius: var(--vv-radius-sm);
  color: var(--vv-text-muted);
  animation: vv-log-fade 0.3s ease;
}

.vv-log-row:last-child {
  background: rgba(233,69,96,0.08);
  color: var(--vv-text-primary);
}

@keyframes vv-log-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vv-log-round    { font-weight: 700; color: var(--vv-text-primary); margin-right: 4px; }
.vv-log-player-dmg strong  { color: #f87171; }
.vv-log-monster-dmg strong { color: #60a5fa; }

/* ── Battle Result Banner ────────────────────────────────── */
.vv-battle-result {
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.vv-battle-result__title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-shadow: 0 0 30px currentColor;
}

.vv-result--win {
  color: #4ade80;
}

.vv-result--lose {
  color: var(--vv-highlight);
}

.vv-result--animate {
  animation: vv-result-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes vv-result-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

.vv-battle-result__details {
  font-size: 0.875rem;
  color: var(--vv-text-muted);
}

.vv-battle-result__details strong {
  color: var(--vv-text-primary);
}

.vv-coin-win {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--vv-coin-color);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--vv-radius-md);
  padding: 8px 20px;
  animation: vv-coin-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes vv-coin-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .vv-monster-card {
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto;
  }

  .vv-monster-card__action {
    grid-column: 1 / -1;
    text-align: center;
  }

  .vv-monster-card__image {
    width: 60px;
    height: 60px;
  }

  .vv-battle-arena {
    grid-template-columns: 1fr 32px 1fr;
    gap: 8px;
    padding: 20px 12px 16px;
  }

  .vv-battle-side__sprite,
  .vv-monster-sprite-img {
    width: 64px;
    height: 64px;
  }

  .vv-deck-icon {
    font-size: 2.5rem;
  }

  .vv-battle-vs__text {
    font-size: 1.1rem;
  }

  .vv-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}


/* ============================================================
   Phase 6 — Game Menu, Tutorial, Codex, Loot Popup
   ============================================================ */

/* ============================================================
   Scroll lock utility
   ============================================================ */
body.vv-scroll-lock {
  overflow: hidden;
}

/* ============================================================
   Game Menu (.vv-game-menu)
   ============================================================ */

/* --- Toggle button --- */
.vv-game-menu__toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--vv-bg-primary);
  border: 1.5px solid #8b5cf6;
  border-radius: var(--vv-radius-full);
  color: var(--vv-text-primary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--vv-shadow-md);
  transition: box-shadow var(--vv-transition), border-color var(--vv-transition), transform var(--vv-transition);
  white-space: nowrap;
}
.vv-game-menu__toggle:hover,
.vv-game-menu__toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(139,92,246,0.35), var(--vv-shadow-md);
  border-color: #a78bfa;
  outline: none;
  transform: translateY(-2px);
}
.vv-game-menu__toggle--active {
  background: #0f3460;
  border-color: #a78bfa;
}
.vv-game-menu__toggle-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.vv-game-menu__toggle-label {
  display: none;
}
@media (min-width: 768px) {
  .vv-game-menu__toggle-label {
    display: inline;
  }
}
.vv-game-menu__coin-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(245,197,24,0.15);
  border: 1px solid rgba(245,197,24,0.4);
  border-radius: var(--vv-radius-full);
  color: #f5c518;
  font-size: 0.75rem;
  font-weight: 700;
}

/* --- Panel --- */
.vv-game-menu__panel {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 9998;
  width: 100%;
  max-width: 360px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--vv-bg-secondary);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  padding: 0 0 24px;
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.3) transparent;
}
.vv-game-menu__panel--open {
  transform: translateY(0);
}
.vv-game-menu__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--vv-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--vv-radius-sm);
  transition: color var(--vv-transition);
  z-index: 2;
}
.vv-game-menu__close:hover {
  color: var(--vv-text-primary);
}

/* --- Header --- */
.vv-game-menu__header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--vv-border);
}
.vv-game-menu__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a78bfa;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.vv-game-menu__user-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.vv-game-menu__stat {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--vv-radius-sm);
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--vv-text-primary);
}
.vv-game-menu__stat-icon {
  font-size: 0.95rem;
}
.vv-game-menu__stat-value {
  font-weight: 600;
}

/* --- Nav links --- */
.vv-game-menu__nav {
  padding: 8px 0;
}
.vv-game-menu__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--vv-text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--vv-transition), color var(--vv-transition);
  position: relative;
}
.vv-game-menu__link:hover {
  background: rgba(139,92,246,0.1);
  color: #c4b5fd;
}
.vv-game-menu__link--active {
  color: #a78bfa;
  background: rgba(139,92,246,0.08);
  border-left: 3px solid #8b5cf6;
  padding-left: 17px;
}
.vv-game-menu__link--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.vv-game-menu__link-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.vv-game-menu__link-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b5cf6;
  margin-left: auto;
}

/* --- Actions --- */
.vv-game-menu__actions {
  padding: 12px 20px 0;
  border-top: 1px solid var(--vv-border);
}
.vv-game-menu__action-btn {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: var(--vv-radius-md);
  background: rgba(139,92,246,0.12);
  color: #a78bfa;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--vv-transition);
}
.vv-game-menu__action-btn:hover {
  background: rgba(139,92,246,0.25);
}

/* --- Overlay (mobile) --- */
.vv-game-menu__overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.vv-game-menu__overlay--visible {
  display: block;
  opacity: 1;
}

/* Desktop: position panel above toggle button */
@media (min-width: 768px) {
  .vv-game-menu__panel {
    bottom: 76px;
    right: 24px;
    border-radius: var(--vv-radius-lg);
    max-height: 70vh;
  }
  .vv-game-menu__overlay {
    display: none !important;
  }
  .vv-game-menu__toggle {
    bottom: 24px;
    right: 24px;
  }
}

/* ============================================================
   Mobile Bottom Bar — REMOVED (conflicts with Woodmart toolbar)
   The floating toggle button is used on both desktop and mobile.
   ============================================================ */
.vv-game-bar {
  display: none !important; /* Disabled — using floating button instead */
}

/* Mobile: reposition floating button above Woodmart's bottom toolbar */
@media (max-width: 767px) {
  .vv-game-menu__toggle {
    bottom: 70px !important; /* Above Woodmart's ~56px bottom toolbar */
    right: 12px !important;
    padding: 10px 14px !important;
    font-size: 0.75rem !important;
  }
  .vv-game-menu__toggle-label {
    display: none; /* Hide text label on mobile, icon only */
  }
  .vv-game-menu__panel {
    bottom: 130px !important; /* Above the toggle button */
    max-height: 60vh !important;
  }
}

/* ============================================================
   Tutorial (.vv-tutorial)
   ============================================================ */
.vv-tutorial__overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.vv-tutorial__overlay--visible {
  opacity: 1;
}
.vv-tutorial__overlay--exit {
  opacity: 0;
  pointer-events: none;
}

/* --- Card --- */
.vv-tutorial__card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--vv-bg-secondary);
  border: 1.5px solid rgba(139,92,246,0.4);
  border-radius: var(--vv-radius-lg);
  padding: 28px 24px 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 40px rgba(139,92,246,0.12);
  transform: translateY(16px);
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  overflow: hidden;
}
.vv-tutorial__overlay--visible .vv-tutorial__card {
  transform: translateY(0);
}

/* --- Step dots --- */
.vv-tutorial__step-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}
.vv-tutorial__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background 0.3s, transform 0.3s;
}
.vv-tutorial__dot--done {
  background: rgba(139,92,246,0.4);
}
.vv-tutorial__dot--active {
  background: #8b5cf6;
  transform: scale(1.35);
}

/* --- Step content --- */
.vv-tutorial__step {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.vv-tutorial__step--active {
  display: flex;
  animation: vvStepFadeIn 0.35s ease forwards;
}
.vv-tutorial__step--exit {
  animation: vvStepFadeOut 0.3s ease forwards;
}
@keyframes vvStepFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes vvStepFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* --- Icon --- */
.vv-tutorial__icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* --- Text --- */
.vv-tutorial__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0 0 10px;
}
.vv-tutorial__text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--vv-text-muted);
  margin: 0 0 16px;
}
.vv-tutorial__preview {
  margin: 0 0 12px;
}
.vv-tutorial__preview-link {
  color: #a78bfa;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 6px 14px;
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--vv-radius-full);
  transition: background var(--vv-transition);
}
.vv-tutorial__preview-link:hover {
  background: rgba(139,92,246,0.12);
}
.vv-tutorial__coin-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(245,197,24,0.1);
  border: 1px solid rgba(245,197,24,0.3);
  border-radius: var(--vv-radius-full);
  margin-bottom: 12px;
}
.vv-tutorial__coin-count {
  font-size: 1.3rem;
  font-weight: 800;
  color: #f5c518;
}
.vv-tutorial__coin-label {
  font-size: 0.82rem;
  color: var(--vv-text-muted);
}

/* --- Actions --- */
.vv-tutorial__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
}
.vv-tutorial__actions .vv-btn--primary {
  flex: 1;
}

/* --- Coin award notification --- */
.vv-tutorial__coin-award {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(245,197,24,0.15);
  border: 1px solid rgba(245,197,24,0.5);
  border-radius: var(--vv-radius-full);
  padding: 8px 20px;
  color: #f5c518;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  white-space: nowrap;
}
.vv-tutorial__coin-award--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Confetti --- */
.vv-tutorial__confetti {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
}
.vv-confetti-piece {
  position: absolute;
  top: 0;
  display: inline-block;
  opacity: 0;
  animation: vvConfettiFall 1s ease-in forwards;
}
.vv-tutorial__confetti--active .vv-confetti-piece {
  /* animation set inline via JS */
}
@keyframes vvConfettiFall {
  0%   { opacity: 1; transform: translateY(-10px) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(180px) rotate(720deg) scale(0.5); }
}

/* ============================================================
   Codex (.vv-codex)
   ============================================================ */
.vv-codex {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
}
.vv-codex-login {
  text-align: center;
  padding: 40px 20px;
  color: var(--vv-text-muted);
}

/* --- Tab navigation --- */
.vv-codex__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--vv-border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.vv-codex__tabs::-webkit-scrollbar {
  display: none;
}
.vv-codex__tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--vv-radius-full);
  color: var(--vv-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--vv-transition), background var(--vv-transition), border-color var(--vv-transition);
  white-space: nowrap;
}
.vv-codex__tab:hover {
  color: var(--vv-text-primary);
  background: rgba(255,255,255,0.06);
}
.vv-codex__tab--active {
  color: #a78bfa;
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.3);
}
.vv-codex__tab-icon {
  display: flex;
  align-items: center;
}
.vv-codex__tab-label {
  /* visible always */
}

/* --- Search bar --- */
.vv-codex__search-bar {
  margin-bottom: 16px;
}
.vv-codex__search-input {
  width: 100%;
  max-width: 400px;
  padding: 9px 16px;
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-full);
  color: var(--vv-text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--vv-transition);
}
.vv-codex__search-input:focus {
  border-color: rgba(139,92,246,0.5);
}
.vv-codex__search-input::placeholder {
  color: var(--vv-text-dim);
}

/* --- Panels --- */
.vv-codex__panel {
  display: none;
}
.vv-codex__panel--active {
  display: block;
  animation: vvPanelFade 0.25s ease;
}
@keyframes vvPanelFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Loading state --- */
.vv-codex__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--vv-text-muted);
  font-size: 0.9rem;
}
.vv-codex__empty,
.vv-codex__error {
  color: var(--vv-text-muted);
  padding: 40px 20px;
  text-align: center;
  font-size: 0.9rem;
}
.vv-codex__error {
  color: var(--vv-highlight);
}

/* --- Grids --- */
.vv-codex__grid {
  display: grid;
  gap: 16px;
}
.vv-codex__grid--monsters {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.vv-codex__grid--skill-books {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.vv-codex__grid--equipment {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.vv-codex__grid--badges {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.vv-codex__grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* --- Cards --- */
.vv-codex__card {
  background: var(--vv-card-bg);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--vv-transition), box-shadow var(--vv-transition);
}
.vv-codex__card:hover {
  border-color: rgba(139,92,246,0.3);
  box-shadow: var(--vv-shadow-sm);
}
.vv-codex__card--locked {
  opacity: 0.55;
  filter: grayscale(0.4);
}
.vv-codex__card--boss {
  border-color: rgba(233,69,96,0.4);
  background: rgba(233,69,96,0.05);
}
.vv-codex__card-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0;
}
.vv-codex__card-desc {
  font-size: 0.8rem;
  color: var(--vv-text-muted);
  line-height: 1.5;
  margin: 0;
}
.vv-codex__card-image {
  border-radius: var(--vv-radius-sm);
  overflow: hidden;
  text-align: center;
}
.vv-codex__card-image img {
  width: 100%;
  height: 100px;
  object-fit: contain;
}
.vv-codex__card-image-placeholder {
  font-size: 2.5rem;
  text-align: center;
  padding: 8px 0;
}

/* Monster stats row */
.vv-codex__tier-stars {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
}
.vv-codex__star {
  color: #f59e0b;
}
.vv-codex__boss-badge {
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  background: rgba(233,69,96,0.15);
  border: 1px solid rgba(233,69,96,0.4);
  border-radius: var(--vv-radius-full);
  color: #e94560;
  text-transform: uppercase;
}
.vv-codex__stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.vv-codex__stat {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--vv-text-muted);
}
.vv-codex__stat--hp  { color: #e94560; }
.vv-codex__stat--atk { color: #f59e0b; }
.vv-codex__stat--def { color: #0ea5e9; }

.vv-codex__reward {
  font-size: 0.78rem;
  color: #f5c518;
  font-weight: 600;
}
.vv-codex__user-stat {
  font-size: 0.75rem;
  color: var(--vv-text-dim);
}

/* Drop table */
.vv-codex__drops {
  font-size: 0.78rem;
}
.vv-codex__drops-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--vv-text-muted);
  margin: 4px 0 4px;
}
.vv-codex__drop-list {
  margin: 0;
  padding: 0 0 0 16px;
  color: var(--vv-text-dim);
  line-height: 1.7;
}
.vv-codex__drop-item {
  list-style: disc;
}

/* Ownership badge */
.vv-codex__owned-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--vv-radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  align-self: flex-start;
  margin-top: auto;
}
.vv-codex__owned-badge--yes {
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
}
.vv-codex__owned-badge--no {
  background: rgba(148,163,184,0.08);
  border: 1px solid var(--vv-border);
  color: var(--vv-text-dim);
}

/* Skill book type badge */
.vv-codex__book-icon {
  font-size: 2rem;
  text-align: center;
}
.vv-codex__book-type {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--vv-radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  align-self: flex-start;
}
.vv-codex__book-type--active {
  background: rgba(233,69,96,0.1);
  border: 1px solid rgba(233,69,96,0.3);
  color: #e94560;
}
.vv-codex__book-type--passive {
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.3);
  color: #a78bfa;
}
.vv-codex__obtain {
  font-size: 0.75rem;
  color: var(--vv-text-dim);
}

/* Equipment category */
.vv-codex__category-section {
  margin-bottom: 28px;
}
.vv-codex__category-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--vv-border);
}
.vv-codex__equip-cost {
  font-size: 0.8rem;
  color: #f5c518;
  font-weight: 600;
}
.vv-codex__rank-req {
  font-size: 0.75rem;
  color: #8b5cf6;
}

/* Badge icon */
.vv-codex__badge-icon {
  font-size: 2.5rem;
  text-align: center;
}
.vv-codex__badge-req {
  color: var(--vv-text-dim);
  font-size: 0.75rem;
}

/* Cards tab */
.vv-codex__cards-count {
  color: var(--vv-text-muted);
  font-size: 0.82rem;
  margin-bottom: 12px;
}
.vv-codex__card-flavor {
  font-size: 0.75rem;
  color: var(--vv-text-dim);
  text-transform: capitalize;
}
.vv-codex__buy-link {
  margin-top: auto;
  font-size: 0.78rem;
  color: #a78bfa;
  text-decoration: none;
  font-weight: 600;
  padding: 4px 0;
  transition: color var(--vv-transition);
}
.vv-codex__buy-link:hover {
  color: #c4b5fd;
}

/* Pagination */
.vv-codex__pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 20px 0 0;
  flex-wrap: wrap;
}
.vv-codex__page-info {
  color: var(--vv-text-muted);
  font-size: 0.82rem;
}

/* Ranks tab */
.vv-codex__ranks-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 700px;
}
.vv-codex__rank-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  background: var(--vv-card-bg);
  border: 1.5px solid;
  border-radius: var(--vv-radius-md);
  transition: box-shadow var(--vv-transition);
}
.vv-codex__rank-item--current {
  box-shadow: 0 0 20px rgba(139,92,246,0.15);
}
.vv-codex__rank-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}
.vv-codex__rank-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}
.vv-codex__rank-threshold {
  font-size: 0.78rem;
  color: var(--vv-text-dim);
  margin-bottom: 6px;
}
.vv-codex__rank-perks {
  font-size: 0.82rem;
  color: var(--vv-text-muted);
  margin: 0;
  line-height: 1.5;
}
.vv-codex__current-rank-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--vv-radius-full);
  font-size: 0.72rem;
  color: #a78bfa;
  font-weight: 700;
}

/* Coming soon (guilds) */
.vv-codex__coming-soon {
  text-align: center;
  padding: 60px 20px;
}
.vv-codex__coming-soon-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}
.vv-codex__coming-soon h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0 0 10px;
}
.vv-codex__coming-soon p {
  color: var(--vv-text-muted);
  max-width: 400px;
  margin: 0 auto 20px;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Rarity badges (shared) */
.vv-rarity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--vv-radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: flex-start;
}
.vv-rarity--common    { background: rgba(148,163,184,0.12); border: 1px solid rgba(148,163,184,0.3); color: #94a3b8; }
.vv-rarity--uncommon  { background: rgba(34,197,94,0.12);   border: 1px solid rgba(34,197,94,0.3);   color: #22c55e; }
.vv-rarity--rare      { background: rgba(14,165,233,0.12);  border: 1px solid rgba(14,165,233,0.3);  color: #0ea5e9; }
.vv-rarity--epic      { background: rgba(139,92,246,0.12);  border: 1px solid rgba(139,92,246,0.3);  color: #a78bfa; }
.vv-rarity--legendary { background: rgba(245,197,24,0.12);  border: 1px solid rgba(245,197,24,0.4);  color: #f5c518; }

/* ============================================================
   Loot Popup (.vv-loot)
   ============================================================ */
.vv-loot {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: vvLootFadeIn 0.3s ease forwards;
}
.vv-loot--exit {
  animation: vvLootFadeOut 0.35s ease forwards;
  pointer-events: none;
}
@keyframes vvLootFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes vvLootFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.vv-loot__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
  cursor: pointer;
}

/* --- Container --- */
.vv-loot__container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  background: var(--vv-bg-secondary);
  border: 1.5px solid rgba(139,92,246,0.35);
  border-radius: var(--vv-radius-lg);
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}

/* --- Chest animation --- */
.vv-loot__chest {
  font-size: 3.5rem;
  display: block;
  margin: 0 auto 16px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vv-loot__chest--open {
  transform: scale(1.2) rotate(-5deg);
  filter: drop-shadow(0 0 16px rgba(245,197,24,0.5));
}

/* --- Title --- */
.vv-loot__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--vv-text-primary);
  margin: 0 0 20px;
}

/* --- Items grid --- */
.vv-loot__items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.vv-loot__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius-md);
  opacity: 0;
  transform: scale(0.85) translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vv-loot__item--visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.vv-loot__item--rare {
  border-color: rgba(14,165,233,0.35);
  background: rgba(14,165,233,0.06);
  box-shadow: 0 0 12px rgba(14,165,233,0.12);
}
.vv-loot__item--epic {
  border-color: rgba(139,92,246,0.4);
  background: rgba(139,92,246,0.07);
  box-shadow: 0 0 16px rgba(139,92,246,0.18);
}
.vv-loot__item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}
.vv-loot__item-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--vv-text-primary);
  text-align: left;
}

/* --- Close button --- */
.vv-loot__close {
  width: 100%;
  padding: 12px;
}

/* ============================================================
   Spinner utility (used in codex loading states)
   ============================================================ */
.vv-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(139,92,246,0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: vvSpin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes vvSpin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Responsive adjustments for Phase 6 components
   ============================================================ */
@media (max-width: 767px) {
  .vv-codex__grid--monsters,
  .vv-codex__grid--skill-books {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .vv-codex__grid--equipment,
  .vv-codex__grid--cards {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .vv-codex__grid--badges {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .vv-loot__container {
    padding: 20px 16px;
  }
  .vv-tutorial__card {
    padding: 20px 16px;
  }
  .vv-codex__tabs {
    gap: 2px;
  }
  .vv-codex__tab {
    padding: 6px 12px;
    font-size: 0.78rem;
  }
  .vv-codex__tab-icon svg {
    width: 15px;
    height: 15px;
  }
}
