/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--radius-pill);
  font-weight: 600; font-size: 15px; letter-spacing: 0.01em;
  transition: transform .15s var(--ease-bounce), background .2s, box-shadow .2s, opacity .2s;
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  color: white; box-shadow: var(--shadow-pop);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost {
  background: var(--color-surface);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
}
.btn--ghost:hover { background: var(--color-surface-2); }
.btn--danger { background: var(--color-danger); color: white; }
.btn--lg { height: 56px; padding: 0 24px; font-size: 16px; }
.btn--block { width: 100%; }

/* Chips / Badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-fg);
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--color-border);
}
.chip--xp { background: rgba(124,92,255,0.15); border-color: rgba(124,92,255,0.35); color: #c7b8ff; }
.chip--streak { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.35); color: #fbbf24; }
.chip--profile { background: var(--color-surface-2); }
.chip--filter { cursor: pointer; transition: all .2s; }
.chip--filter.active { background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2)); border-color: transparent; color: white; }

.badge {
  display: inline-block; padding: 3px 8px; font-size: 11px;
  background: var(--color-surface-2); color: var(--color-fg-muted);
  border-radius: 6px; font-weight: 600; letter-spacing: 0.03em;
}
.badge--ghost { background: transparent; border: 1px solid var(--color-border); }

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* Toasts */
#toast-root {
  position: fixed; left: 0; right: 0; bottom: calc(var(--bottomnav-h) + 16px); z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--color-surface-2);
  color: var(--color-fg);
  padding: 10px 16px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(10px);
  transition: opacity .25s, transform .25s var(--ease-bounce);
  border: 1px solid var(--color-border);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 7, 15, 0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .2s;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  background: var(--color-bg-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  max-width: 420px; width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal__body { padding: 22px 22px 10px; }
.modal__actions { padding: 12px 22px 22px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal h3 { margin-bottom: 8px; font-size: 20px; }
.modal p { color: var(--color-fg-muted); }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti__piece {
  position: absolute; top: -20px; left: var(--x);
  width: 10px; height: 14px; background: var(--c); border-radius: 2px;
  transform: rotate(var(--r));
  animation: confetti-fall var(--d) var(--dl) ease-out forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(var(--r)); opacity: 1; }
  100% { transform: translateY(110vh) rotate(calc(var(--r) + 720deg)); opacity: 0; }
}

/* Share card (rendered into modal, used for screenshot) */
.share-card {
  width: 320px; aspect-ratio: 9/12;
  padding: 4px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--tile-color), var(--tile-color-2));
  box-shadow: var(--shadow-lg);
  margin: 0 auto;
}
.share-card__inner {
  background: var(--color-bg-2);
  border-radius: calc(var(--radius-lg) - 4px);
  padding: 28px 20px;
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 10px;
}
.share-card__emoji { font-size: 76px; line-height: 1; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4)); }
.share-card__title { font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.share-card__subtitle { color: var(--color-fg-muted); font-size: 14px; margin-bottom: 4px; }
.share-score { font-family: var(--font-display); font-size: 42px; font-weight: 700; background: linear-gradient(135deg, var(--tile-color), var(--tile-color-2)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-top: 4px; }
.share-xp {
  display: inline-block; margin-top: 8px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: rgba(124,92,255,0.2); color: #d2c3ff; font-weight: 700; font-size: 14px;
}
.share-footer { margin-top: auto; color: var(--color-fg-dim); font-size: 12px; letter-spacing: 0.06em; }

/* Shared game helpers (games also load styles/game.css from their index.html via relative link) */
