/* Wikimuseum : cabinet de curiosités, chaque carte tamponnée au nom de son propriétaire. */

:root {
  color-scheme: light;
  --paper: #e6ebef;
  --surface: #fbfcfd;
  --surface-2: #f1f4f7;
  --ink: #172238;
  --muted: #5b6679;
  --line: #c7d0da;
  --action: #1e4e79;
  --action-ink: #ffffff;
  --stamp: #b0362b;
  --ok: #2f7a4f;
  --danger: #a3302a;

  --r-commun: #8a8a8a;
  --r-peu_commun: #3c8a5a;
  --r-rare: #2d6cb5;
  --r-super_rare: #7148bd;
  --r-ultra_rare: #be3346;
  --r-legendaire: #b8860b;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-s: 4px;
  --radius-m: 10px;
  --shadow-card: 0 1px 0 rgba(23, 34, 56, .08), 0 6px 18px -8px rgba(23, 34, 56, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #10151d;
    --surface: #18202b;
    --surface-2: #1f2835;
    --ink: #e4e9f0;
    --muted: #97a3b4;
    --line: #2b3645;
    --action: #7fb0dd;
    --action-ink: #0d1520;
    --stamp: #e0675a;
    --ok: #6cc08f;
    --danger: #ec7a70;
    --r-commun: #a3a3a3;
    --r-peu_commun: #5fb07d;
    --r-rare: #5d97dc;
    --r-super_rare: #a07fe0;
    --r-ultra_rare: #e86174;
    --r-legendaire: #e0ad38;
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 20px -10px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #10151d;
    --surface: #18202b;
    --surface-2: #1f2835;
    --ink: #e4e9f0;
    --muted: #97a3b4;
    --line: #2b3645;
    --action: #7fb0dd;
    --action-ink: #0d1520;
    --stamp: #e0675a;
    --ok: #6cc08f;
    --danger: #ec7a70;
    --r-commun: #a3a3a3;
    --r-peu_commun: #5fb07d;
    --r-rare: #5d97dc;
    --r-super_rare: #a07fe0;
    --r-ultra_rare: #e86174;
    --r-legendaire: #e0ad38;
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 20px -10px rgba(0, 0, 0, .8);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; }
a { color: var(--action); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.4rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }

/* ---------- Boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 700 .95rem/1 var(--sans);
  padding: .7em 1.1em;
  border-radius: var(--radius-s);
  border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { font-size: .85rem; padding: .5em .8em; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--action);
  text-decoration: underline; cursor: pointer;
}

label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .3rem; }
input, select, textarea {
  font: 1rem/1.3 var(--sans); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-s); padding: .55em .7em; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--action); outline: none; }
.field { margin-bottom: 1rem; }
.form-error { color: var(--danger); font-weight: 700; margin: .5rem 0 0; min-height: 1.5em; }

/* ---------- Écran de connexion ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
}
.auth-panel {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 2rem;
}
.auth-panel h1 { font-size: 2.6rem; margin-bottom: .4rem; }
.auth-panel > p { color: var(--muted); margin-bottom: 1.5rem; }
.tabs { display: flex; gap: 1.25rem; border-bottom: 1.5px solid var(--line); margin-bottom: 1.25rem; }
.tabs button {
  background: none; border: 0; padding: .5rem 0; margin-bottom: -1.5px;
  font: 700 1rem var(--sans); color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--surface); border-bottom: 1.5px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { font: 700 1.3rem var(--serif); color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a {
  padding: .45rem .75rem; border-radius: var(--radius-s); color: var(--ink);
  text-decoration: none; font-weight: 700; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }
.account { display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.coins { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coins::before {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .35em;
  border-radius: 50%; background: var(--r-legendaire); vertical-align: -.05em;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
}
@media (max-width: 720px) {
  .nav { order: 3; flex-basis: 100%; }
}

main { max-width: 1240px; margin: 0 auto; padding: 1.75rem 1rem 4rem; }
.view-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.view-head p { color: var(--muted); max-width: 62ch; margin-top: .35rem; }

.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar > * { flex: 1 1 180px; max-width: 320px; }
.toolbar input[type="search"] { flex-basis: 260px; }

.panel {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-m); padding: 1.25rem;
}
.section { margin-top: 2.25rem; }
.section > h2 { margin-bottom: .9rem; }
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius-m);
  padding: 1.5rem; color: var(--muted); text-align: center;
}

/* ---------- Carte ---------- */
.grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}
.card {
  --rc: var(--r-commun);
  position: relative; display: flex; flex-direction: column;
  aspect-ratio: 5 / 7; min-width: 0;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); border-left: 6px solid var(--rc);
  border-radius: var(--radius-m); box-shadow: var(--shadow-card);
  overflow: hidden; cursor: pointer; text-align: left;
}
.card.r-peu_commun { --rc: var(--r-peu_commun); }
.card.r-rare { --rc: var(--r-rare); }
.card.r-super_rare { --rc: var(--r-super_rare); }
.card.r-ultra_rare { --rc: var(--r-ultra_rare); }
.card.r-legendaire {
  --rc: var(--r-legendaire);
  border: 3px double var(--rc); border-left: 6px solid var(--rc);
}
.card-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem .6rem .35rem;
}
.card-no { font: 500 .75rem var(--serif); color: var(--muted); font-variant-numeric: tabular-nums; }
.seal {
  display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.9rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--rc); color: #fff;
  font: 700 .72rem var(--sans);
}
.card-img {
  position: relative; flex: 0 0 44%; margin: 0 .6rem;
  border-radius: var(--radius-s); overflow: hidden;
  background: color-mix(in srgb, var(--rc) 18%, var(--surface-2));
  display: grid; place-items: center;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-initial { font: 700 3.4rem var(--serif); color: color-mix(in srgb, var(--rc) 70%, var(--ink)); }
.card-body { padding: .5rem .6rem 0; flex: 1; min-height: 0; overflow: hidden; }
.card-title {
  font-size: 1rem; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: .78rem; color: var(--muted); line-height: 1.3; margin-top: .25rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-stats {
  display: grid; grid-template-columns: 1fr 1fr; margin: 0;
  border-top: 1.5px solid var(--line);
}
.card-stats > div { padding: .35rem .6rem .45rem; }
.card-stats > div + div { border-left: 1.5px solid var(--line); }
.card-stats dt { font-size: .66rem; color: var(--muted); }
.card-stats dd { margin: 0; font: 700 .95rem var(--sans); font-variant-numeric: tabular-nums; }

/* Le tampon du propriétaire : l'élément qui rend chaque carte unique. */
.stamp {
  position: absolute; right: .35rem; bottom: .4rem; max-width: 88%;
  transform: rotate(-7deg); transform-origin: right bottom;
  padding: .15rem .45rem .2rem; border: 2px solid var(--stamp); border-radius: 3px;
  color: var(--stamp); background: color-mix(in srgb, var(--surface) 82%, transparent);
  font: 700 .82rem/1.1 var(--sans); text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  mix-blend-mode: normal;
}
.stamp small { display: block; font: 400 .58rem/1.1 var(--sans); }
.fav {
  position: absolute; top: 2.4rem; left: .9rem; color: var(--r-legendaire);
  font-size: 1.1rem; text-shadow: 0 0 3px var(--surface);
}
.flag {
  position: absolute; top: 2.55rem; right: .9rem;
  background: var(--ink); color: var(--surface);
  font: 700 .65rem var(--sans); padding: .2rem .4rem; border-radius: 3px;
}
.card:hover { border-color: var(--rc); }

/* ---------- Ouverture de paquet ---------- */
.pack-stage { display: grid; gap: 2rem; justify-items: center; text-align: center; }
.pack-box { display: grid; justify-items: center; gap: .6rem; }
.pack-box[hidden] { display: none; }
.pack-result { width: 100%; }
.pack-intro { max-width: 62ch; margin-bottom: 1rem; }
.pack-intro p { margin: .6rem 0 1.2rem; color: var(--muted); }
.pack-btn { background: none; border: 0; padding: .5rem; cursor: pointer; border-radius: 12px; transition: transform .2s; }
.pack-btn:hover:not(:disabled), .pack-btn:focus-visible { transform: translateY(-6px) rotate(-2deg); }
.pack-btn:disabled { cursor: default; opacity: .45; filter: grayscale(1); }
.pack-svg { width: 170px; height: auto; display: block; filter: drop-shadow(0 12px 14px rgba(0,0,0,.28)); }
.pack-btn.shake { animation: pack-shake .75s ease-in-out; }
.pack-btn.shake .pack-svg { animation: pack-glow .75s ease-in forwards; }
@keyframes pack-shake { 0%,100% { transform: none; } 15% { transform: rotate(-7deg) scale(1.04); } 30% { transform: rotate(7deg) scale(1.06); } 45% { transform: rotate(-9deg) scale(1.08); } 60% { transform: rotate(9deg) scale(1.1); } 80% { transform: rotate(0) scale(1.2); } }
@keyframes pack-glow { to { filter: drop-shadow(0 0 28px #ffd75e) brightness(1.15); } }
@media (prefers-reduced-motion: reduce) { .pack-btn.shake, .pack-btn.shake .pack-svg { animation: none; } }
.pack-count { margin: .2rem 0 0; font-size: 1.15rem; }
.pack-result .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.flip { perspective: 1200px; aspect-ratio: 5 / 7; cursor: pointer; border-radius: var(--radius-m); }
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d;
}
.flip.revealed .flip-inner { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; backface-visibility: hidden; }
.flip-front { transform: rotateY(180deg); }
.flip-front .card { height: 100%; }
.flip-back {
  border-radius: var(--radius-m); border: 1.5px solid var(--ink);
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(255, 255, 255, .06) 10px 11px),
    var(--ink);
  color: var(--surface); display: grid; place-items: center; text-align: center; padding: 1rem;
  box-shadow: var(--shadow-card);
}
.flip-back span { font: 700 1.2rem var(--serif); }
.flip-back small { display: block; font: .75rem var(--sans); opacity: .7; margin-top: .35rem; }
.pack-summary { margin: 1rem 0 0; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
}

/* ---------- Fenêtre de détail ---------- */
.modal {
  border: 0; padding: 0; border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  width: min(880px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
}
.modal::backdrop { background: rgba(10, 15, 25, .6); }
.modal-close {
  position: absolute; top: .5rem; right: .6rem; z-index: 2;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.4rem; cursor: pointer;
}
#modal-body { padding: 1.5rem; }
.card-detail { display: grid; grid-template-columns: 250px 1fr; gap: 1.75rem; }
.card-detail .card { cursor: default; }
@media (max-width: 640px) {
  .card-detail { grid-template-columns: 1fr; }
  .card-detail .card { max-width: 250px; }
}
.card-detail h2 { font-size: 1.8rem; padding-right: 2rem; }
.card-detail .extract { margin: .9rem 0; line-height: 1.6; max-width: 65ch; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 1rem 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.licence { font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.detail-actions { border-top: 1.5px solid var(--line); margin-top: 1.25rem; padding-top: 1.25rem; display: grid; gap: 1rem; }
.inline-form { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 140px; }

/* ---------- Échanges ---------- */
.trade-builder { display: grid; gap: 1rem; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .trade-cols { grid-template-columns: 1fr; } }
.pick-list {
  border: 1.5px solid var(--line); border-radius: var(--radius-s);
  max-height: 340px; overflow-y: auto; background: var(--surface-2);
}
.pick {
  display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; margin: 0;
  border-bottom: 1px solid var(--line); font-weight: 400; cursor: pointer;
}
.pick:last-child { border-bottom: 0; }
.pick input { width: auto; }
.pick.disabled { opacity: .5; cursor: not-allowed; }
.mini {
  --rc: var(--r-commun);
  display: flex; align-items: center; gap: .5rem; min-width: 0;
}
.mini .seal { min-width: 1.7rem; height: 1.7rem; font-size: .65rem; flex: none; }
.mini-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-stats { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: auto; }
.r-peu_commun { --rc: var(--r-peu_commun); }
.r-rare { --rc: var(--r-rare); }
.r-super_rare { --rc: var(--r-super_rare); }
.r-ultra_rare { --rc: var(--r-ultra_rare); }
.r-legendaire { --rc: var(--r-legendaire); }
.mini .seal, .reg-seal { background: var(--rc); }

.trade-list { display: grid; gap: 1rem; }
.trade { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; }
.trade-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.trade-head strong { font-family: var(--serif); font-size: 1.05rem; }
.trade-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .trade-sides { grid-template-columns: 1fr; } }
.trade-sides h3 { font: 700 .85rem var(--sans); color: var(--muted); margin-bottom: .35rem; }
.trade-sides ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.trade-message { margin-top: .75rem; font-style: italic; }
.trade-actions { display: flex; gap: .6rem; margin-top: .9rem; flex-wrap: wrap; }
.status { font-weight: 700; font-size: .85rem; }
.status-acceptee, .status-vendue { color: var(--ok); }
.status-refusee, .status-caduque, .status-annulee, .status-invendue { color: var(--muted); }

/* ---------- Enchères ---------- */
.auction-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.auction {
  display: grid; grid-template-columns: 130px 1fr; gap: .9rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: .8rem;
}
.auction .card { font-size: .8em; }
.auction .card .card-title { font-size: .85rem; }
.auction .card .card-desc, .auction .card .stamp { display: none; }
.auction .card-stats dd { font-size: .8rem; }
.auction-info { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.auction-info h3 { font-size: 1.05rem; }
.price { font: 700 1.5rem var(--sans); font-variant-numeric: tabular-nums; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.countdown.soon { color: var(--danger); }
.bid-form { display: flex; gap: .4rem; margin-top: auto; }
.bid-form input { min-width: 0; }
.leader { color: var(--ok); font-weight: 700; font-size: .9rem; }

/* ---------- Registre ---------- */
.rarity-counts { display: flex; gap: .5rem 1.1rem; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: .9rem; }
.rarity-counts span { display: inline-flex; align-items: center; gap: .35rem; }
.reg-seal {
  display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .25rem;
  border-radius: 999px; color: #fff; font: 700 .65rem var(--sans);
}
.table-wrap { overflow-x: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .8rem; color: var(--muted); font-weight: 700; background: var(--surface-2); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }
.title-cell { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.me { color: var(--stamp); font-weight: 700; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Notifications ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem;
  width: min(460px, calc(100vw - 2rem));
}
.toast {
  background: var(--ink); color: var(--surface); padding: .75rem 1rem;
  border-radius: var(--radius-s); box-shadow: var(--shadow-card); font-weight: 700;
}
.toast.error { background: var(--danger); color: #fff; }

.loading { color: var(--muted); padding: 2rem 0; }

/* ---------- Utilitaires ---------- */
.full { width: 100%; }
.hint { margin: .3rem 0 1rem; }
.spaced { margin-top: 1rem; }
.span-all { grid-column: 1 / -1; }
.narrow { max-width: 320px; }
.flush { margin: 0; }
.pad { padding: .75rem; }
.push-down { margin-top: auto; }
.inline-form .field.wide { flex: 2 1 240px; }

/* ---------- Ajustements ---------- */
.pick .mini { flex: 1; }
.auction .card .card-body { display: none; }
.auction .card .card-img { flex: 1; margin-bottom: .6rem; }
@media (max-width: 520px) {
  .grid, .pack-result .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .card-top { padding: .35rem .45rem .25rem; }
  .card-img { margin: 0 .45rem; }
  .card-body { padding: .4rem .45rem 0; }
  .card-title { font-size: .9rem; }
  .card-desc { display: none; }
  .card-stats > div { padding: .3rem .45rem .35rem; }
  .card-stats dd { font-size: .85rem; }
  .stamp { font-size: .72rem; }
  .auction { grid-template-columns: 110px 1fr; }
}

[hidden] { display: none !important; }
.discard-box { margin: 0 0 .8rem; }
.discard-box p { margin: 0 0 .5rem; color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 700; align-self: flex-start; }
.switch input { appearance: none; width: 2.6rem; height: 1.5rem; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: .2rem; left: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--surface); transition: transform .2s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(1.1rem); }
.switch input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.toolbar > .btn { flex: 0 0 auto; }
.grid.selecting { padding-bottom: 6rem; }
.grid.selecting .card { cursor: pointer; position: relative; }
.card.selected { outline: 3px solid var(--ink); outline-offset: 3px; }
.card.selected::after { content: '✓'; position: absolute; top: .5rem; right: .5rem; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--surface); font-weight: 700; }
.sel-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; width: min(960px, calc(100% - 1.5rem)); padding: .7rem .9rem; background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--radius-m); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.sel-bar .sep { width: 1px; height: 1.5rem; background: var(--line); }
.tag-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .4rem; }
.tag-list li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.tag-list label { display: inline-flex; gap: .5rem; align-items: center; flex: 1; font-weight: 700; }
.tag-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0 0 .8rem; }
.chip { font: inherit; font-size: .85rem; padding: .25em .7em; border-radius: 99px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.plink { color: inherit; font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; }
.plink:hover { text-decoration: underline solid; }
.section-title { margin: 1.5rem 0 .3rem; }
.showcases { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-top: 1rem; }
.slot { display: grid; gap: .5rem; align-content: start; }
.slot-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.slot.empty, .slot.locked { min-height: 220px; place-content: center; justify-items: center; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius-m); background: transparent; color: var(--muted); font: inherit; padding: 1rem; }
.slot.empty { cursor: pointer; }
.slot.empty:hover, .slot.empty:focus-visible { border-color: var(--ink); color: var(--ink); }
.slot.empty strong { font-size: 2rem; line-height: 1; }
.slot.locked.dim { opacity: .55; }
.pick-list { display: grid; gap: .4rem; margin-top: .8rem; max-height: 55vh; overflow: auto; }
.pick-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem .7rem; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-s); cursor: pointer; }
.pick-row:hover, .pick-row:focus-visible { border-color: var(--ink); }
.seg { display: inline-flex; gap: .4rem; align-self: flex-start; }
th.key, td.key { background: var(--surface-2); font-weight: 700; }
tr.me-row td { color: var(--stamp); }

.icon-btn { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { background: var(--surface-2); }
.settings { display: grid; gap: 1rem; margin-top: 1rem; }

/* ============ Direction artistique : cabinet de curiosités ============ */
:root {
  --paper: #eadfc6; --surface: #f6eedb; --surface-2: #ecdfc3;
  --ink: #2f2217; --muted: #6f5b46; --line: #c9b690;
  --action: #5a3a1f; --action-ink: #f6eedb; --stamp: #a3281d; --ok: #4d6b3a; --danger: #8f2a1f;
  --r-commun: #8a7c68; --r-peu_commun: #5b7a43; --r-rare: #3b6a8a; --r-super_rare: #6b4a86; --r-ultra_rare: #a3281d; --r-legendaire: #ad8120;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Literata", Georgia, "Times New Roman", serif;
  --radius-s: 2px; --radius-m: 5px;
  --shadow-card: 0 1px 0 rgba(60, 40, 20, .18), 0 8px 16px -10px rgba(60, 40, 20, .6);
  --vignette: rgba(90, 55, 20, .2);
  --tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  --paper: #17110c; --surface: #221a12; --surface-2: #2c2217;
  --ink: #ecdfc6; --muted: #ab9778; --line: #433425;
  --action: #d9ab5f; --action-ink: #1b130b; --stamp: #e4796a; --ok: #8fb872; --danger: #ef8a7a;
  --r-commun: #a39580; --r-peu_commun: #82b068; --r-rare: #6a9fc0; --r-super_rare: #a784c4; --r-ultra_rare: #e0675a; --r-legendaire: #e3b341;
  --shadow-card: 0 1px 0 rgba(0, 0, 0, .4), 0 10px 20px -10px rgba(0, 0, 0, .9);
  --vignette: rgba(0, 0, 0, .55);
}
body { background: var(--paper) var(--tex); background-attachment: fixed; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 50%, var(--vignette)); }

h1, h2, h3 { font-family: var(--serif); letter-spacing: 0; }
.view-head h1::after { content: ''; display: block; width: 3.5rem; margin-top: .55rem; border-top: 1px solid var(--stamp); border-bottom: 1px solid var(--stamp); height: 3px; }
.pack-intro h1::before, .auth-panel h1::before { content: '❦'; display: block; color: var(--stamp); font-size: 1.3rem; line-height: 1.2; }
.auth-panel h1 { font-style: italic; }

.topbar { border-bottom: 4px double var(--line); }
.brand { font-style: italic; font-size: 1.5rem; }
.brand::before { content: '❦'; color: var(--stamp); margin-right: .45rem; font-style: normal; }
.nav a { font-variant: small-caps; letter-spacing: .05em; font-size: 1.02rem; }
.nav a[aria-current="page"] { background: transparent; color: var(--stamp); box-shadow: inset 0 -2px var(--stamp); border-radius: 0; }

.btn { letter-spacing: .02em; border-width: 1.5px; }
.btn.primary { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12), 0 2px 0 rgba(0, 0, 0, .28); }
.auth-panel, .panel, .trade, .modal { outline: 1px solid var(--line); outline-offset: -6px; }
.modal { border: 1.5px solid var(--line); }

.card { background: var(--surface) var(--tex); border: 1.5px solid var(--line); border-top: 5px solid var(--rc); }
.card.r-legendaire { border: 3px double var(--rc); border-top: 6px double var(--rc); box-shadow: var(--shadow-card), 0 0 22px -6px var(--rc); }
.card::before { content: ''; position: absolute; inset: 3px; border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); border-radius: 3px; pointer-events: none; z-index: 1; }
.card-img { border: 1px solid var(--line); border-radius: 2px; background: color-mix(in srgb, var(--rc) 10%, var(--surface-2)); box-shadow: inset 0 0 14px rgba(70, 45, 20, .25); }
.card-img img { filter: sepia(.4) contrast(1.03) saturate(.85); }
.card-title { font-family: var(--serif); font-weight: 700; }
.card-desc { font-style: italic; }
.card-no { font-style: italic; }
.card-no::before { content: 'Pl. '; }
.card-stats dt { font-variant: small-caps; letter-spacing: .06em; }
.stamp { font-family: var(--serif); font-style: italic; border: 2px double var(--stamp); border-radius: 2px; background: transparent; mix-blend-mode: multiply; }
:root[data-theme="dark"] .stamp { mix-blend-mode: normal; }
.seal, .reg-seal {
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--rc) 65%, #fff), var(--rc) 55%, color-mix(in srgb, var(--rc) 65%, #000));
  border-radius: 52% 48% 50% 50% / 50% 52% 48% 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4), inset 0 0 0 2px rgba(255, 255, 255, .16);
  font-family: var(--serif); text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}
th { font-variant: small-caps; letter-spacing: .06em; font-size: .92rem; border-bottom: 3px double var(--line); }
.slot.empty, .slot.locked { border: 2px solid var(--line); background: color-mix(in srgb, var(--ink) 5%, transparent); box-shadow: inset 0 0 0 5px var(--surface), inset 0 0 0 6px var(--line); }


/* ============ Navigation : barre latérale (ordinateur) et barre du bas (mobile) ============ */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; }

#shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
#shell > main { grid-column: 2; max-width: 1400px; width: 100%; margin: 0 auto; }
.side {
  grid-column: 1; grid-row: 1 / span 4; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.2rem; padding: 1.2rem .8rem;
  background: var(--surface); border-right: 4px double var(--line); overflow-y: auto;
}
.side .brand { padding: 0 .5rem; }
.side-nav { display: grid; gap: .2rem; }
.side-nav a, .side-btn {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem .7rem;
  border: 0; border-radius: var(--radius-s); background: transparent; color: var(--ink);
  font: inherit; font-variant: small-caps; letter-spacing: .05em; font-size: 1.05rem; font-weight: 700;
  text-decoration: none; cursor: pointer; text-align: left;
}
.side-nav a:hover, .side-btn:hover { background: var(--surface-2); }
.side-nav a[aria-current="page"] { background: color-mix(in srgb, var(--stamp) 10%, transparent); color: var(--stamp); box-shadow: inset 3px 0 var(--stamp); }
.side-account { margin-top: auto; display: grid; gap: .4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.side-account .coins { padding: 0 .7rem; }
.side-pseudo { padding: 0 .7rem; color: var(--muted); font-style: italic; }
.side-actions { display: grid; gap: .1rem; }
.side-btn { font-size: .95rem; font-weight: 400; font-variant: normal; letter-spacing: 0; }
.mobile-top, .tabbar, .more-sheet { display: none; }

@media (max-width: 760px) {
  #shell { display: block; }
  .side { display: none; }
  .mobile-top {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    position: sticky; top: 0; z-index: 10; padding: .6rem 1rem;
    background: var(--surface); border-bottom: 4px double var(--line);
  }
  #shell > main { padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 4px double var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tab {
    display: grid; justify-items: center; gap: .15rem; padding: .5rem .2rem .45rem; border: 0; background: transparent;
    color: var(--muted); font: inherit; font-size: .72rem; font-variant: small-caps; letter-spacing: .04em; font-weight: 700; text-decoration: none; cursor: pointer;
  }
  .tab[aria-current="page"], .tab[data-active] { color: var(--stamp); box-shadow: inset 0 3px var(--stamp); }
  .more-sheet:not([hidden]) {
    display: grid; position: fixed; right: .6rem; bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px)); z-index: 45;
    min-width: 230px; padding: .4rem; gap: .1rem; background: var(--surface);
    border: 1.5px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
  }
  .more-who { padding: .4rem .7rem; color: var(--muted); font-style: italic; border-bottom: 1px solid var(--line); margin-bottom: .2rem; }
  .more-item {
    display: flex; align-items: center; gap: .75rem; padding: .7rem; border: 0; border-radius: var(--radius-s); background: transparent;
    color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: left;
  }
  .more-item:hover, .more-item[aria-current="page"] { background: var(--surface-2); color: var(--stamp); }
  .sel-bar { bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px)); }
  .toasts { bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px)); }
  .grid.selecting { padding-bottom: 9rem; }
}


/* ============ Sceaux de rareté : gris pour « commun », lettres centrées ============ */
.r-commun { --rc: var(--r-commun); }
.seal, .reg-seal {
  display: inline-grid; place-items: center; line-height: 1; letter-spacing: 0;
  text-indent: 0; padding: 0; box-sizing: border-box;
  min-width: 1.9rem; height: 1.9rem; text-align: center;
}
.mini .seal, .reg-seal { min-width: 1.7rem; height: 1.7rem; }
.seal > *, .reg-seal > * { display: block; }
.card-top { justify-content: flex-end; }

/* Attente prolongée à l'ouverture d'un paquet : le paquet continue de vibrer et rayonne. */
.pack-btn.charging { animation: pack-charge 0.9s ease-in-out infinite; }
@keyframes pack-charge {
  0%, 100% { transform: scale(1) rotate(-1.5deg); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--stamp) 50%, transparent)); }
  50% { transform: scale(1.06) rotate(1.5deg); filter: drop-shadow(0 0 22px color-mix(in srgb, var(--stamp) 85%, transparent)); }
}
@media (prefers-reduced-motion: reduce) { .pack-btn.charging { animation: none; } }

/* Le sceau du registre est aussi un <span> : sans ceci, « .rarity-counts span » l'aligne à gauche. */
.seal, .reg-seal, .rarity-counts .reg-seal, .title-cell .reg-seal {
  display: inline-flex; align-items: center; justify-content: center; gap: 0; flex: none;
}
.seal, .reg-seal { padding-top: .06rem; }

/* ============ Cartes shiny : version noire des ultra rares et des légendaires ============ */
.card.shiny {
  --rc: #e9e4d8;
  background: linear-gradient(155deg, #1b1917 0%, #0c0b0a 55%, #191613 100%);
  color: #f1ece0; border: 3px double #cfc7b4; border-left: 6px solid #cfc7b4;
  box-shadow: 0 0 0 1px #000, 0 6px 18px rgba(0, 0, 0, .55), inset 0 0 28px rgba(255, 255, 255, .05);
  position: relative; overflow: hidden;
}
.card.shiny::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .13) 50%, transparent 65%);
  background-size: 250% 100%; animation: shiny-sheen 4.5s ease-in-out infinite;
}
@keyframes shiny-sheen { 0% { background-position: 130% 0; } 60%, 100% { background-position: -80% 0; } }
.card.shiny .card-title { color: #fff; }
.card.shiny .card-desc { color: #b9b2a2; }
.card.shiny .card-img { background: #050505; }
.card.shiny .card-initial { color: #d8d0bd; }
.card.shiny .stamp { color: #e9e4d8; border-color: #e9e4d8; mix-blend-mode: normal; background: rgba(0, 0, 0, .6); }
.seal.shiny, .reg-seal.shiny {
  background: radial-gradient(circle at 35% 30%, #5a5650, #16140f 60%, #000);
  color: #f3eedf; box-shadow: 0 1px 2px rgba(0, 0, 0, .6), inset 0 0 0 2px rgba(233, 228, 216, .55);
}
.card.shiny .card-top .seal.shiny::before { content: none; }
@media (prefers-reduced-motion: reduce) { .card.shiny::after { animation: none; } }

/* ============ Cartes colorées selon leur rareté ============ */
.card:not(.shiny) {
  background: linear-gradient(172deg,
    color-mix(in srgb, var(--rc) 38%, var(--surface)) 0%,
    color-mix(in srgb, var(--rc) 16%, var(--surface)) 55%,
    color-mix(in srgb, var(--rc) 24%, var(--surface)) 100%);
  border-color: color-mix(in srgb, var(--rc) 60%, var(--line));
}
.card:not(.shiny) .card-img { background: color-mix(in srgb, var(--rc) 22%, var(--surface-2)); }
.card:not(.shiny) .card-desc { color: color-mix(in srgb, var(--rc) 30%, var(--muted)); }

/* ============ Étiquettes : sur les cartes et filtre de l'album ============ */
.card-tags { display: flex; flex-wrap: nowrap; gap: .25rem; padding: .3rem .6rem .55rem; overflow: hidden; }
.card-tags .tag-pill { flex: 0 1 auto; min-width: 0; }
.card-tags .tag-pill.more { flex: none; }
.tag-pill {
  font: 600 .68rem/1 var(--sans, inherit); padding: .22rem .5rem; border-radius: 99px;
  background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag-pill.more { opacity: .75; }
.card.shiny .tag-pill { background: rgba(255, 255, 255, .12); color: #f1ece0; border-color: rgba(255, 255, 255, .3); }
.tag-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.tag-filter .chip small { opacity: .7; margin-left: .15rem; }

/* ============ Confirmation ============ */
.confirm-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }

/* ============ Découverte d'une carte shiny ============ */
.flip { position: relative; }
.flip.shiny-reveal { z-index: 30; }
.flip.shiny-reveal .flip-inner { animation: shiny-spin 2.4s cubic-bezier(.25, .7, .25, 1) both; }
@keyframes shiny-spin {
  0%   { transform: rotateY(0) scale(1) translateY(0); filter: brightness(1); }
  12%  { transform: rotateY(180deg) scale(1.2) translateY(-14px); filter: brightness(1.4); }
  55%  { transform: rotateY(1260deg) scale(1.55) translateY(-34px); filter: brightness(1.8) drop-shadow(0 0 18px #fff); }
  70%  { transform: rotateY(1800deg) scale(1.55) translateY(-34px); filter: brightness(1.6) drop-shadow(0 0 22px #fff); }
  78%  { transform: rotateY(1980deg) scale(1.05) translateY(6px); filter: brightness(1.3); }
  86%  { transform: rotateY(1980deg) scale(1.12) translateY(-8px); }
  100% { transform: rotateY(1980deg) scale(1) translateY(0); filter: brightness(1); }
}
.spark {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; display: grid; place-items: center;
  font-size: calc(var(--size, 8px) * 2); line-height: 1; color: #ffd24a; pointer-events: none; z-index: 40; opacity: 0;
  text-shadow: 0 0 4px #fff, 0 0 10px #ffb300, 0 0 18px #ff8a00;
  animation: spark-fly 1.3s ease-out var(--delay, 0s) both;
}
@keyframes spark-fly {
  0%   { opacity: 0; transform: translate(0, 0) scale(.3) rotate(0); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.8) rotate(200deg); }
}
@media (prefers-reduced-motion: reduce) { .flip.shiny-reveal .flip-inner { animation: none; } .spark { display: none; } }

/* ============ Contenu du paquet : boutons en haut sur téléphone ============ */
.pack-view { display: flex; flex-direction: column; }
.pack-view > h2 { order: 0; }
.pack-view > .hint { order: 1; }
.pack-view > .grid { order: 2; }
.pack-view > .pack-summary { order: 3; }
@media (max-width: 760px) {
  .pack-view > .pack-summary {
    order: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; margin: .4rem 0 .8rem;
  }
  .pack-view > .pack-summary .btn.primary { flex: 1 1 100%; }
  .pack-view > .pack-summary .btn:not(.primary) { flex: 1 1 auto; }
  .pack-view > .hint { order: 2; }
  .pack-view > .grid { order: 3; }
}
#pack-result { scroll-margin-top: 4.5rem; }

/* ============ Succès ============ */
.nav-badge {
  margin-left: auto; min-width: 1.35rem; height: 1.35rem; padding: 0 .4rem; border-radius: 99px;
  display: inline-grid; place-items: center; background: var(--stamp); color: #fff;
  font: 700 .75rem/1 var(--sans, inherit); letter-spacing: 0;
}
.nav-badge[hidden], .tab-dot[hidden] { display: none; }
.tab { position: relative; }
.tab-dot { position: absolute; top: .45rem; right: calc(50% - 1.3rem); width: .6rem; height: .6rem; border-radius: 50%; background: var(--stamp); box-shadow: 0 0 0 2px var(--surface); }
.more-item .nav-badge { margin-left: auto; }
.ach-section { margin: 0 0 1.6rem; }
.ach-cat { font-size: 1.15rem; font-variant: small-caps; letter-spacing: .06em; margin: 0 0 .7rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .9rem; }
.ach {
  display: grid; gap: .7rem; padding: .9rem 1rem; border: 1.5px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); align-content: start;
}
.ach.ready { border-color: var(--stamp); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stamp) 16%, transparent); }
.ach.claimed { opacity: .72; }
.ach.secret:not(.ready):not(.claimed) { border-style: dashed; }
.ach-head { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; }
.ach-head h3 { margin: 0; font-size: 1.05rem; }
.ach-desc { margin: .15rem 0 0; color: var(--muted); font-size: .92rem; }
.ach-badge .reg-seal { width: 2.4rem; height: 2.4rem; min-width: 2.4rem; font-size: .95rem; }
.ach-symbol {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 2px double var(--line); color: var(--stamp); font-size: 1.15rem; background: var(--surface-2);
}
.ach-bar { height: .5rem; border-radius: 99px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.ach-bar i { display: block; height: 100%; background: var(--stamp); border-radius: inherit; }
.ach.claimed .ach-bar i { background: var(--muted); }
.ach-foot { display: flex; justify-content: space-between; gap: .6rem; font-size: .88rem; flex-wrap: wrap; }
.ach-progress { color: var(--muted); font-variant-numeric: tabular-nums; }
.ach-reward { font-weight: 700; color: var(--stamp); }
.ach-reward.card { font-style: italic; }
.ach-state { margin: 0; color: var(--muted); font-size: .9rem; }
.ach-claim { width: 100%; }
.reward-card { width: min(250px, 70vw); margin: 1rem auto; aspect-ratio: 5 / 7; }
.reward-card .card { height: 100%; }
.shiny-pop { animation: shiny-pop 1.2s ease-out both; }
@keyframes shiny-pop { 0% { transform: scale(.6) rotate(-8deg); filter: brightness(2); } 60% { transform: scale(1.08) rotate(2deg); } 100% { transform: scale(1); filter: none; } }
@media (prefers-reduced-motion: reduce) { .shiny-pop { animation: none; } }

/* Bouton Succès toujours visible dans la barre du haut sur téléphone */
.mobile-top-right { display: inline-flex; align-items: center; gap: .9rem; }
.top-succes { position: relative; display: inline-grid; place-items: center; color: var(--ink); text-decoration: none; padding: .2rem; }
.top-succes[aria-current="page"] { color: var(--stamp); }
.top-succes .nav-badge { position: absolute; top: -.35rem; right: -.5rem; margin: 0; min-width: 1.1rem; height: 1.1rem; font-size: .65rem; padding: 0 .3rem; }
/* Écran large mais bas (téléphone en paysage) : on resserre la barre latérale pour que tout tienne */
@media (min-width: 761px) and (max-height: 700px) {
  .side { gap: .6rem; padding: .7rem .6rem; }
  .side-nav a { padding: .35rem .6rem; font-size: .98rem; }
  .side-account { padding-top: .5rem; gap: .2rem; }
  .side-btn { padding: .35rem .6rem; }
}

/* Logo */
.card-initial { display: grid; place-items: center; width: 100%; height: 100%; }
.card-initial .logo-mark { width: 62%; max-width: 110px; height: auto; opacity: .9; }
.card.shiny .card-initial .logo-mark { opacity: .8; }
.brand { display: inline-flex; align-items: center; gap: .5rem; }
.brand::before { content: none; }
.brand-logo { width: 1.9rem; height: 1.9rem; flex: none; }

/* Bazar du musée */
.bazaar { margin-bottom: 2rem; padding-bottom: 1.2rem; border-bottom: 1px dashed var(--line); }
.bazaar > p { margin: .2rem 0 1rem; }
.bazaar-history { margin-top: .9rem; font-size: .9rem; }
.bazaar-history summary { cursor: pointer; color: var(--muted); }
.bazaar-history ul { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .35rem; }
.bazaar-history li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.bazaar-lot .bid-form { flex-wrap: wrap; }
.bazaar-lot .bid-form input { flex: 1 1 5.5rem; width: 5.5rem; min-width: 0; }

/* Paramètres : interrupteurs alignés sur toute la largeur, texte à gauche, bouton à droite */
.settings { display: grid; gap: .9rem; }
.settings .switch { width: 100%; align-self: stretch; justify-content: space-between; flex-direction: row-reverse; align-items: center; }
.settings .switch input { margin: 0; }
.settings .switch span { line-height: 1.5rem; }
