/* Activité Discord : mêmes couleurs que le dashboard (dashboard/static/style.css), polices du
   système (une Activité ne peut pas charger Google Fonts). */
:root {
  --bg: #0A0A0B;
  --surface: #111113;
  --surface-2: #161619;
  --surface-3: #1E1E22;
  --border: #26262B;
  --border-soft: #1B1B1F;
  --border-strong: #34343A;
  --accent: #4ADE80;
  --accent-soft: rgba(74, 222, 128, 0.10);
  --accent-ink: #04210F;
  --gold: #E6C46F;
  --text: #EDEDEF;
  --text-muted: #8A8A93;
  --text-faint: #5C5C66;
  --danger: #F87171;
  --radius: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.app { height: 100%; display: flex; flex-direction: column; max-width: 920px; margin: 0 auto; }

/* ---------- En-tête ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 10px;
}
.topbar-guild { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; }
.topbar-title { font-weight: 650; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 0.78rem; color: var(--text-muted); }
.coins {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.coin { font-size: 0.95rem; }

/* ---------- Onglets ---------- */
.tabs {
  display: flex; gap: 4px; margin: 0 16px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
}
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-muted); font-size: 0.88rem; font-weight: 550; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.content { flex: 1; overflow-y: auto; padding: 14px 16px max(20px, env(safe-area-inset-bottom)); }
.panel { display: none; }
.panel.is-active { display: block; animation: fade-in 0.25s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Boutons, pastilles ---------- */
.btn {
  height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 600; font-size: 0.88rem; cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), opacity 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: #6EE7A0; }
.btn-ghost { background: var(--surface-2); border-color: var(--border-soft); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-muted); font-size: 0.82rem;
  transition: all 0.15s var(--ease);
}
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--accent-soft); border-color: rgba(74, 222, 128, 0.35); color: var(--text); }

.segmented { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- Classeur ---------- */
.album-frame {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; min-height: 180px;
  background: var(--surface); border: 1px solid var(--border-soft);
}
.album-image { width: 100%; transition: opacity 0.2s var(--ease); }
.album-frame.is-loading .album-image { opacity: 0.35; }
.album-frame .loader { position: absolute; inset: 0; margin: auto; display: none; }
.album-frame.is-loading .loader { display: block; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.pager .btn { width: 44px; padding: 0; font-size: 1.3rem; line-height: 1; }
.pager-label { min-width: 90px; text-align: center; color: var(--text-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

/* ---------- Boosters ---------- */
.booster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.booster {
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
}
.booster-art {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  background: linear-gradient(150deg, #1d3b2a, #0f1a14 60%, #172a1f);
  display: flex; align-items: center; justify-content: center; font-size: 2.6rem;
}
.booster-art img { width: 100%; height: 100%; object-fit: cover; }
.booster-count {
  position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); font-size: 0.75rem; font-weight: 700;
}
.booster-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booster-meta { color: var(--text-muted); font-size: 0.76rem; margin-top: -6px; }

/* ---------- Classements ---------- */
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
}
.rank-row.is-me { border-color: rgba(74, 222, 128, 0.4); background: linear-gradient(90deg, var(--accent-soft), var(--surface) 70%); }
.rank-pos { width: 26px; text-align: center; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rank-row:nth-child(1) .rank-pos { color: #F5C451; }
.rank-row:nth-child(2) .rank-pos { color: #C9CED6; }
.rank-row:nth-child(3) .rank-pos { color: #D69A6A; }
.rank-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); flex-shrink: 0; object-fit: cover; }
.rank-name { flex: 1; min-width: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.rank-sub { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 500; text-align: right; }

.empty { text-align: center; color: var(--text-muted); padding: 36px 12px; font-size: 0.9rem; }

/* ---------- Ouverture d'un booster ---------- */
.reveal {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 20px; background: radial-gradient(circle at 50% 40%, rgba(74, 222, 128, 0.10), rgba(5, 5, 6, 0.96) 60%);
  backdrop-filter: blur(6px); animation: fade-in 0.25s var(--ease);
}
.reveal[hidden] { display: none; }
.reveal-head { text-align: center; }
.reveal-title { font-size: 1.15rem; font-weight: 700; }
.reveal-hint { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.reveal-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 100%; }
.reveal-actions { display: flex; gap: 10px; }

/* L'arrivée (deal) anime le bouton, le retournement anime .flip-inner : séparés, sinon l'animation
   d'arrivée, qui garde son état final, empêche le retournement. */
.flip { width: clamp(96px, 26vw, 150px); aspect-ratio: 5 / 7; perspective: 900px; cursor: pointer; border: 0; padding: 0; background: none; animation: deal 0.45s var(--ease) both; }
.flip-inner {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; overflow: hidden; }
.flip-back {
  background: repeating-linear-gradient(45deg, #13241a 0 10px, #10200f 10px 20px);
  border: 2px solid #2a4a35; display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}
.flip-front { transform: rotateY(180deg); background: var(--surface); box-shadow: 0 0 0 2px var(--rarity, var(--border)), 0 0 26px -4px var(--rarity, transparent); }
.flip-front img { width: 100%; height: 100%; object-fit: cover; }
@keyframes deal { from { opacity: 0; transform: translateY(30px) scale(0.9); } to { opacity: 1; transform: none; } }

/* ---------- Démarrage, chargement, notifications ---------- */
.splash {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center;
}
.splash[hidden] { display: none; }
.splash-text { color: var(--text-muted); max-width: 340px; margin: 0; }
.splash.is-error .loader { display: none; }
.splash.is-error .splash-text { color: var(--text); }

.loader { width: 28px; height: 28px; }
.loader span {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border);
  font-size: 0.86rem; transition: all 0.25s var(--ease); max-width: calc(100% - 32px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(248, 113, 113, 0.5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
