:root {
  --ink: #1B1F3B;
  --ink-2: #565C7D;
  --page: #E9ECF5;
  --pocket: #FFFFFF;
  --sleeve: #F4F5FA;
  --line: #D5D9E8;
  --blue: #3B4CCA;
  --blue-ink: #FFFFFF;
  --up: #1F9D6B;
  --down: #D64545;
  --empty: #C9CEDF;
  --holo: linear-gradient(115deg, #7FD6FF 0%, #C9A7FF 30%, #FF9ECF 50%, #FFD36E 70%, #8CF0C8 100%);
  --shadow: 0 1px 2px rgba(27, 31, 59, .08), 0 4px 14px rgba(27, 31, 59, .06);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --display: 'Unbounded', 'Figtree', system-ui, sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #EEF0FA;
    --ink-2: #A3A9C9;
    --page: #14172B;
    --pocket: #1E2240;
    --sleeve: #252A4D;
    --line: #333A66;
    --blue: #8794FF;
    --blue-ink: #14172B;
    --up: #4AD69A;
    --down: #FF7A7A;
    --empty: #3A4170;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 var(--body); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-2); }
.err { color: var(--down); min-height: 1.4em; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--up); }
.neg { color: var(--down); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 19px/1 var(--display); color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 16px; height: 22px; border-radius: 4px; background: var(--holo); transform: rotate(-8deg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.logo.big { font-size: 30px; }
.logo.big .logo-mark { width: 22px; height: 30px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; background: var(--pocket); padding: 32px 28px; border-radius: var(--r-lg); box-shadow: var(--shadow); }
.login-card p { margin: 0; }

/* ---------- Barre du haut ---------- */
.top { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 12px 28px; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.search { position: relative; max-width: 560px; width: 100%; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; height: 42px; padding: 0 14px 0 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--pocket); outline: none; }
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 20%, transparent); }
.nav { display: flex; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 15px; }
.nav a:hover { text-decoration: none; color: var(--ink); background: var(--sleeve); }
.nav a.active { color: var(--ink); background: var(--pocket); box-shadow: var(--shadow); }
.nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 1240px; margin: 0 auto; padding: 28px 28px 80px; outline: none; }
.foot { text-align: center; font-size: 13px; padding: 0 16px 32px; }

/* ---------- Titres ---------- */
h1, h2, h3 { margin: 0; line-height: 1.2; }
.h1 { font: 700 clamp(26px, 4vw, 38px)/1.1 var(--display); letter-spacing: -.02em; }
.h2 { font: 700 20px/1.2 var(--display); letter-spacing: -.01em; }
.section { margin-top: 40px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head .count { color: var(--ink-2); font-weight: 600; }

/* ---------- Boutons, champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--pocket); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn.primary { background: var(--blue); color: var(--blue-ink); border-color: var(--blue); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--down); }
.btn.small { height: 32px; padding: 0 12px; font-size: 14px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search]:not(.search input), select {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pocket); outline: none;
}
input:focus, select:focus { border-color: var(--blue); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--pocket); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.chip:hover { color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar select { width: auto; height: 34px; border-radius: 999px; padding: 0 12px; font-weight: 600; font-size: 14px; }

/* ---------- Progression holo ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--empty); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--holo); background-size: 200% 100%; }

/* ---------- Accueil collection ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: end; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.hero-value { font: 700 clamp(40px, 7vw, 68px)/1 var(--display); letter-spacing: -.03em; }
.hero-sub { margin-top: 10px; font-size: 17px; }
.hero-chart svg { width: 100%; height: 120px; display: block; overflow: visible; }
.hero-chart .axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.facts { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 22px; }
.fact b { display: block; font: 700 20px/1.2 var(--display); }
.fact span { color: var(--ink-2); font-size: 14px; }
.empty-state { text-align: center; padding: 56px 16px; background: var(--pocket); border-radius: var(--r-lg); border: 2px dashed var(--line); }
.empty-state p { margin: 8px auto 18px; max-width: 46ch; color: var(--ink-2); }

/* ---------- Tuiles d'extensions ---------- */
.era { margin-top: 44px; }
.era:first-of-type { margin-top: 8px; }
.era-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 16px; }
.era-head .muted { font-weight: 600; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.set-tile { display: grid; grid-template-rows: 96px auto; background: var(--pocket); border-radius: var(--r); box-shadow: var(--shadow); color: var(--ink); overflow: hidden; }
.set-tile:hover { text-decoration: none; outline: 2px solid var(--blue); outline-offset: 0; }
.set-logo { display: grid; place-items: center; padding: 14px 18px; background: var(--sleeve); }
.set-logo img { max-height: 68px; max-width: 100%; object-fit: contain; }
.set-logo .fallback { font: 700 18px/1.1 var(--display); text-align: center; color: var(--ink-2); }
.set-info { padding: 12px 14px 14px; display: grid; gap: 8px; }
.set-name { font-weight: 700; line-height: 1.25; }
.set-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.set-meta img { width: 18px; height: 18px; object-fit: contain; }
.code { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--sleeve); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.set-progress { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }

/* ---------- Page extension ---------- */
.set-hero { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: center; margin-bottom: 28px; }
.set-hero .set-logo { border-radius: var(--r-lg); height: 150px; background: var(--pocket); box-shadow: var(--shadow); }
.set-hero .set-logo img { max-height: 110px; }
.set-hero .crumbs { font-size: 14px; margin-bottom: 8px; }
.set-hero .facts { margin-top: 16px; }
.set-hero .progress { height: 10px; margin-top: 18px; max-width: 520px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { background: none; border: 0; padding: 10px 16px; font-weight: 700; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs button[aria-selected=true] { color: var(--ink); border-color: var(--ink); }

/* ---------- Grille de cartes : le classeur ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 18px 14px; }
.pocket { position: relative; display: grid; gap: 8px; min-width: 0; }
.pocket-img { position: relative; display: block; aspect-ratio: 63 / 88; border-radius: 8px; background: var(--sleeve); overflow: hidden; cursor: pointer; border: 0; padding: 0; width: 100%; }
.pocket-img img { width: 100%; height: 100%; object-fit: cover; }
.pocket-img .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font-weight: 700; color: var(--ink-2); font-size: 14px; border: 2px dashed var(--line); border-radius: 8px; }
.pocket.missing .pocket-img img { filter: grayscale(1) contrast(.85); opacity: .38; }
.pocket.owned .pocket-img { box-shadow: 0 0 0 3px var(--pocket), 0 0 0 5.5px transparent; }
.pocket.owned .pocket-img::after { content: ''; position: absolute; inset: 0; border-radius: 8px; padding: 3px; background: var(--holo); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.qty-badge { position: absolute; top: 8px; left: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 99px; background: var(--ink); color: var(--page); font-size: 13px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.rev-badge { position: absolute; top: 8px; right: 8px; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--holo); color: #1B1F3B; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.pocket-text { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: start; font-size: 14px; }
.pocket-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pocket-no { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pocket-price { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pocket-sub { text-align: right; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12ch; }
.quick { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.pocket:hover .quick, .pocket:focus-within .quick { opacity: 1; }
.quick button { width: 32px; height: 32px; border-radius: 99px; border: 0; background: var(--blue); color: var(--blue-ink); font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.quick button.minus { background: var(--pocket); color: var(--ink); }
@media (hover: none) { .quick { opacity: 1; } }

/* ---------- Scellé ---------- */
.sealed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.box { display: grid; grid-template-rows: 120px auto; background: var(--pocket); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; text-align: left; border: 0; padding: 0; position: relative; }
.box:hover { outline: 2px solid var(--blue); }
.box-art { position: relative; display: grid; place-items: center; padding: 16px 24px 28px; background: var(--sleeve); }
.box-art img { max-height: 64px; max-width: 80%; object-fit: contain; }
.box-art .fallback { font: 700 16px/1.1 var(--display); color: var(--ink-2); text-align: center; }
.box-kind { position: absolute; left: 12px; bottom: 10px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--pocket); border: 1px solid var(--line); }
.box-body { padding: 12px 14px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
.box-name { font-weight: 600; line-height: 1.3; }
.box-set { font-size: 13px; color: var(--ink-2); grid-column: 1; }
.box-price { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; grid-row: 1; grid-column: 2; white-space: nowrap; }
.box.owned .box-art::before { content: ''; position: absolute; inset: 0 0 auto; height: 5px; background: var(--holo); }

/* ---------- Listes (tendances, résultats) ---------- */
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.rows { background: var(--pocket); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--ink); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--sleeve); text-decoration: none; }
.row-thumb { width: 44px; aspect-ratio: 63/88; border-radius: 4px; overflow: hidden; background: var(--sleeve); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-thumb.box-thumb { aspect-ratio: 1; display: grid; place-items: center; }
.row-thumb.box-thumb img { object-fit: contain; padding: 4px; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-right b { display: block; }
.row-right small { font-size: 13px; font-weight: 700; }

/* ---------- Fiche (modal) ---------- */
dialog { width: min(900px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--pocket); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(14, 16, 34, .6); }
dialog[open] { animation: pop .16s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.sheet { position: relative; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.sheet-art { background: var(--sleeve); padding: 24px; display: grid; align-content: start; gap: 14px; }
.sheet-art .pocket-img { cursor: default; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.sheet-art .box-art { border-radius: var(--r); min-height: 200px; }
.sheet-main { padding: 24px 26px 26px; display: grid; gap: 20px; align-content: start; min-width: 0; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.sheet-head h2 { font: 700 22px/1.2 var(--display); letter-spacing: -.01em; }
.sheet-head .muted { margin-top: 6px; font-size: 14px; }
.close { flex: none; width: 36px; height: 36px; border-radius: 99px; border: 0; background: var(--sleeve); cursor: pointer; font-size: 22px; line-height: 1; color: var(--ink); }
.price-big { display: flex; gap: 28px; flex-wrap: wrap; }
.price-big div span { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.price-big div b { font: 700 24px/1.2 var(--display); }
.price-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 6px 18px; font-size: 14px; }
.price-table div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted var(--line); padding: 3px 0; }
.price-table span { color: var(--ink-2); }
.spark svg { width: 100%; height: 90px; display: block; overflow: visible; }
.spark .axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.owned-list { display: grid; gap: 8px; }
.owned-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--sleeve); border-radius: var(--r-sm); font-size: 14px; }
.owned-row .btn { height: 30px; }
.form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form .wide { grid-column: span 2; }
.form .full { grid-column: 1 / -1; }
.form-box { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; }
.form-box h3 { font-size: 15px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--sleeve); border: 1px solid var(--line); }
.seg button { border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--pocket); color: var(--ink); box-shadow: var(--shadow); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--page); padding: 11px 18px; border-radius: 999px; font-weight: 600; z-index: 100; transition: opacity .15s, transform .15s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { padding: 60px 0; text-align: center; color: var(--ink-2); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  /* backdrop-filter piégerait la barre du bas (position: fixed) dans l'en-tête */
  .top { backdrop-filter: none; background: var(--page); }
  .sheet-head .close { position: absolute; top: 12px; right: 12px; z-index: 2; box-shadow: var(--shadow); background: var(--pocket); }
  .top { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 10px 16px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--pocket); border-top: 1px solid var(--line); }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 12px; flex: 1; border-radius: var(--r); }
  .nav a.active { box-shadow: none; background: var(--sleeve); }
  main { padding: 20px 16px 110px; }
  .foot { padding-bottom: 100px; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .set-hero { grid-template-columns: 1fr; gap: 18px; }
  .set-hero .set-logo { height: 120px; }
  .two-cols { grid-template-columns: 1fr; }
  .sheet { grid-template-columns: 1fr; }
  .sheet-art { padding: 18px 18px 0; background: none; }
  .sheet-art .pocket-img { max-width: 220px; margin: 0 auto; }
  .sheet-main { padding: 18px; }
  .form { grid-template-columns: 1fr 1fr; }
  .form .wide { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .logo { font-size: 0; gap: 0; }
  .logo .logo-mark { width: 18px; height: 24px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 10px; }
  .pocket-text { grid-template-columns: 1fr; font-size: 13px; }
  .pocket-price, .pocket-sub { text-align: left; }
  .pocket-sub { display: none; }
  .set-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .set-tile { grid-template-rows: 76px auto; }
  .set-logo img { max-height: 52px; }
  .set-info { padding: 10px; }
  .set-name { font-size: 14px; }
  .sealed-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .box { grid-template-rows: 96px auto; }
  .box-body { grid-template-columns: 1fr; padding: 10px; }
  .box-price { grid-row: auto; grid-column: 1; text-align: left; }
  .facts { gap: 18px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
