/* Vue d'une carte en grand. --rc = couleur de la rareté. */
#overlay.viewer { display: block; padding: 0; overflow: hidden auto; background: #07070bd9; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
body:has(#overlay.viewer:not([hidden])) { overflow: hidden; }
.viewer-scene { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; user-select: none; }
.viewer-close { position: fixed; top: 18px; right: 20px; z-index: 2; width: 54px; height: 54px; border-radius: 50%; background: #ffffff10; border: 1px solid #ffffff26; color: #fff; font-size: 20px; }
.viewer-close:hover { background: #ffffff22; }

.viewer-card { --w: min(420px, 82vw, 46vh); position: relative; width: var(--w); aspect-ratio: 5 / 7; perspective: 1100px; }

/* Halo derrière la carte, à la couleur de la rareté (un peu plus fort pour les Mythiques) */
.halo { position: absolute; inset: -9% -13%; border-radius: 50%; background: var(--rc); filter: blur(52px); opacity: .5; animation: breathe 4s ease-in-out infinite; pointer-events: none; }
.viewer-card.r-C .halo { opacity: .22; }
.viewer-card.r-M .halo { opacity: .65; }
@keyframes breathe { 50% { transform: scale(1.07); } }

.tilt { --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%; position: relative; width: 100%; height: 100%; cursor: pointer; touch-action: none; transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .5s ease; outline: none; }
.tilt.moving { transition: transform .08s linear; }
.tilt:focus-visible { outline: 2px solid #fff; outline-offset: 8px; border-radius: 20px; }
.flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .2, 1.15); }
.flip.turned { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; padding: 4px; border-radius: 20px; background: var(--rc); -webkit-backface-visibility: hidden; backface-visibility: hidden; box-shadow: 0 24px 50px #000a; }.rear { transform: rotateY(180deg); }
/* Le dos d'information. Les tailles suivent la largeur de la carte (cqw). */
.rear { container-type: inline-size; }
.dos-infos { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 6cqw; border-radius: 16px; overflow: hidden; text-align: left; color: #f1f0f7;
  background: radial-gradient(120% 55% at 50% 0%, color-mix(in srgb, var(--rc) 28%, transparent), transparent 70%), radial-gradient(110% 45% at 50% 108%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 70%), #14131b; }
.dos-haut { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dos-rarete { color: var(--rc); font-weight: 800; font-size: 3.9cqw; }
.dos-numero { color: #aaa7ba; font: 700 3.7cqw ui-monospace, Consolas, monospace; }
.dos-infos h3 { margin: 4cqw 0 0; font: 900 7.6cqw/1.15 var(--titre); font-style: normal; overflow-wrap: anywhere; }
.dos-jeu { margin: 2.6cqw 0 0; color: #a9a6b9; font-size: 3.8cqw; }
.dos-detail { margin: 1cqw 0 0; color: #7f7c90; font-size: 3.4cqw; }
.dos-cases { display: grid; grid-template-columns: 1fr 1fr; gap: 2.8cqw; margin-top: 5cqw; }
.dos-case { display: flex; flex-direction: column; gap: 1.2cqw; padding: 3.2cqw; border-radius: 3cqw; background: #ffffff0d; border: 1px solid #ffffff12; }
.dos-case small { color: #8f8c9f; font-size: 3.1cqw; text-transform: uppercase; letter-spacing: .03em; }
.dos-case b { font-size: 4.3cqw; }
.dos-bas { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: auto; }
.dos-album { padding: 0; border: 0; background: none; color: #ff6a55; font-weight: 800; font-size: 3.9cqw; cursor: pointer; }
.dos-album:hover { text-decoration: underline; }
/* tant que la carte n'est pas retournée, le lien du dos ne doit rien intercepter */
.flip:not(.turned) .dos-album { pointer-events: none; }
.dos-sceau { display: grid; place-items: center; width: 11.5cqw; height: 11.5cqw; border-radius: 2.8cqw; background: var(--seal, #ff4d38); color: #fff; font-weight: 900; font-size: 6cqw; transform: rotate(-8deg); }

/* La carte elle-même, agrandie : les textes suivent sa taille */
.face .card { width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 16px; box-shadow: none; cursor: pointer; transform: none; transition: none; }
.face .card:hover { transform: none; }
.face .card .c-name { font-size: 6.4cqw; padding-right: calc(10cqw + 12cqw); }
.face .card .c-rar { width: 10cqw; height: 10cqw; font-size: 5cqw; }
.face .card .c-foot { font-size: 3.8cqw; }
.face .card .c-foot .origin { font-size: 3.8cqw; }
.face .card .c-count { display: none; }

/* Reflet qui suit la souris */
.glare { position: absolute; inset: 4px; border-radius: 16px; pointer-events: none; opacity: 0; transform: translateZ(1px); background: radial-gradient(circle at var(--mx) var(--my), #ffffff59, transparent 48%); mix-blend-mode: soft-light; transition: opacity .3s; }
.tilt.moving .glare { opacity: 1; }

.viewer-hint { position: relative; margin: 8px 0 0; color: #9c99ad; font-size: 14px; text-align: center; }
.viewer-actions { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.viewer-info { color: #d6d4e2; font-weight: 700; }
.viewer-sell { display: flex; gap: 8px; }
.viewer-sell input { width: 100px; }
