/* Cartothèque Switch 2 : thème système, rouge Nintendo, Space Grotesk / Inter, largeur 880 px. */
:root {
  --bg: #f7f8fa;
  --panel: #fff;
  --soft: #eef0f4;
  --line: #e1e4e9;
  --ink: #20232a;
  --muted: #69707d;
  --red: #e4002b;
  --on-red: #fff;

  --tag-black-bg: #20232a; --tag-black-fg: #fff;
  --tag-green-bg: #e2f5ea; --tag-green-fg: #17653d;
  --tag-red-bg: #fde3e8;   --tag-red-fg: #b3002a;
  --tag-purple-bg: #eee6ff; --tag-purple-fg: #5a36a8;
  --tag-blue-bg: #e3edff;  --tag-blue-fg: #2753a3;
  --tag-orange-bg: #fff0d9; --tag-orange-fg: #865510;

  --display: "Space Grotesk", system-ui, sans-serif;
  --body: Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --panel: #1d2027;
    --soft: #242830;
    --line: #343944;
    --ink: #f0f1f4;
    --muted: #a2a9b7;
    --red: #ff3b55;

    --tag-black-bg: #242832; --tag-black-fg: #fff;
    --tag-green-bg: #193a2b; --tag-green-fg: #8be1ad;
    --tag-red-bg: #4d202b;   --tag-red-fg: #ff94a5;
    --tag-purple-bg: #34264c; --tag-purple-fg: #c7a7ff;
    --tag-blue-bg: #24334b;  --tag-blue-fg: #a9c9ff;
    --tag-orange-bg: #49351c; --tag-orange-fg: #ffd08a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
main { max-width: 880px; margin: 0 auto; padding: 40px 24px 140px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }

/* En-tête */
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.brand { font: 700 20px/1 var(--display); display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 14px; height: 14px; border: 3px solid var(--red); border-radius: 2px; display: inline-block; }
.brand-mark::after { content: ""; display: block; width: 4px; height: 4px; margin: 2px; background: var(--red); }
.brand-num { color: var(--muted); font-weight: 500; }
.kicker { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }

h1 { font: 600 48px/1.05 var(--display); letter-spacing: -2px; margin: 44px 0 16px; }
.lead { color: var(--muted); margin: 0; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin: 26px 0; }
.stats > div { padding: 18px 24px; display: grid; gap: 4px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats strong { font: 600 30px/1.1 var(--display); }
.stats span { font-size: 12px; color: var(--muted); }

.info { border-left: 3px solid var(--red); background: var(--panel); padding: 10px 16px; font-size: 12px; color: var(--muted); }

/* Vues */
.view-switch { display: flex; gap: 10px; margin: 26px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.view-switch button { padding: 13px 18px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; }
.view-switch button:hover { border-color: var(--muted); }
.view-switch button[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--on-red); }
.badge { font-size: 13px; font-weight: 600; }

.note { font-size: 12px; color: var(--muted); margin: 16px 0; }
.label { display: block; font-size: 12px; color: var(--muted); margin: 18px 0 6px; }
#search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); font: inherit; }
#search:focus { border-color: var(--red); outline: none; }
#filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
#filters button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; cursor: pointer; }
#filters button:hover { border-color: var(--muted); }
#filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 28px; }
.section-head h2 { font: 600 22px/1.2 var(--display); margin: 0; }
.count { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Groupes et lignes */
.game-group { margin-top: 30px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.group-head h3 { font: 600 21px/1.2 var(--display); margin: 0; }
.row { display: grid; grid-template-columns: 20px 52px minmax(0, 1fr) 94px; gap: 17px; padding: 21px 0; border-bottom: 1px solid var(--line); align-items: start; }
.row input[type="checkbox"] { width: 17px; height: 17px; margin: 33px 0 0; accent-color: var(--red); cursor: pointer; }
.cover { width: 52px; height: 84px; padding: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: pointer; font: 600 19px var(--display); color: #fff; background: var(--soft); }
.cover img { width: 50px; height: 82px; object-fit: cover; display: block; }
.cover.empty { font: 500 9px/1.2 var(--body); color: var(--muted); text-align: center; padding: 4px; }
.cover.drop { outline: 2px dashed var(--red); outline-offset: 2px; }
.title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.genre { font-size: 11px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0; }
.tag { font-size: 9px; font-weight: 600; padding: 3px 6px; border-radius: 4px; line-height: 1.3; }
.tag.black { background: var(--tag-black-bg); color: var(--tag-black-fg); }
.tag.green { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.tag.red { background: var(--tag-red-bg); color: var(--tag-red-fg); }
.tag.purple { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }
.tag.blue { background: var(--tag-blue-bg); color: var(--tag-blue-fg); }
.tag.orange { background: var(--tag-orange-bg); color: var(--tag-orange-fg); }
.tag.buy { background: var(--red); color: var(--on-red); }
.gnote { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.links { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; }
.links a { color: var(--muted); }
.links a:hover { color: var(--ink); }
.links .sep { opacity: .7; }
.date { text-align: right; font-size: 13px; font-weight: 600; }
.date small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.empty-list { padding: 28px 0; color: var(--muted); display: grid; gap: 12px; justify-items: start; }

/* Écartés */
#excludedSection { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 18px; }
details > summary { font-weight: 600; font-size: 15px; cursor: pointer; }
.ex-group h3 { font: 600 18px/1.2 var(--display); margin: 22px 0 6px; }
.ex-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 17px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ex-cover { background: var(--soft); color: var(--muted); font-size: 16px; }
.ex-cover img { opacity: .9; }
.ex-title { text-decoration: line-through; color: var(--muted); font-size: 13px; }
.ex-sub { font-size: 11px; color: var(--muted); }
.ex-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Ticket */
.ticket { margin-top: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.ticket .section-head { margin-top: 0; }
.ticket h3 { font: 600 17px/1.3 var(--display); margin: 22px 0 10px; }
.scroll { overflow-x: auto; }
.ticket table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ticket th { text-align: left; font-weight: 600; font-size: 12px; padding: 8px 4px; }
.ticket td { padding: 10px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.ticket td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ticket ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; }
.ticket details { margin-top: 16px; }
.btn { padding: 10px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.primary:hover { filter: brightness(1.08); }
.ticket .btn { margin-top: 16px; }

.md { margin-top: 28px; }
.md pre { background: var(--soft); border-radius: 8px; padding: 14px; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }

/* Barre fixe */
footer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 10; }
.bar { max-width: 880px; margin: 0 auto; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.picked { font-size: 13px; display: inline-flex; align-items: baseline; gap: 8px; }
.picked strong { font: 600 24px/1 var(--display); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(8px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 20; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  main { padding: 28px 16px 200px; }
  h1 { font-size: 36px; letter-spacing: -1px; }
  .stats > div { padding: 14px; }
  .stats strong { font-size: 24px; }
  .row { grid-template-columns: 20px 52px minmax(0, 1fr); }
  .row .date { grid-column: 3; text-align: left; }
  .date small { display: inline; margin-left: 6px; }
  .bar { padding: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
