/*
  Palette et grammaire visuelle extraites du Hi-Fi mockup réel (direction
  "Steep" — HUD alpin, froid, technique), pas du whitepaper texte (qui
  décrivait une direction plus ancienne, sombre/ticket — remplacée par
  celle-ci). Voir docs/plan.md pour le contexte de cette correction.
*/
:root {
  --bg-1: #f7fafc;
  --bg-2: #e4ebf0;
  --bg-3: #d8e2e9;
  --ink: #10161c;
  --orange: #ff5a1f;
  --teal: #3fb6d3;
  --teal-dark: #0e6a80;

  --tier-common-bracket: rgba(16, 22, 28, 0.3);
  --tier-common-text: rgba(16, 22, 28, 0.55);
  --tier-common-border: rgba(16, 22, 28, 0.2);
  --tier-common-bg: transparent;

  --tier-rare-bracket: #3fb6d3;
  --tier-rare-text: #0e6a80;
  --tier-rare-border: rgba(63, 182, 211, 0.5);
  --tier-rare-bg: rgba(63, 182, 211, 0.1);

  --tier-epic-bracket: #ff5a1f;
  --tier-epic-text: #ff5a1f;
  --tier-epic-border: rgba(255, 90, 31, 0.45);
  --tier-epic-bg: rgba(255, 90, 31, 0.08);

  --tier-legendary-bracket: #ff5a1f;
  --tier-legendary-text: #10161c;
  --tier-legendary-border: #10161c;
  --tier-legendary-bg: linear-gradient(90deg, rgba(255, 90, 31, 0.15), rgba(63, 182, 211, 0.15));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  background: radial-gradient(120% 100% at 50% -10%, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  background-attachment: fixed;
}

/* Texture grille "blueprint" en fond, discrète */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    repeating-linear-gradient(0deg, rgba(16, 22, 28, 0.025) 0px, rgba(16, 22, 28, 0.025) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(90deg, rgba(16, 22, 28, 0.025) 0px, rgba(16, 22, 28, 0.025) 1px, transparent 1px, transparent 40px);
}

.hf-cond { font-family: 'Barlow Condensed', sans-serif; }
.hf-mono { font-family: 'IBM Plex Mono', monospace; }

/* ── Navbar ─────────────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 24px;
  margin: 24px 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(16, 22, 28, 0.1);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(16, 22, 28, 0.06);
  z-index: 20;
}

.logo-group { display: flex; align-items: center; gap: 12px; }

.logo-mark { width: 20px; height: 20px; position: relative; flex: none; }
.logo-mark span { position: absolute; background: var(--orange); }
.logo-mark .h { top: 9px; left: 0; right: 0; height: 1px; }
.logo-mark .v { left: 9px; top: 0; bottom: 0; width: 1px; }
.logo-mark .ring { inset: 3px; border: 1px solid rgba(16, 22, 28, 0.35); border-radius: 50%; background: none; }

.logo-text { line-height: 1; }
.logo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.logo-tagline {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(16, 22, 28, 0.4);
  margin-top: 2px;
}

.economy-bar { display: flex; align-items: center; gap: 14px; }

.dolloss-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid rgba(16, 22, 28, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}
.dolloss-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); flex: none; }
.dolloss-value { font-size: 13px; font-weight: 500; color: var(--ink); }
.dolloss-label { font-size: 11px; letter-spacing: 0.08em; color: rgba(16, 22, 28, 0.45); }

.booster-buy {
  font-family: 'Barlow Condensed', sans-serif;
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--orange);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 16px rgba(255, 90, 31, 0.35);
  cursor: pointer;
}
.booster-buy:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.account-widget-login { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.account-widget { position: relative; }
.account-widget-trigger {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; color: var(--ink);
  cursor: pointer; font-family: 'IBM Plex Sans', sans-serif; font-size: 0.9rem;
}
.account-widget-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.account-widget-avatar--fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--orange); color: #fff; font-size: 0.7rem; font-weight: 700;
}
.account-widget-menu {
  position: absolute; right: 0; top: 40px; background: #fff;
  border: 1px solid rgba(16, 22, 28, 0.1);
  border-radius: 12px; padding: 8px; display: flex; flex-direction: column; min-width: 180px;
  box-shadow: 0 20px 44px rgba(16, 22, 28, 0.16); z-index: 30;
}
.account-widget-menu[hidden] { display: none; }
.account-widget-menu a {
  color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 0.85rem;
}
.account-widget-menu a:hover { background: rgba(16, 22, 28, 0.05); }
.account-widget-badge { font-size: 0.7rem; font-weight: 700; color: var(--orange); padding: 4px 10px; }

/* ── Filter tabs ────────────────────────────────────────────────────────── */
.filter-tabs {
  margin: 22px 32px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(16, 22, 28, 0.12);
  display: flex;
  align-items: center;
  gap: 28px;
}
.filter-tab {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: rgba(16, 22, 28, 0.4);
  background: none;
  border: none;
  padding-bottom: 12px;
  margin-bottom: -13px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.filter-tab.active { color: var(--ink); border-bottom-color: var(--orange); }
.shards-held {
  margin-left: auto;
  font-size: 11px;
  color: rgba(16, 22, 28, 0.4);
  letter-spacing: 0.08em;
}

/* ── Card grid ──────────────────────────────────────────────────────────── */
main { padding: 0 0 40px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  padding: 28px 32px 40px;
  max-width: 1440px;
  margin: 0 auto;
}
@media (max-width: 1100px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }

.meme-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 22, 28, 0.12);
  box-shadow: 0 10px 24px rgba(16, 22, 28, 0.06);
  overflow: hidden;
}

.meme-card-media {
  position: relative;
  height: 168px;
  border-bottom: 1px solid rgba(16, 22, 28, 0.1);
  background: linear-gradient(160deg, #dde6ec, #c7d4dc);
  display: flex;
  align-items: center;
  justify-content: center;
}
.meme-card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.meme-card-media svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.locked-pill {
  position: relative;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(16, 22, 28, 0.4);
  background: rgba(255, 255, 255, 0.7);
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 2;
}

.bracket { position: absolute; width: 14px; height: 14px; z-index: 3; }
.bracket.tl { top: 10px; left: 10px; border-radius: 3px 0 0 0; border-top: 2px solid; border-left: 2px solid; }
.bracket.tr { top: 10px; right: 10px; border-radius: 0 3px 0 0; border-top: 2px solid; border-right: 2px solid; }

.meme-card-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}
.meme-card-band .pps { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 500; color: var(--ink); }
.meme-card-band .mult { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: rgba(16, 22, 28, 0.45); }

.tier-badge {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid;
}
.tier-badge.common { color: var(--tier-common-text); border-color: var(--tier-common-border); background: var(--tier-common-bg); }
.tier-badge.rare { color: var(--tier-rare-text); border-color: var(--tier-rare-border); background: var(--tier-rare-bg); }
.tier-badge.epic { color: var(--tier-epic-text); border-color: var(--tier-epic-border); background: var(--tier-epic-bg); }
.tier-badge.legendary { color: var(--tier-legendary-text); border-color: var(--tier-legendary-border); background: var(--tier-legendary-bg); }

.pop-counter {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(16, 22, 28, 0.75);
  color: #7ee9b0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateY(4px);
  pointer-events: none;
  z-index: 4;
}
.pop-counter.show { opacity: 1; transform: translateY(0); }

.empty-state {
  text-align: center;
  color: rgba(16, 22, 28, 0.5);
  padding: 80px 20px;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── Modals (booster, tier notifications) ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 28, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  position: relative;
  width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 22, 28, 0.12);
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(16, 22, 28, 0.28);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 26px;
  border-bottom: 1px solid rgba(16, 22, 28, 0.1);
}
.modal-title { font-family: 'Barlow Condensed', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: 0.05em; color: var(--ink); }
.modal-subtitle { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.1em; color: rgba(16, 22, 28, 0.45); margin-top: 3px; }
.modal-close {
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid rgba(16, 22, 28, 0.15);
  display: flex; align-items: center; justify-content: center;
  color: rgba(16, 22, 28, 0.5); font-size: 15px;
  background: none; cursor: pointer;
}

.modal-body { overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 16px 22px 20px; }
.modal-ok {
  font-family: 'Barlow Condensed', sans-serif;
  padding: 11px; text-align: center; border-radius: 10px;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 0.04em;
  cursor: pointer; border: none; width: 100%;
}

.tier-change-row { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(16, 22, 28, 0.08); }
.tier-change-row:last-child { border-bottom: none; padding-bottom: 0; }
.tier-change-thumb { flex: none; width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(160deg, #eef1f3, #dbe1e5); display: flex; align-items: center; justify-content: center; }
.tier-change-name { flex: 1; font-size: 14px; color: var(--ink); font-family: 'IBM Plex Sans', sans-serif; }
.tier-change-arrow { color: rgba(16, 22, 28, 0.3); font-size: 12px; }

.booster-summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(16, 22, 28, 0.08); }
.booster-summary:last-child { border-bottom: none; }
