/* ============ CollecDex — styles ============ */
:root {
  --bg: #0f1420;
  --bg2: #161d2d;
  --surface: #1c2538;
  --surface2: #243049;
  --line: #2e3a55;
  --text: #eef2fb;
  --muted: #95a1bd;
  --accent: #e3350d;
  --accent2: #ffcb05;
  --ok: #3ecf8e;
  --gold: #e8b923;
  --silver: #c9d1dc;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
/* place de la barre de défilement toujours réservée : la page ne se décale plus quand une fenêtre s'ouvre */
html { scrollbar-gutter: stable; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden, [hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: linear-gradient(90deg, #b3200a, var(--accent));
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.3rem; letter-spacing: .5px; }
.brand b { color: var(--accent2); }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.mainnav a, .topactions a { text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; opacity: .9; white-space: nowrap; }
.mainnav a:hover, .topactions a:hover { background: rgba(0,0,0,.18); }
.mainnav a.active, .topactions a.active { background: rgba(0,0,0,.3); opacity: 1; }
.mainnav .ico { display: none; }
.topactions { display: flex; gap: 4px; align-items: center; }

.app { max-width: 1280px; margin: 0 auto; padding: 22px 20px 80px; }

/* ---------- Generic ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface2); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #4a5a80; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ff4a20; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-auto { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
input[type=text], input[type=search], input[type=number], select, textarea {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); font-size: .82rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: .85rem; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--accent2); color: #1a1a1a; border-color: var(--accent2); font-weight: 700; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: #3a1616; border: 1px solid #7a2a2a; padding: 16px; border-radius: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }

/* ---------- Progress ---------- */
.progress { height: 9px; border-radius: 999px; background: var(--bg2); overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .4s; }
.progress.done > span { background: linear-gradient(90deg, #22a06b, var(--ok)); }
.count { font-variant-numeric: tabular-nums; font-weight: 800; }
.count .of { color: var(--muted); font-weight: 600; }

/* ---------- Rarity symbols ---------- */
.rar { display: inline-flex; align-items: center; gap: 1px; vertical-align: middle; }
.rar svg { display: block; }
.rar-txt { font-size: .62rem; font-weight: 800; padding: 1px 5px; border-radius: 5px; background: #444; color: #fff; letter-spacing: .3px; }
.rarity-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Home ---------- */
.hero { padding: 26px; border-radius: 20px; background: radial-gradient(circle at 85% 20%, rgba(255,203,5,.18), transparent 40%), linear-gradient(135deg, #1f2a44, #121827); border: 1px solid var(--line); margin-bottom: 24px; }
.hero p { max-width: 720px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-top: 16px; }
.stat { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.45rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.game-tile { position: relative; display: block; text-decoration: none; padding: 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); min-height: 150px; overflow: hidden; transition: transform .15s, border-color .15s; }
.game-tile:hover { transform: translateY(-3px); border-color: var(--accent2); }
.game-tile .gicon { font-size: 2.2rem; }
.game-tile.soon { opacity: .55; pointer-events: none; }
.game-tile .tag { position: absolute; top: 12px; right: 12px; }

/* ---------- Sets list ---------- */
.serie-block { margin-bottom: 28px; }
.serie-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.serie-head img { height: 34px; }
.set-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); position: relative; transition: border-color .15s, transform .15s; }
.set-card:hover { border-color: #5a6c96; transform: translateY(-2px); }
.set-card.complete { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 18px rgba(232,185,35,.15); }
.set-card .logo-wrap { height: 64px; display: flex; align-items: center; justify-content: center; }
.set-card .logo-wrap img { max-height: 64px; max-width: 100%; object-fit: contain; }
.set-card .set-title { display: flex; gap: 8px; align-items: center; }
.set-card .set-title img { width: 20px; height: 20px; object-fit: contain; }
.set-card .set-title b { flex: 1; font-size: .98rem; }
.set-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.badge-complete { position: absolute; top: -9px; right: -9px; background: linear-gradient(135deg, #ffe58a, var(--gold)); color: #3a2a00; font-weight: 900; font-size: .72rem; padding: 4px 9px; border-radius: 999px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 4px; }

/* ---------- Set page ---------- */
.set-hero { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 24px; align-items: center; margin-bottom: 18px; }
.set-hero .logo-big { max-height: 120px; max-width: 100%; object-fit: contain; }
.set-hero .bigcount { font-size: 2.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.medal { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: linear-gradient(135deg, #fff1b8, var(--gold)); color: #3a2a00; font-weight: 900; }
.rarity-progress { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 22px; }
.rp-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.rp-row .progress { grid-column: 1 / -1; height: 7px; }
.rp-name { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.pull-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pull-table td, .pull-table th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; position: sticky; top: 58px; z-index: 20; background: rgba(15,20,32,.92); backdrop-filter: blur(6px); padding: 10px 0; }

/* ---------- Card grid ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.st-more { text-align: center; margin-top: 16px; }
.st-more:empty { display: none; }
.cards.big { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.ctile { position: relative; cursor: pointer; border-radius: 10px; }
.ctile .cimg { position: relative; aspect-ratio: 63/88; border-radius: 9px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); }
.ctile .cimg img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .2s, opacity .2s, transform .2s; }
.ctile:hover .cimg img { transform: scale(1.03); }
.ctile.missing .cimg img { filter: grayscale(1) brightness(.55); opacity: .45; }
.ctile.missing .cimg::after { content: "?"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; font-weight: 900; color: rgba(255,255,255,.25); }
.ctile .numonly { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 10px; background: repeating-linear-gradient(135deg, var(--bg2) 0 10px, #19202f 10px 20px); }
.ctile .numonly b { font-size: 1.9rem; color: #56617c; font-variant-numeric: tabular-nums; }
.ctile .numonly span { font-size: .78rem; color: var(--muted); }
.ctile.missing .cimg:has(.numonly)::after { content: none; }
.ctile .noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; color: var(--muted); font-size: .85rem; }
.ctile .cinfo { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 2px 0; font-size: .8rem; }
.ctile .cname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ctile .cnum { color: var(--muted); font-variant-numeric: tabular-nums; }
.ctile .qty { position: absolute; top: 7px; left: 7px; background: rgba(0,0,0,.75); border-radius: 999px; font-size: .75rem; font-weight: 800; padding: 2px 8px; z-index: 2; }
.ctile .fav { position: absolute; top: 5px; right: 8px; color: var(--accent2); font-size: 1.1rem; z-index: 2; text-shadow: 0 1px 3px #000; }
.ctile .ownedmark { position: absolute; bottom: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #073; font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: .8rem; z-index: 2; }
.ctile .price { font-weight: 700; color: var(--accent2); }
.ctile .myphoto { position: absolute; top: 7px; right: 7px; font-size: .7rem; background: rgba(0,0,0,.7); padding: 2px 6px; border-radius: 6px; z-index: 2; }

/* ---------- Modal / card detail ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
.modal-box { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; width: min(980px, 100%); max-height: 92vh; overflow: auto; padding: 24px; box-shadow: var(--shadow); }
.modal-x { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 1.8rem; cursor: pointer; color: var(--muted); }
.cd { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 26px; }
.cd-img { position: relative; }
.cd-img img { width: 100%; border-radius: 14px; box-shadow: var(--shadow); display: block; }
.cd-img .imgswitch { margin-top: 10px; }
.cd dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0; }
.cd dt { color: var(--muted); }
.cd dd { margin: 0; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos .ph { position: relative; width: 74px; aspect-ratio: 63/88; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); cursor: pointer; }
.photos .ph.sel { border-color: var(--accent2); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph .del { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.75); border: 0; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: .8rem; }
.section { margin-top: 18px; }
.section > h3 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }

/* ---------- Toast & background tasks ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #111827; border: 1px solid var(--line); padding: 11px 18px; border-radius: 12px; z-index: 200; box-shadow: var(--shadow); font-weight: 600; }
.bgtasks { position: fixed; bottom: 16px; right: 16px; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: .85rem; min-width: 240px; box-shadow: var(--shadow); }
.bgtasks .progress { margin-top: 6px; }

/* ---------- Showcase / vitrine ---------- */
.vitrine { border-radius: 22px; padding: 28px; position: relative; overflow: hidden; border: 1px solid var(--line); }
.v-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.v-avatar { width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--accent2); background: var(--surface2) center/cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 900; }
.v-name { font-size: 2rem; font-weight: 900; }
.v-badges { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.v-badge { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: linear-gradient(135deg, #fff1b8, var(--gold)); color: #3a2a00; font-weight: 800; font-size: .82rem; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.v-badge img { width: 24px; height: 24px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.v-featured { display: grid; gap: 22px; justify-content: center; margin: 22px 0; }
.v-featured.layout-grille { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.v-featured.layout-vedette { grid-template-columns: repeat(4, minmax(0, 190px)); }
.v-featured.layout-vedette > :first-child { grid-column: span 2; grid-row: span 2; }
.v-featured.layout-grille { grid-template-columns: repeat(auto-fill, minmax(150px, 190px)) !important; }
.v-featured.layout-classeur { grid-template-columns: repeat(3, minmax(0, 200px)); background: #111; padding: 22px; border-radius: 14px; box-shadow: inset 0 0 0 2px #333; }
.v-featured.layout-eventail { display: flex; justify-content: center; padding: 30px 0 10px; }
.v-featured.layout-eventail .vcard { width: 190px; margin: 0 -28px; transition: transform .2s; }
.v-featured.layout-eventail .vcard:hover { transform: translateY(-18px) rotate(0deg) !important; z-index: 5; }
.vcard { position: relative; cursor: pointer; }
.vcard img { width: 100%; display: block; border-radius: 10px; aspect-ratio: 63/88; object-fit: cover; }
.vcard .vlabel { text-align: center; font-size: .8rem; margin-top: 6px; font-weight: 700; }
/* Frames */
.frame-aucun img { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.frame-or { padding: 7px; border-radius: 14px; background: linear-gradient(135deg, #fff3b0, #d4a017 30%, #fff3b0 50%, #b8860b 75%, #ffe680); box-shadow: 0 8px 22px rgba(0,0,0,.5); }
.frame-argent { padding: 7px; border-radius: 14px; background: linear-gradient(135deg, #ffffff, #9aa4b1 30%, #f4f6f8 55%, #7d8794 80%, #e6e9ee); box-shadow: 0 8px 22px rgba(0,0,0,.5); }
.frame-holo { padding: 6px; border-radius: 14px; background: linear-gradient(115deg, #ff6ec4, #7873f5, #4ade80, #facc15, #ff6ec4); background-size: 300% 300%; animation: holo 5s ease infinite; box-shadow: 0 0 22px rgba(120,115,245,.5); }
@keyframes holo { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.frame-neon { padding: 4px; border-radius: 13px; background: #0ff; box-shadow: 0 0 12px #0ff, 0 0 30px #0ff8; }
.frame-bois { padding: 12px; border-radius: 10px; background: repeating-linear-gradient(90deg, #6b4423 0 6px, #7b5230 6px 11px, #5e3a1c 11px 15px); box-shadow: inset 0 0 0 2px #3b2210, 0 8px 22px rgba(0,0,0,.5); }
.frame-vitre { padding: 10px; border-radius: 14px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(4px); box-shadow: 0 8px 22px rgba(0,0,0,.4); }
.frame-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.frame-picker .fp { width: 64px; cursor: pointer; text-align: center; font-size: .75rem; }
.frame-picker .fp .sw { height: 50px; border-radius: 8px; margin-bottom: 4px; border: 2px solid transparent; }
.frame-picker .fp.on .sw { border-color: var(--accent2); }
.pick-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); max-height: 360px; overflow: auto; padding: 4px; }
.pick-list .pk { position: relative; cursor: pointer; border-radius: 8px; border: 2px solid transparent; }
.pick-list .pk.on { border-color: var(--accent2); }
.pick-list .pk img { width: 100%; border-radius: 6px; display: block; aspect-ratio: 63/88; object-fit: cover; }
.pick-list .pk .n { position: absolute; top: 4px; left: 4px; background: var(--accent2); color: #111; border-radius: 50%; width: 22px; height: 22px; font-weight: 900; font-size: .8rem; display: flex; align-items: center; justify-content: center; }

/* ---------- Scanner ---------- */
.scan-wrap { display: grid; grid-template-columns: minmax(280px, 460px) 1fr; gap: 22px; }
.scan-view { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; }
.scan-view video, .scan-view img { width: 100%; height: 100%; object-fit: contain; }
.scan-guide { position: absolute; left: 50%; top: 50%; height: 84%; aspect-ratio: 63/88; transform: translate(-50%, -50%); border: 3px dashed rgba(255,203,5,.85); border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scan-guide::after { content: "Place la carte dans le cadre · touche pour la netteté"; position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: .8rem; color: var(--accent2); text-shadow: 0 1px 3px #000; }
.focus-ring { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 2px solid var(--accent2, #ffcb05); border-radius: 50%; pointer-events: none; animation: focusring .9s ease-out forwards; z-index: 3; }
@keyframes focusring { 0% { transform: scale(1.5); } 30% { transform: scale(1); } 100% { transform: scale(.92); } }
.crop-area { position: relative; display: inline-block; touch-action: none; cursor: move; user-select: none; }
.scan-view .crop-area img { display: block; width: auto; height: auto; max-width: 100%; max-height: 70vh; object-fit: initial; pointer-events: none; }
.scan-view:has(.crop-area) { aspect-ratio: auto; }
.crop-box { position: absolute; border: 3px solid var(--accent2); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); pointer-events: none; }
.cand { display: grid; grid-template-columns: 80px 1fr auto; gap: 14px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px; }
.cand img { width: 80px; border-radius: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .app { padding: 16px 12px 70px; }
  /* Mobile : barre d'onglets en bas de l'écran, compte et réglages en haut */
  .topbar { padding: 8px 12px; flex-wrap: nowrap; }
  .brand { font-size: 1.15rem; }
  .topactions { margin-left: auto; }
  .topactions a { padding: 6px 9px; font-size: .9rem; }
  .mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0; gap: 0; flex-wrap: nowrap;
    background: #141a28; border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.4); }
  .mainnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; border-radius: 10px; font-size: .68rem; font-weight: 700; opacity: .75; }
  .mainnav .ico { display: block; font-size: 1.25rem; line-height: 1.2; }
  .mainnav a.active { background: rgba(227,53,13,.18); opacity: 1; color: #fff; }
  .mainnav a.nav-scan .ico { background: var(--accent); border-radius: 50%; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; margin-top: -18px; border: 3px solid #141a28; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
  .app { padding-bottom: calc(72px + env(safe-area-inset-bottom)); } /* barre du bas (≈ 63 px) + un peu d'air */
  .bgtasks { bottom: 80px; }
  .toast { bottom: 84px; }
  .set-hero, .cd, .scan-wrap { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
  .toolbar { position: static; gap: 8px; padding: 4px 0; background: none; backdrop-filter: none; }
  .toolbar > input, .toolbar > select { flex: 1 1 calc(50% - 8px); min-width: 0 !important; width: auto; font-size: .9rem; padding: 7px 10px; }
  .toolbar > input[type=search] { flex-basis: 100%; }
  h1 { font-size: 1.4rem; }
  /* vitrine : la carte vedette reste raisonnable, les autres en 3 colonnes */
  .v-featured.layout-vedette { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .v-featured.layout-vedette > :first-child { grid-column: 1 / -1; grid-row: auto; justify-self: center; width: min(52%, 200px); }
  .v-featured.layout-grille { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 12px; }
  .vitrine { padding: 16px; border-radius: 16px; }
  .v-head { gap: 12px; margin-bottom: 14px; }
  .v-avatar { width: 64px; height: 64px; font-size: 1.6rem; }
  .v-name { font-size: 1.4rem; }
  .vcard .vlabel { font-size: .72rem; }
  .frame-or, .frame-argent, .frame-holo, .frame-vitre { padding: 4px; }
  .frame-bois { padding: 6px; }
  /* fiche carte : image moins envahissante */
  .cd-img { max-width: 260px; margin: 0 auto; }
  .cd h1 { font-size: 1.3rem; }
  /* accueil, séries, collection */
  .hero { padding: 18px; border-radius: 16px; }
  .hero h1 { font-size: 1.35rem; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 1.15rem; }
  .grid-auto { grid-template-columns: 1fr; gap: 12px; }
  .cards.big { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
  .set-hero { gap: 12px; }
  .set-hero .bigcount { font-size: 1.9rem; }
  .rarity-progress { grid-template-columns: 1fr; }
  .pull-table { font-size: .78rem; }
  .pull-table td, .pull-table th { padding: 5px 4px; }
  .panel { padding: 14px; }
  .row > h1 { margin-bottom: 6px; }
  .selbar { top: 52px; }
  .v-featured.layout-classeur { grid-template-columns: repeat(3, 1fr); padding: 10px; gap: 10px; }
  .v-featured.layout-eventail .vcard { width: 120px; margin: 0 -22px; }
  .modal-box { padding: 16px; }
}

/* ---------- Scan d'une page de classeur ---------- */
.batch-wrap { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 22px; align-items: start; }
.batch-view { aspect-ratio: 4/5; }
.grid-box { position: absolute; display: grid; border: 3px solid var(--accent2); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none; }
.grid-box .gcell { border: 1px dashed rgba(255,203,5,.85); position: relative; }
.grid-box .gcell span { position: absolute; top: 3px; left: 5px; font-size: .75rem; font-weight: 900; color: var(--accent2); text-shadow: 0 1px 3px #000; }
.grid-box .gh { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--accent2); border: 3px solid #111; pointer-events: auto; cursor: nwse-resize; z-index: 2; }
.grid-box .gh.tl { left: -12px; top: -12px; } .grid-box .gh.tr { right: -12px; top: -12px; cursor: nesw-resize; }
.grid-box .gh.bl { left: -12px; bottom: -12px; cursor: nesw-resize; } .grid-box .gh.br { right: -12px; bottom: -12px; }
.btiles { display: grid; gap: 10px; }
.btile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.btile.dim { opacity: .5; }
.btile .bimgs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.btile .bimgs img, .btile .bnone { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 6px; background: var(--bg2); }
.btile .bnone { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.6rem; font-weight: 900; }
.btile select { width: 100%; font-size: .8rem; padding: 5px 6px; }
.btile .bstate { font-size: .78rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.btile .bstate.ok { color: var(--ok); } .btile .bstate.warn { color: #ffb84d; } .btile .bstate.bad { color: #ff6b6b; }
.btile .bsearch { display: grid; gap: 4px; }
.btile .bsearch input { padding: 5px 8px; font-size: .8rem; }
@media (max-width: 900px) { .batch-wrap { grid-template-columns: 1fr; } }
/* téléphone : la caméra dans la page prend toute la largeur de l'écran (bords compris) */
@media (max-width: 760px) {
  .batch-view.live-fit { margin-left: -12px; margin-right: -12px; border-radius: 0; max-height: calc(100dvh - 200px); }
  .batch-view.live-fit video { width: 100%; height: 100%; object-fit: contain; }
}
@media (max-width: 520px) { .btiles { grid-template-columns: repeat(2, minmax(0,1fr)) !important; } }

/* ---------- Compte ---------- */
#nav-account .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9aa3b5; vertical-align: middle; }
#nav-account[data-state="ok"] .dot { background: #3ecf8e; }
#nav-account[data-state="synchro"] .dot, #nav-account[data-state="envoi"] .dot { background: #ffb84d; }
#nav-account[data-state="erreur"] .dot { background: #ff5b5b; }
.sync-ok { color: var(--ok); } .sync-erreur { color: #ff6b6b; }
input[type=email], input[type=password] { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; outline: none; }
.btile.on { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.btile .bcheck { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: .85rem; cursor: pointer; }
.btile .bcheck input { width: 18px; height: 18px; accent-color: var(--ok); }
.btile .btn { white-space: normal; text-align: left; justify-content: flex-start; line-height: 1.25; }
@media (max-width: 520px) { .btile .bstate { white-space: normal; } .btile select { font-size: .75rem; } }


/* ---------- Boutons, recadrage, sélection ---------- */
.btn.danger { background: #3a1416; border-color: #8a2a2a; color: #ffb3b3; }
.btn.danger:hover { background: #5a1a1d; border-color: #c43b3b; }
.btn.danger[disabled] { opacity: .45; }
.photos .ph .crop { position: absolute; bottom: 2px; right: 2px; background: rgba(0,0,0,.75); border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: .75rem; color: #fff; }
.cropper { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; padding: 14px; }
.cropper-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; width: min(560px, 100%); max-height: 96vh; overflow: auto; }
.cropper-stage { display: flex; justify-content: center; background: #000; border-radius: 10px; overflow: hidden; }
.cropper-stage .crop-area img { display: block; max-width: 100%; max-height: 60vh; pointer-events: none; }
.selbar { position: sticky; top: 58px; z-index: 25; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--accent2); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
.cards.selecting .ctile { cursor: pointer; }
.cards.selecting .ctile::before { content: ""; position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; background: rgba(0,0,0,.45); z-index: 3; }
.cards.selecting .ctile.picked::before { content: "✓"; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 900; font-size: .85rem; display: flex; align-items: center; justify-content: center; }
.cards.selecting .ctile.picked .cimg { outline: 3px solid var(--accent); outline-offset: 1px; }
.cards.selecting .ctile .qty { display: none; }
.btile.saved { border-color: var(--ok); opacity: .8; }

