/* ===== Variables ===== */
:root {
  color-scheme: dark;
  --bg: #0e0d12;
  --card: #17151d;
  --ink: #ece9f4;
  --mute: #8d89a0;
  --line: #2a2733;
  --accent: #8b6cff;
  --accent-soft: #251f3d;
  --danger: #ff6b60;
  --radius: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Teinte d'une carte selon sa rareté */
.r-common { --rc: #26232e; --rt: #a9a5b8; }
.r-rare { --rc: #15293a; --rt: #6fb4e8; }
.r-epic { --rc: #271f40; --rt: #a98bff; }
.r-legendary { --rc: #33270f; --rt: #e3b04b; }

/* ===== Base ===== */
* {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(28px, 4vw, 40px);
}

/* Mot mis en valeur */
em {
  font-style: normal;
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

.spaced {
  margin-top: 8vh;
}

.spaced-sm {
  margin-top: 18px;
}

/* ===== En-tête ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 0 5vw;
  min-height: 84px;
  background: #0e0d12ee;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
  color: var(--ink);
  text-decoration: none;
}

.mono {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-text {
  display: grid;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.15;
}

.brand-text small {
  color: var(--mute);
  font-size: 11px;
  font-weight: 400;
}

.nav-links {
  align-self: stretch;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 2px solid transparent;
  color: var(--mute);
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:first-child {
  margin-left: auto;
}

.nav-links a:last-child {
  margin-right: auto;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.count {
  min-width: 18px;
  padding: 0 6px;
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: end;
  padding: 0;
  white-space: nowrap;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--mute);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--ink);
}

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.avatar {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent-soft);
  object-fit: cover;
}

/* ===== Boutons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #7a5af5;
  border-color: #7a5af5;
}

.btn:disabled {
  background: #221f2b;
  border-color: #221f2b;
  color: #5f5c70;
  cursor: not-allowed;
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn.ghost:hover {
  background: var(--card);
  border-color: var(--ink);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--line);
}

.btn.danger:hover {
  background: #2e1717;
  border-color: var(--danger);
}

.text-link {
  display: inline-flex;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent);
}

/* ===== Sections et titres ===== */
.section {
  padding: 8vh 5vw;
  max-width: 1100px;
  margin: auto;
}

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tag {
  color: var(--mute);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sub {
  margin-top: 12px;
  color: var(--mute);
}

.msg {
  min-height: 1.4em;
  margin-top: 10px;
  font-size: 14px;
  color: var(--accent);
}

.msg.error {
  color: var(--danger);
}

/* ===== Cartes à collectionner ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.tcard {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.tcard .art {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--rc, var(--bg));
  font-size: 40px;
}

.tcard .art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tcard .body {
  padding: 12px 14px 14px;
}

.tcard h3 {
  font-size: 16px;
  line-height: 1.2;
}

.tcard p {
  margin-top: 4px;
  color: var(--mute);
  font-size: 12px;
}

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  background: var(--rc, var(--bg));
  border-radius: 999px;
  color: var(--rt, var(--mute));
  font-size: 11px;
  font-weight: 600;
}

.qty {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 9px;
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.tcard.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

/* ===== Pied de page ===== */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 5vw;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 13px;
}

/* ===== Mobile ===== */
@media (max-width: 1200px) {
  .nav-links a {
    padding: 0 9px;
    font-size: 14px;
  }
}

@media (max-width: 1100px) {
  .brand-text small,
  .user span:last-child {
    display: none;
  }
}

@media (max-width: 700px) {
  .nav {
    grid-template-columns: 1fr auto;
    gap: 0 16px;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    padding: 10px 0;
  }
}
