/* Star System (ex-Platine) : pochettes de jazz, aplats ; cartes en couleurs naturelles. */

:root {
  --cobalt: #1e3bff;
  /* L'étoile au centre des disques (logo, dos des cartes, vinyle du booster). */
  --star-signal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50.0,4.0 62.9,35.2 96.6,37.9 70.9,59.8 78.8,92.6 50.0,75.0 21.2,92.6 29.1,59.8 3.4,37.9 37.1,35.2' fill='%23ffd400'/%3E%3C/svg%3E");
  --star-cobalt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50.0,4.0 62.9,35.2 96.6,37.9 70.9,59.8 78.8,92.6 50.0,75.0 21.2,92.6 29.1,59.8 3.4,37.9 37.1,35.2' fill='%231e3bff'/%3E%3C/svg%3E");
  --cobalt-deep: #1328b8;
  --signal: #ffd400;
  --ink: #000;
  --ink-soft: #3c3f46;
  --ink-mute: #6b6f78;
  --paper: #ececea;
  --sheet: #fff;
  --line: #d3d3cf;
  --vermillon: #ff4a1c;
  --ok: #138a4b;

  --r-C: #c9ccd3;
  --r-PC: #34c98e;
  --r-R: #3b8cff;
  --r-OR: #e0ad2e;
  --r-PL: #a3aec0;
  --r-DI: #5fd3f0;

  --display: 'Sofia Sans Extra Condensed', 'Arial Narrow', sans-serif;
  --text: 'Sofia Sans', system-ui, sans-serif;
  --step--1: 0.84rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: 3.2rem;
  --step-5: 5rem;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #f4f4f2;
    --ink-soft: #c9cbd2;
    --ink-mute: #9599a4;
    --paper: #0d0f1f;
    --sheet: #171a33;
    --line: #2c3054;
    --cobalt: #4d66ff;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --ink: #f4f4f2; --ink-soft: #c9cbd2; --ink-mute: #9599a4; --paper: #0d0f1f; --sheet: #171a33; --line: #2c3054; --cobalt: #4d66ff; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px var(--gutter) 64px; outline: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--signal); color: #000; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 0.95; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
p { margin: 0 0 0.8em; max-width: 68ch; }
.mute { color: var(--ink-mute); }
.num { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Bandeau ---------- */

.topbar {
  background: var(--cobalt);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 var(--gutter);
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo { font-family: var(--display); font-weight: 900; font-size: 2.4rem; line-height: 1; text-decoration: none; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 8px 12px; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a:hover { border-bottom-color: rgba(255, 255, 255, 0.5); }
.nav a[aria-current='page'] { border-bottom-color: var(--signal); }
.wallet { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.wallet .num { font-size: 1.5rem; }
.wallet a { text-decoration: none; }
.bell { position: relative; display: inline-flex; padding: 6px; }
.bell .dot { position: absolute; top: 0; right: -2px; background: var(--signal); color: #000; font-size: 0.7rem; font-weight: 700; border-radius: 10px; padding: 0 5px; line-height: 1.4; }
.coin { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 50%; background: radial-gradient(circle, #000 0 18%, var(--signal) 19% 100%); vertical-align: -0.08em; margin-right: 4px; }

@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; gap: 4px 14px; padding-top: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .logo { font-size: 2rem; }
  .wallet { margin-left: auto; }
}

/* ---------- Boutons, champs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--ink); background: var(--sheet); color: var(--ink);
  padding: 10px 18px; border-radius: 4px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform 0.08s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--signal); border-color: #000; color: #000; }
.btn.blue { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; text-decoration: underline; padding-inline: 6px; }
.btn.small { padding: 5px 10px; font-size: var(--step--1); }
.btn.danger { border-color: var(--vermillon); color: var(--vermillon); }

label { display: block; font-weight: 500; margin-bottom: 4px; }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='search'], select, textarea {
  width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 4px; background: var(--sheet);
}
input:focus, select:focus, textarea:focus { border-color: var(--cobalt); outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--cobalt); }
.field { margin-bottom: 16px; }
.form-error { color: var(--vermillon); font-weight: 700; min-height: 1.5em; }

.panel { background: var(--sheet); border: 2px solid var(--line); padding: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 24px; }
.section-title { display: flex; align-items: baseline; gap: 14px; justify-content: space-between; margin: 40px 0 16px; flex-wrap: wrap; }
.empty { padding: 32px; text-align: center; border: 2px dashed var(--line); color: var(--ink-soft); }

/* ---------- Cartes ----------
   Photo en couleurs naturelles. La rareté tient au cadre : trait gris, menthe, azur, puis
   feuilles or, platine et irisée. Commune à Disque d'or : la photo en haut, bord à bord et
   sans rien dessus, comme une pochette ; le nom, l'époque et la description en dessous ; la
   rareté et les deux chiffres dans un pied fin. Platine et Diamant (.full) : la photo occupe
   toute la carte et le texte se pose en blanc sur un dégradé. */

.card {
  --tone: var(--r-C);
  --tone-ink: #4a4f59;
  --foil: var(--tone);
  --paper: #fff;
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 12px;
  color: #000;
  border: 3px solid transparent;
  background: linear-gradient(var(--paper), var(--paper)) padding-box, var(--foil) border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  container-type: inline-size;
  transition: transform 0.15s ease;
}
a.card:hover { transform: translateY(-4px) rotate(-0.6deg); }
.card.r-C { border-width: 2px; }
.card.r-PC { --tone: var(--r-PC); --tone-ink: #0d8a5a; }
.card.r-R { --tone: var(--r-R); --tone-ink: #1f66d6; }
.card.r-OR { border-width: 4px; }
.card.r-PL, .card.r-DI { border-width: 5px; }
/* Les trois plus hautes ont un carton teinté ; Diamant a une feuille irisée qui bouge lentement. */
.card.r-OR { --paper: #fdf5df; }
.card.r-PL { --paper: #edf0f5; }
.card.r-DI { --paper: #f5f0ff; background-size: auto, 300% 300%; animation: foil 7s ease-in-out infinite alternate; }
@keyframes foil { from { background-position: 0 0, 0% 30%; } to { background-position: 0 0, 100% 70%; } }
.card.r-OR { --tone: var(--r-OR); --tone-ink: #a87a00; --foil: linear-gradient(135deg, #fff1b8, #dca42a 26%, #fbe7a1 50%, #bd8612 74%, #f6dc8a); }
.card.r-PL { --tone: var(--r-PL); --tone-ink: #4f5d73; --foil: linear-gradient(135deg, #f4f6f9, #8e9bb2 26%, #e6eaf0 50%, #74819a 74%, #d9dee7); }
.card.r-DI { --tone: var(--r-DI); --tone-ink: #0b8fb0; --foil: linear-gradient(135deg, #ff8fcf, #47d4ff 25%, #a184ff 50%, #4fe8a4 75%, #ffbf5c); }
.op-badges .rarity-pill { --tone: var(--r-C); --foil: var(--tone); background: var(--foil); color: #000; }
.op-badges .rarity-pill.r-PC { --tone: var(--r-PC); } .op-badges .rarity-pill.r-R { --tone: var(--r-R); color: #fff; }
.op-badges .rarity-pill.r-OR { --foil: linear-gradient(135deg, #fff1b8, #dca42a 26%, #fbe7a1 50%, #bd8612 74%, #f6dc8a); }
.op-badges .rarity-pill.r-PL { --foil: linear-gradient(135deg, #f4f6f9, #8e9bb2 26%, #e6eaf0 50%, #74819a 74%, #d9dee7); }
.op-badges .rarity-pill.r-DI { --foil: linear-gradient(135deg, #ff8fcf, #47d4ff 25%, #a184ff 50%, #4fe8a4 75%, #ffbf5c); }

/* La photo : un grand carré, qui ne cède de la hauteur que si un nom sur deux lignes et une longue description en demandent. */
.card-art { position: relative; flex: 0 1 80cqw; min-height: 60cqw; background: #eceef1; overflow: hidden; }
.card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; filter: saturate(0.9) contrast(1.03); }
.card-art.noimg { display: grid; place-items: center; background: repeating-radial-gradient(circle at 50% 50%, #eef0f3 0 1.5px, #e3e6ea 1.5px 4px); }
.card-art .initials { width: 46%; aspect-ratio: 1; border-radius: 50%; border: 3cqw solid transparent; background: linear-gradient(#fff, #fff) padding-box, var(--foil) border-box; display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 13cqw; color: var(--tone-ink); }
.card-body { flex: 1 0 auto; display: flex; flex-direction: column; padding: 3.6cqw 5cqw; }
.card-body > :not(.card-foot):nth-last-child(2) { margin-bottom: 2.4cqw; }
.card-name { font-family: var(--display); font-weight: 800; font-size: 10.5cqw; line-height: 0.95; letter-spacing: -0.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Les petits textes gardent un seuil lisible quand la carte rapetisse sur un téléphone. */
.card-meta { display: flex; justify-content: space-between; gap: 2cqw; margin-top: 1.8cqw; font-size: max(8.5px, 4.9cqw); font-weight: 700; color: var(--tone-ink); white-space: nowrap; }
.card-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.card-years { color: #5a5f69; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-desc { margin: 1.8cqw 0 0; font-size: max(9.5px, 5.2cqw); line-height: 1.28; color: #3a3f4a; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 2cqw; display: flex; align-items: baseline; justify-content: space-between; gap: 2cqw; border-top: 0.45cqw solid color-mix(in srgb, var(--tone) 45%, transparent); }
.card-rarity { font-size: max(8.5px, 4.6cqw); font-weight: 800; letter-spacing: 0.02em; color: var(--tone-ink); white-space: nowrap; }
.card-rarity::before { content: ''; display: inline-block; width: 0.62em; height: 0.62em; margin-right: 0.5em; transform: rotate(45deg); border-radius: 1px; background: var(--foil); vertical-align: 0.06em; }
.card-rarity .count { padding: 0 0.55em; border-radius: 99px; background: #000; color: #fff; }
.card-stats { display: flex; gap: 3.4cqw; align-items: baseline; }
.card-stats .stat { font-size: max(7.5px, 4cqw); font-weight: 600; color: #6b6f78; white-space: nowrap; }
.card-stats .stat b { margin-right: 0.9cqw; font-family: var(--display); font-weight: 900; font-size: 8.4cqw; letter-spacing: 0.01em; color: #000; }
.card .fav { position: absolute; top: 3cqw; right: 4cqw; z-index: 3; color: var(--signal); font-size: 1.2rem; text-shadow: 0 0 2px #000; }
.card .new { position: absolute; top: 5cqw; left: -4px; z-index: 3; background: var(--signal); color: #000; font-family: var(--display); font-weight: 900; font-size: 1.1rem; padding: 0 10px; transform: rotate(-6deg); }

/* Platine et Diamant : plein cadre. */
.card.full .card-art { position: absolute; inset: 0; min-height: 0; }
.card.full .card-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(8, 10, 26, 0) 40%, rgba(8, 10, 26, 0.5) 58%, rgba(8, 10, 26, 0.93) 80%); }
.card.full .card-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 5cqw 5.5cqw 4.4cqw; color: #fff; }
.card.full .card-name { font-size: 11.5cqw; line-height: 0.93; }
.card.full .card-meta, .card.full .card-years { color: rgba(255, 255, 255, 0.78); }
.card.full .card-desc { color: rgba(255, 255, 255, 0.86); }
.card.full .card-foot { border-top-color: rgba(255, 255, 255, 0.22); }
.card.full .card-rarity { background: var(--foil); background-size: 200% 200%; -webkit-background-clip: text; background-clip: text; color: transparent; }
.card.full .card-stats .stat { color: rgba(255, 255, 255, 0.65); }
.card.full .card-stats .stat b { color: #fff; }

/* Petite carte (duel, marché) : la photo, le nom et les deux chiffres, en plus gros. */
@container (max-width: 150px) {
  .card-meta, .card-desc, .card-rarity { display: none; }
  .card-art { flex: 1 1 auto; }
  .card-body { flex: none; }
  .card-name, .card.full .card-name { font-size: 12cqw; -webkit-line-clamp: 1; }
  .card-foot { justify-content: center; padding-top: 0; border: 0; }
  .card-stats { gap: 7cqw; }
  .card-stats .stat { font-size: 7cqw; }
  .card-stats .stat b { font-size: 19cqw; }
}

/* Reflet de la feuille pour les raretés hautes, au survol et à l'ouverture d'un booster. */
.r-OR .card-art::before, .r-PL .card-art::before, .r-DI .card-art::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.65) 45%, transparent 60%);
  background-size: 250% 100%; transition: opacity 0.2s;
}
a.card:hover .card-art::before, .reveal .card-art::before { opacity: 1; animation: sheen 1.3s ease; }
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -40% 0; } }
/* Platine et Diamant : le reflet repasse de lui-même, de loin en loin, pour qu'ils sortent du lot. */
.r-PL .card-art::before, .r-DI .card-art::before { opacity: 1; animation: sweep 6s ease-in-out infinite; }
.r-DI .card-art::before { animation-duration: 4.5s; }
@keyframes sweep { 0% { background-position: 140% 0; } 28%, 100% { background-position: -60% 0; } }
@media (prefers-reduced-motion: reduce) {
  a.card:hover .card-art::before, .reveal .card-art::before, .r-PL .card-art::before, .r-DI .card-art::before { animation: none; opacity: 0; }
  .card.r-DI { animation: none; }
}

/* Carte manquante : silhouette. */
.card.missing { background: transparent; border-style: dashed; border-color: var(--line); color: var(--ink-mute); display: grid; place-items: center; text-align: center; }
.card.missing .q { font-family: var(--display); font-weight: 900; font-size: 30cqw; line-height: 1; opacity: 0.3; }
.card.missing small { font-size: 6.5cqw; }

/* Dos de carte : un 45 tours, une étoile en guise de trou central. */
.card-back {
  position: relative; aspect-ratio: 5 / 7; border-radius: 12px; border: 3px solid #000;
  background: repeating-radial-gradient(circle at 50% 50%, #0b0b0b 0 2px, #1c1c1c 2px 5px);
  container-type: inline-size;
}
.card-back::before {
  content: ''; position: absolute; left: 24%; top: calc(50% - 26cqw); width: 52%; aspect-ratio: 1; border-radius: 50%;
  background: var(--star-signal) 50% 52% / 54% no-repeat, #1e3bff;
}
.card-back::after {
  content: 'Star System'; position: absolute; left: 0; right: 0; top: calc(50% + 31cqw); text-align: center;
  color: #fff; font-family: var(--display); font-weight: 900; font-size: 11cqw; line-height: 1;
}

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 20px; }
.grid-cards.small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (max-width: 520px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-cards.small { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ---------- Accueil connecté ---------- */

.home { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .home { grid-template-columns: 1fr; } }
.sleeve-wrap { position: relative; }
.sleeve {
  position: relative; width: 100%; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; background: transparent; display: block;
}
.sleeve .vinyl {
  position: absolute; top: 7%; left: 14%; width: 86%; aspect-ratio: 1; border-radius: 50%;
  background: var(--star-cobalt) 50% 51% / 15% no-repeat, radial-gradient(circle, var(--signal) 0 17%, #000 17.5% 19%, transparent 19.5%), repeating-radial-gradient(circle, #050505 0 2px, #1a1a1a 2px 4px);
  transition: transform 0.35s ease;
}
.sleeve .cover {
  position: absolute; inset: 0; width: 92%; background: var(--cobalt); color: #fff; text-align: left; padding: 8%;
  display: flex; flex-direction: column; justify-content: space-between;
}
.sleeve .cover strong { font-family: var(--display); font-weight: 900; font-size: clamp(3rem, 9vw, 5.5rem); line-height: 0.85; letter-spacing: -0.03em; }
.sleeve .cover span { font-size: var(--step-1); font-weight: 500; }
@media (hover: hover) { .sleeve:hover:not(:disabled) .vinyl { transform: translateX(6%) rotate(20deg); } }
.sleeve:disabled { cursor: default; }
.sleeve:disabled .cover { background: #555b70; }
.stockline { display: flex; gap: 6px; margin: 18px 0 8px; }
.stockline i { flex: 1; height: 10px; background: var(--line); }
.stockline i.full { background: var(--cobalt); }

/* Bandeau des belles ouvertures : un tirage à la fois, au-dessus de la pochette. */
.pull-feed {
  --rc: var(--line);
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 8px 14px 8px 8px; min-height: 60px;
  background: var(--sheet); border: 2px solid var(--line); border-left: 8px solid var(--rc); color: var(--ink); text-decoration: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.pull-feed.r-OR { --rc: var(--r-OR); }
.pull-feed.r-PL { --rc: var(--r-PL); }
.pull-feed.r-DI { --rc: var(--r-DI); }
.pull-feed.out { opacity: 0; transform: translateY(-4px); }
.pull-feed:hover { border-color: var(--cobalt); border-left-color: var(--rc); }
.pf-art {
  flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--rc); color: #000; font-family: var(--display); font-weight: 800; font-size: 1.1rem; box-shadow: 0 0 0 2px var(--rc);
}
.pf-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.pf-text { display: grid; min-width: 0; line-height: 1.25; }
.pf-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-meta { font-size: var(--step--1); color: var(--ink-mute); }
.pf-rarity { font-weight: 700; color: var(--ink-soft); }
.pf-rarity::before { content: ''; display: inline-block; width: 0.55em; height: 0.55em; margin-right: 0.4em; background: var(--rc); transform: rotate(45deg) translateY(-0.1em); }
@media (prefers-reduced-motion: reduce) { .pull-feed { transition: none; } }
.show-pulls { margin: 24px 0 8px; max-width: 640px; }
.show-pulls small { display: block; margin-top: 2px; line-height: 1.4; }
.timer { font-family: var(--display); font-weight: 800; font-size: var(--step-2); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick a { background: var(--sheet); border: 2px solid var(--line); padding: 14px; text-decoration: none; }
.quick a:hover { border-color: var(--cobalt); }
.quick .num { font-size: var(--step-3); display: block; line-height: 1; }
.meter { height: 12px; background: var(--line); position: relative; }
.meter span { position: absolute; inset: 0 auto 0 0; background: var(--cobalt); }
.rarity-bars { display: grid; gap: 6px; }
.rarity-bars div { display: grid; grid-template-columns: 100px 1fr 70px; gap: 10px; align-items: center; font-size: var(--step--1); }
.rarity-bars .bar { height: 8px; background: var(--line); position: relative; }
.rarity-bars .bar span { position: absolute; inset: 0 auto 0 0; }

/* ---------- Ouverture de booster ---------- */

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5, 8, 30, 0.96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.opening { position: relative; width: min(340px, 70vw); aspect-ratio: 1; }
.opening .cover { position: absolute; inset: 0; background: var(--cobalt); z-index: 2; display: flex; align-items: flex-end; padding: 8%; font-family: var(--display); font-weight: 900; font-size: 4rem; line-height: 0.85; }
.opening .vinyl { position: absolute; inset: 3%; border-radius: 50%; z-index: 1; background: var(--star-cobalt) 50% 51% / 15% no-repeat, radial-gradient(circle, var(--signal) 0 17%, #000 17.5% 19%, transparent 19.5%), repeating-radial-gradient(circle, #050505 0 2px, #1a1a1a 2px 4px); animation: slideout 1.1s cubic-bezier(.5, 0, .2, 1) forwards; }
@keyframes slideout { 0% { transform: translateX(0) rotate(0); } 70% { transform: translateX(62%) rotate(240deg); } 100% { transform: translateX(62%) rotate(300deg); } }
/* La pile : cinq cartes face cachée, décalées, retournées une à une (modèle de French Touch Cards). */
.op-wrap { margin: auto; width: 100%; max-width: 1040px; display: flex; flex-direction: column; align-items: center; }
.op-bar { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.op-hint { font-size: var(--step--1); color: rgba(255, 255, 255, 0.6); }
.op-bar .btn { margin-left: auto; }
.op-stage { display: grid; grid-template-columns: auto minmax(0, 420px); gap: 64px; justify-content: center; align-items: center; width: 100%; }
.op-left { display: flex; flex-direction: column; align-items: center; }
.op-stack {
  --sx: 7px; --sy: -6px; --sr: 1.6deg;
  position: relative; aspect-ratio: 5 / 7; margin: 30px 40px 0 0; cursor: pointer; border-radius: 18px;
  width: max(220px, min(360px, 80vw, calc((100svh - 230px) * 0.714)));
}
/* Le focus clavier reste visible sans passer pour le cadre d'une carte. */
.op-stack:focus-visible { outline: 2px dashed rgba(255, 255, 255, 0.35); outline-offset: 18px; }
.op-card {
  --d: 0;
  position: absolute; inset: 0; perspective: 1400px;
  transform: translate(calc(var(--d) * var(--sx)), calc(var(--d) * var(--sy))) rotate(calc(var(--d) * var(--sr)));
  transition: transform 0.55s cubic-bezier(.2, .8, .2, 1), opacity 0.45s ease, translate 0.25s ease;
  animation: opin 0.6s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--k, 0) * 90ms + 60ms);
}
.op-card.is-out { transform: translate(-125%, 30px) rotate(-14deg); opacity: 0; pointer-events: none; }
@media (hover: hover) { .op-stack:hover .op-card.is-top:not(.is-up) { translate: 0 -8px; } }
@keyframes opin { from { opacity: 0; translate: 0 90px; scale: 0.9; } }
/* Lueur des grosses cartes : un pseudo-élément flou derrière la carte. Un filter sur .flip
   aplatirait la 3D et ferait voir le dos à l'envers à la place de la carte. */
.op-card::before { content: ''; position: absolute; inset: -6%; z-index: -1; border-radius: 12%; pointer-events: none; background: var(--g, transparent); filter: blur(24px); opacity: 0; transition: opacity 0.4s ease; }
.op-card[data-r='OR'] { --g: #ffc21e; }
.op-card[data-r='PL'] { --g: linear-gradient(135deg, #ffffff, #b9c6da, #ffffff); }
.op-card[data-r='DI'] { --g: linear-gradient(135deg, #ff8fcf, #47d4ff, #a184ff, #4fe8a4); }
.op-card.is-top:is([data-r='OR'], [data-r='PL'], [data-r='DI'])::before { opacity: 1; animation: pulse 1.6s ease-in-out infinite; }
.op-card.is-top.is-charge::before { animation: chargeglow 1s ease-in forwards; }
.op-card.is-top.is-up::before { animation: none; opacity: 0.6; }
.op-card.is-charge > .flip { animation: charge 1s linear; }
.op-card.is-up > .flip { animation: lift 0.8s cubic-bezier(.2, .8, .2, 1); }
@keyframes pulse { 50% { opacity: 0.55; scale: 0.97; } }
@keyframes chargeglow { from { opacity: 0.7; scale: 0.97; } to { opacity: 1; scale: 1.16; } }
@keyframes charge { 0%, 100% { translate: 0 0; } 10% { translate: -1px 1px; } 20% { translate: 2px -1px; } 30% { translate: -2px 0; } 40% { translate: 3px 1px; } 50% { translate: -3px -1px; } 60% { translate: 4px 1px; } 70% { translate: -4px -2px; } 80% { translate: 5px 1px; } 90% { translate: -5px 0; } }
@keyframes lift { 40% { scale: 1.05; } }
.flip { position: relative; width: 100%; aspect-ratio: 5 / 7; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(.3, .7, .3, 1); }
.flip.on { transform: rotateY(180deg); }
.flip > * { position: absolute; inset: 0; backface-visibility: hidden; }
.flip .front { transform: rotateY(180deg); }
.op-dots { display: flex; gap: 9px; margin-top: 26px; }
.op-dots i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); transition: transform 0.2s ease, background 0.2s ease; }
.op-dots i.cur { border-color: #fff; transform: scale(1.25); }
.op-dots i.seen { background: var(--tone); border-color: var(--tone); }
.op-dots i.r-C { --tone: var(--r-C); } .op-dots i.r-PC { --tone: var(--r-PC); } .op-dots i.r-R { --tone: var(--r-R); }
.op-dots i.r-OR { --tone: var(--r-OR); } .op-dots i.r-PL { --tone: #dfe6f2; } .op-dots i.r-DI { --tone: var(--r-DI); }
.op-info { min-height: 320px; display: flex; align-items: center; }
.op-info > div { width: 100%; animation: infoin 0.35s ease both; }
@keyframes infoin { from { opacity: 0; translate: 0 12px; } }
.op-count { font-size: var(--step--1); color: rgba(255, 255, 255, 0.65); margin: 0; }
.op-big { font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 0.95; margin: 10px 0 0; text-wrap: balance; }
.op-tease { margin: 18px 0 0; font-family: var(--display); font-weight: 800; font-size: 1.7rem; color: var(--signal); animation: tease 1.2s ease-in-out infinite alternate; }
.op-tease.r-PL { color: #dfe6f2; } .op-tease.r-DI { color: #9fe9ff; }
@keyframes tease { to { opacity: 0.55; translate: 0 -3px; } }
.op-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.op-badges span { padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: var(--step--1); background: rgba(255, 255, 255, 0.14); }
.op-badges .op-new { background: var(--signal); color: #000; }
.op-info h2 { font-family: var(--display); font-weight: 900; font-size: clamp(2.2rem, 4.6vw, 3.6rem); line-height: 0.92; margin: 0; overflow-wrap: anywhere; }
.op-years { font-family: var(--display); font-weight: 800; font-size: 1.7rem; margin: 10px 0 0; color: var(--signal); }
.op-desc { margin: 10px 0 0; color: rgba(255, 255, 255, 0.85); max-width: 40ch; }
.op-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.op-tags span { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-size: var(--step--1); font-weight: 700; }
.op-next { margin: 22px 0 0; font-size: var(--step--1); color: rgba(255, 255, 255, 0.55); }
.op-sum { align-items: stretch; }
.op-sum h2 { font-family: var(--display); font-weight: 900; font-size: clamp(2.4rem, 5vw, 4rem); line-height: 0.95; margin: 0 0 6px; }
.op-sum .op-count { margin-bottom: 20px; }
.op-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.op-grid .card { animation: dealin 0.5s cubic-bezier(.2, .8, .2, 1) backwards; }
.op-grid .card:nth-child(2) { animation-delay: 70ms; } .op-grid .card:nth-child(3) { animation-delay: 140ms; }
.op-grid .card:nth-child(4) { animation-delay: 210ms; } .op-grid .card:nth-child(5) { animation-delay: 280ms; }
@keyframes dealin { from { opacity: 0; translate: 0 30px; scale: 0.94; } }
.confetti { position: fixed; z-index: 70; pointer-events: none; width: 10px; height: 14px; top: 0; left: 0; }
.flash { position: fixed; inset: 0; z-index: 60; pointer-events: none; animation: flash 0.9s ease-out forwards; }
.flash.r-OR { background: radial-gradient(circle at 50% 40%, rgba(255, 194, 30, 0.5), transparent 65%); }
.flash.r-PL { background: radial-gradient(circle at 50% 40%, rgba(225, 233, 246, 0.5), transparent 65%); }
.flash.r-DI { background: radial-gradient(circle at 50% 40%, rgba(120, 220, 255, 0.45), rgba(255, 140, 200, 0.25) 40%, transparent 70%); }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 760px) {
  .op-stage { grid-template-columns: 1fr; gap: 14px; justify-items: center; }
  .op-stack { width: max(190px, min(270px, 70vw, calc((100svh - 360px) * 0.714))); margin: 18px 28px 0 0; }
  .op-dots { margin-top: 18px; }
  .op-info { min-height: 0; text-align: center; }
  .op-badges, .op-tags { justify-content: center; }
  .op-desc { margin-inline: auto; }
  .op-big { font-size: 1.7rem; }
  .op-info h2 { font-size: 2.2rem; }
  .op-hint { display: none; }
  .op-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.overlay-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.unlocked { margin-top: 16px; background: var(--signal); color: #000; padding: 8px 14px; font-weight: 700; }
.unlocked[hidden] { display: none; }

/* ---------- Album ---------- */

.filters { display: grid; gap: 12px; margin: 20px 0 24px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 2px solid var(--line); background: var(--sheet); padding: 4px 12px; border-radius: 20px; cursor: pointer; font-weight: 500; font-size: var(--step--1); }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { color: var(--ink-mute); margin-left: 4px; }
.chip[aria-pressed='true'] .n { color: inherit; opacity: 0.7; }
.filters .row > * { flex: 1 1 160px; }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 28px; }

/* ---------- Fiche carte ---------- */

.detail { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 40px; align-items: start; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } .detail > .card { max-width: 300px; } }
.detail h1 { font-size: clamp(2.6rem, 7vw, 5rem); margin-bottom: 12px; }
/* Écouter : le lien exact de l'artiste quand Wikidata le connaît ; une loupe signale une recherche. */
.listen-box { margin: 20px 0 24px; padding: 16px 18px 18px; background: var(--sheet); border-radius: 14px; }
.listen-box h2 { margin: 0 0 12px; font-family: var(--text); font-size: var(--step-0); font-weight: 800; }
.listen { display: flex; flex-wrap: wrap; gap: 8px; }
.listen-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border: 2px solid var(--ink); border-radius: 999px; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.listen-link:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.listen-link.main { background: var(--ink); color: var(--paper); }
.listen-link i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.listen-link.spotify { --c: #1db954; } .listen-link.apple { --c: #fa2d48; } .listen-link.deezer { --c: #a238ff; }
.listen-link img { width: 20px; height: 20px; margin: -3px 0; }
.listen-link.search::after { content: ''; width: 9px; height: 9px; margin-left: 2px; border: 2px solid currentColor; border-radius: 50%; opacity: 0.55; box-shadow: 4px 4px 0 -3px currentColor; }
.listen.on-dark { margin-top: 18px; }
.listen.on-dark .listen-link { padding: 6px 13px; border-color: rgba(255, 255, 255, 0.6); color: #fff; font-size: var(--step--1); }
.listen.on-dark .listen-link.main { background: #fff; border-color: #fff; color: #000; }
.listen.on-dark .listen-link:hover { background: rgba(255, 255, 255, 0.12); }
.listen.on-dark .listen-link.main:hover { background: #fff; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 2px; margin: 20px 0; background: var(--line); border: 2px solid var(--line); }
.facts div { background: var(--sheet); padding: 10px 12px; }
.facts dt { font-size: var(--step--1); color: var(--ink-mute); }
.facts dd { margin: 0; font-weight: 700; }
.photo { border: 2px solid var(--line); background: var(--sheet); }
.photo img { max-height: 420px; width: 100%; object-fit: contain; background: #000; }
.photo figcaption { font-size: var(--step--1); padding: 6px 10px; color: var(--ink-mute); }

/* ---------- Duels ---------- */

.board { display: grid; gap: 18px; }
.lane { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.lane .card, .lane .card-back { max-width: 150px; width: 100%; margin-inline: auto; }
.lane-name { font-family: var(--display); font-weight: 800; font-size: var(--step-1); margin: 0 0 6px; }
.lane .slot-card { position: relative; }
.lane .slot-card.current .card { outline: 4px solid var(--signal); outline-offset: 3px; }
.lane .slot-card .hit { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); font-family: var(--display); font-weight: 900; font-size: 1.4rem; padding: 0 8px; background: #000; color: #fff; white-space: nowrap; }
.lane .slot-card .hit.miss { background: var(--vermillon); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.versus .side { font-family: var(--display); font-weight: 800; font-size: var(--step-2); }
.versus .side:last-child { text-align: right; }
.versus .score { font-family: var(--display); font-weight: 900; font-size: var(--step-5); line-height: 0.8; white-space: nowrap; }
@media (max-width: 600px) {
  .versus { grid-template-columns: 1fr 1fr; grid-template-areas: "moi lui" "score score"; row-gap: 8px; }
  .versus .side:first-child { grid-area: moi; }
  .versus .side:last-child { grid-area: lui; }
  .versus .score { grid-area: score; text-align: center; font-size: var(--step-4); }
}
.question { background: var(--sheet); border: 3px solid var(--ink); padding: 24px; }
.question .prompt { font-family: var(--display); font-weight: 800; font-size: var(--step-3); line-height: 1; margin-bottom: 12px; }
.question blockquote { margin: 0 0 16px; padding: 12px 16px; background: var(--paper); border-left: 6px solid var(--cobalt); font-size: var(--step-1); line-height: 1.4; }
.question .qimg { max-height: 260px; width: auto; margin: 0 0 16px; border: 3px solid #000; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 560px) { .options { grid-template-columns: 1fr; } }
.options button { text-align: left; padding: 14px 16px; border: 2px solid var(--ink); background: var(--sheet); cursor: pointer; font-weight: 700; font-size: var(--step-1); border-radius: 4px; }
.options button:hover:not(:disabled) { background: var(--signal); color: #000; }
.options button.right { background: var(--ok); color: #fff; border-color: var(--ok); }
.options button.wrong { background: var(--vermillon); color: #fff; border-color: var(--vermillon); }
.options button:disabled { cursor: default; }
.clock { height: 6px; background: var(--line); margin: -24px -24px 20px; }
.clock span { display: block; height: 100%; background: var(--cobalt); transform-origin: left; }
.result-banner { font-family: var(--display); font-weight: 900; font-size: clamp(3rem, 10vw, 7rem); line-height: 0.85; }
.result-banner.win { color: var(--cobalt); }
.result-banner.loss { color: var(--vermillon); }

/* ---------- Listes (marché, échanges, classement) ---------- */

.list { display: grid; gap: 10px; }
.item { background: var(--sheet); border: 2px solid var(--line); padding: 12px; display: grid; grid-template-columns: 92px 1fr auto; gap: 16px; align-items: center; }
.item .card { width: 92px; }
.item h3 { font-size: var(--step-2); }
.item .price { font-family: var(--display); font-weight: 900; font-size: var(--step-3); line-height: 1; text-align: right; }
.item .bidform { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }
.item .bidform input { width: 110px; }
@media (max-width: 600px) { .item { grid-template-columns: 72px 1fr; } .item .card { width: 72px; } .item > :last-child { grid-column: 1 / -1; } .item .price { text-align: left; } .item .bidform { justify-content: flex-start; } }
.chart { width: 100%; border-collapse: collapse; background: var(--sheet); }
.chart th, .chart td { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); }
.chart th { font-size: var(--step--1); color: var(--ink-mute); font-weight: 500; }
.chart td.pos { font-family: var(--display); font-weight: 900; font-size: var(--step-2); width: 60px; }
.chart tr.me td { background: color-mix(in srgb, var(--signal) 30%, transparent); }
.chart .r { text-align: right; }
/* Sur téléphone, les colonnes secondaires (.wide) disparaissent et les cellules se resserrent. */
@media (max-width: 600px) {
  .chart th, .chart td { padding: 8px 6px; }
  .chart td.pos { width: 32px; font-size: var(--step-1); }
  .chart .wide { display: none; }
}
.tabs { display: flex; gap: 4px; border-bottom: 3px solid var(--ink); margin: 16px 0 20px; flex-wrap: wrap; }
.tabs button, .tabs a { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font-weight: 700; text-decoration: none; }
.tabs [aria-selected='true'] { background: var(--ink); color: var(--paper); }
.trade { background: var(--sheet); border: 2px solid var(--line); padding: 16px; }
.sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin: 12px 0; }
.swap { font-family: var(--display); font-size: 2.4rem; font-weight: 900; }
@media (max-width: 600px) { .sides { grid-template-columns: 1fr; } .swap { transform: rotate(90deg); justify-self: center; } }
.picker { max-height: 52vh; overflow-y: auto; padding: 4px; }
.picker .card { cursor: pointer; }
.picker .pick { position: relative; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; }
.picker .pick[aria-pressed='true'] .card { outline: 4px solid var(--signal); outline-offset: 2px; }
.picker .pick[aria-pressed='true']::after { content: '✓'; position: absolute; top: -6px; right: -6px; background: var(--signal); color: #000; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; z-index: 4; }

/* ---------- Fenêtre modale ---------- */

dialog { border: 3px solid var(--ink); background: var(--paper); color: var(--ink); padding: 0; width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(5, 8, 30, 0.7); }
dialog .dhead { background: var(--cobalt); color: #fff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
dialog .dbody { padding: 20px; overflow-y: auto; max-height: calc(100vh - 200px); }
dialog .dfoot { padding: 14px 20px; border-top: 2px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------- Page d'accueil (visiteur) ---------- */

.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; min-height: 70vh; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; min-height: 0; } }
.hero h1 { font-size: clamp(3.4rem, 9vw, 7.5rem); line-height: 0.82; letter-spacing: -0.035em; font-weight: 900; margin-bottom: 24px; }
.hero .lede { font-size: var(--step-1); max-width: 46ch; }
.fan { position: relative; height: clamp(320px, 46vw, 480px); }
.fan .card { position: absolute; width: clamp(170px, 22vw, 240px); top: 8%; left: 50%; box-shadow: 8px 8px 0 #000; }
.fan .card:nth-child(1) { transform: translateX(-112%) rotate(-11deg) translateY(30px); }
.fan .card:nth-child(2) { transform: translateX(-50%) rotate(0deg); z-index: 2; }
.fan .card:nth-child(3) { transform: translateX(12%) rotate(10deg) translateY(30px); }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; border-top: 3px solid var(--ink); margin-top: 48px; }
.rules > div { padding: 20px 20px 20px 0; }
.rules h3 { font-size: var(--step-2); margin-bottom: 8px; }
.auth { max-width: 460px; margin: 20px auto; }
.auth h1 { margin-bottom: 20px; }

/* ---------- Divers ---------- */

.toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: grid; justify-items: end; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: #000; color: #fff; padding: 12px 16px; border-left: 6px solid var(--signal); max-width: 420px; pointer-events: auto; animation: toastin 0.2s ease; }
.toast.error { border-left-color: var(--vermillon); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }
.credits { font-size: var(--step--1); color: var(--ink-mute); padding: 18px var(--gutter); border-top: 2px solid var(--line); }
.credits p { max-width: none; margin: 0; }
.badge-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ach { background: var(--sheet); border: 2px solid var(--line); padding: 14px; display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; }
.ach .medal { width: 48px; height: 48px; border-radius: 50%; background: repeating-radial-gradient(circle, #1a1a1a 0 2px, #2a2a2a 2px 4px); display: grid; place-items: center; }
.ach .medal::after { content: ''; width: 40%; height: 40%; border-radius: 50%; background: var(--line); }
.ach.got .medal::after { background: var(--signal); }
.ach:not(.got) { opacity: 0.6; }
.ach h3 { font-size: var(--step-1); }
.notif { padding: 10px 0; border-bottom: 2px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.notif.unread { font-weight: 700; }
.loading { padding: 40px; text-align: center; color: var(--ink-mute); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
