:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1c1b19;
  --muted: #6b6760;
  --line: #e4e1da;
  --accent: #b07a1c;
  --accent-soft: #f6ead3;
  --good: #2f7a4f;
  --good-soft: #e3f1e8;
  --warn: #a34a2a;
  --warn-soft: #f7e6df;

  --common: #7a7670;
  --rare: #2f6fb5;
  --epic: #8146b8;
  --legendary: #c07a12;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1b1b19;
    --surface-2: #242421;
    --text: #ecebe7;
    --muted: #9d9990;
    --line: #2e2d2a;
    --accent: #e0a940;
    --accent-soft: #3a2e17;
    --good: #6cc193;
    --good-soft: #1c3227;
    --warn: #e58b6a;
    --warn-soft: #3a231b;

    --common: #a8a39b;
    --rare: #6aa6ea;
    --epic: #b88ae6;
    --legendary: #f0b24a;

    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }
b, strong { font-weight: 600; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* En-tête */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 16px 10px;
  display: flex; gap: 16px; align-items: center;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-size: 17px; white-space: nowrap; }
.brand b { color: var(--accent); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent);
  clip-path: polygon(50% 12%, 90% 88%, 10% 88%);
}

.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 0 10px; height: 40px;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; }
.search kbd { font: 12px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

.tabs {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.tabs a {
  padding: 8px 12px 10px; text-decoration: none; color: var(--muted); white-space: nowrap;
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

main { padding-top: 24px; padding-bottom: 40px; min-height: 60vh; }

/* Titres de page */
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); max-width: 70ch; }

h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; font-weight: 600; }
h3 { margin: 0; font-size: 16px; }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters .sep { width: 1px; background: var(--line); margin: 2px 4px; }

/* Cartes */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  display: block; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
a.card:hover { border-color: var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.card .row { margin-top: 12px; }

.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Pastilles */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text); white-space: nowrap; text-decoration: none;
}
a.tag:hover { outline: 1px solid var(--accent); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.cls img { width: 11px; height: 15px; object-fit: contain; opacity: .85; }
.tag.hero-chip { padding: 2px 8px 2px 2px; border-radius: 999px; }

.tier {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted);
}
.tier.S { background: var(--accent); color: #fff; }
.tier.A { background: var(--accent-soft); color: var(--accent); }

.rar { font-size: 12px; font-weight: 600; }
.rar.common { color: var(--common); }
.rar.rare { color: var(--rare); }
.rar.epic { color: var(--epic); }
.rar.legendary { color: var(--legendary); }

.rar.mandate { color: var(--legendary); }
.rar.unique { color: var(--muted); }

.price { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count { font-size: 13px; color: var(--muted); margin: -6px 0 8px; }

/* Listes (reliques, objets) */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list-item { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.list-item .body { flex: 1; min-width: 0; }
.ico { flex: none; width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: var(--surface-2); padding: 4px; }
.list-item:first-child { border-top: 0; }
.list-item .head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.list-item .name { font-weight: 600; }
.list-item .text { margin: 4px 0 0; color: var(--text); font-size: 14px; }
.list-item .sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.list-item .num { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; min-width: 1.5em; }
.list-item.hl { background: var(--accent-soft); }

/* Fiche détail */
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--text); }

.detail-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 8px; }
.detail-head .tier { width: 42px; height: 42px; font-size: 18px; border-radius: 10px; }
.detail-head h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -.01em; }
.detail-head .row { margin-top: 8px; }
.lead { color: var(--muted); max-width: 72ch; margin: 10px 0 0; }

.cols { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.cols > * { min-width: 0; }

.box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.box h3 { font-size: 15px; margin-bottom: 4px; }
.box p { margin: 6px 0 0; font-size: 14px; }
.box ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.box li + li { margin-top: 4px; }
.box.good { background: var(--good-soft); border-color: transparent; }
.box.warn { background: var(--warn-soft); border-color: transparent; }
.box.good h3 { color: var(--good); }
.box.warn h3 { color: var(--warn); }

.spec { padding: 10px 0; border-top: 1px solid var(--line); }
.spec:first-of-type { border-top: 0; padding-top: 4px; }
.spec .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spec p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.spec.best .name { color: var(--good); }

.hero-line { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.hero-line:first-of-type { border-top: 0; padding-top: 4px; }
.hero-line .who { width: 150px; flex: none; display: flex; gap: 10px; align-items: center; text-decoration: none; }
.hero-line .who > span { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.hero-line .who:hover b { color: var(--accent); }
.hero-line .what { flex: 1; font-size: 14px; }
.hero-line .what p { margin: 2px 0 0; color: var(--muted); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 6px 0 0; }
.steps li { counter-increment: s; position: relative; padding-left: 30px; font-size: 14px; }
.steps li + li { margin-top: 8px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}

.phase { display: grid; grid-template-columns: 70px 1fr; gap: 10px; font-size: 14px; padding: 6px 0; }
.phase b { color: var(--accent); }

.ladder { display: flex; flex-direction: column; }
.ladder .rung { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ladder .rung:first-child { border-top: 0; }
.ladder .rung b { font-size: 15px; }
.ladder .rung.focus b { color: var(--accent); }

.sources { font-size: 13px; color: var(--muted); }
.sources a { color: var(--muted); }
.sources a:hover { color: var(--text); }

.note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 12px 0 0; }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

.foot { color: var(--muted); font-size: 13px; padding-bottom: 32px; border-top: 1px solid var(--line); padding-top: 16px; }

/* Portraits */
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 8%;
  background: var(--surface-2); border: 1px solid var(--line);
}
.avatar.xs { width: 22px; height: 22px; border: 0; }
.avatar.md { width: 46px; height: 46px; }
.avatar.lg { width: 52px; height: 52px; }

.faces { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.face { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; }
.face small { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }

.hero-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.hero-card .portrait {
  position: relative; height: 180px;
  background: radial-gradient(120% 90% at 50% 100%, color-mix(in srgb, var(--c) 32%, transparent), color-mix(in srgb, var(--c) 6%, var(--surface-2)));
}
.hero-card .portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; transition: transform .25s ease; }
.hero-card:hover .portrait img { transform: scale(1.04); }
.hero-card .portrait .tier { position: absolute; top: 10px; right: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.hero-card .portrait .tier:not(.S):not(.A) { background: var(--surface); }
.hero-card-body { padding: 12px 14px 14px; }

.hero-hero {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: end;
  background: radial-gradient(90% 120% at 0% 100%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px 0 8px; box-shadow: var(--shadow);
}
.hero-art { height: 380px; display: flex; justify-content: center; align-items: flex-end; }
.hero-art img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom; }
.hero-info { padding-bottom: 22px; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }

@media (max-width: 720px) {
  .hero-hero { grid-template-columns: 1fr; padding: 16px 16px 0; gap: 0; }
  .hero-art { height: 220px; }
  .hero-info { padding-bottom: 8px; }
  .hero-line .who { width: auto; }
  .top-inner { flex-wrap: wrap; gap: 10px; }
  .search { flex-basis: 100%; }
  .search kbd { display: none; }
  .cols { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .hero-line { flex-direction: column; gap: 4px; }
  .page-head h1, .detail-head h1 { font-size: 22px; }
}
