/* La révélation de la note (client/grading-reveal.ts) : un plein écran sombre, cinq temps, puis le résultat posé.

   Tout ce qui bouge est une classe posée sur `.rv` par le JavaScript (`rv--fly`, `rv--scan`, `rv--glitch`,
   `rv--clac`, `rv--face`, `rv--drop`, `rv--posed`, et `data-check` pour le contrôle en cours) : les animations ne touchent que `transform`, `opacity` et `filter`, les
   seules propriétés qu'un téléphone moyen compose sans repasser par la mise en page. `will-change` n'est posé que
   pendant la séquence et retiré avec `rv--posed` : laissé en place, il garde une couche GPU par élément pour rien.

   Le z-index reste sous celui de `.sheet` (50, app.css) : la confirmation de dépense de la vitrine s'ouvre
   par-dessus la révélation, pas dessous. Seul le fondu d'entrée passe au-dessus (55, posé par client/grading-reveal.ts) :
   les feuilles qui ont lancé la gradation se ferment sous le voile une fois l'écran couvert.

   `prefers-reduced-motion` : aucune séquence (`rv--still`), le résultat en fondu, et toutes les règles animées
   d'ici sont neutralisées à la fin du fichier — la classe seule ne suffit pas si le JavaScript a déjà commencé. */

.rv {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  /* La rangée de la scène peut descendre sous sa taille naturelle : c'est elle qui cède, pas le résultat. */
  grid-template-rows: minmax(0, 1fr) auto;
  /* L'ombre portée du boîtier (`.slab::after`) descend sous lui : sans cet écart, le nom de la carte passe dessous. */
  row-gap: 16px;
  justify-items: center;
  overflow: hidden;
  color: #f4f7fb;
  /* Le fond est sombre quel que soit le thème : la note doit tomber dans le noir, pas dans un salon éclairé. */
  background: radial-gradient(120% 90% at 50% 18%, #1b2233 0%, #0a0d14 55%, #05070b 100%);
  animation: rv-in .28s ease both;
}

/* La vignette : elle resserre le regard au centre sans assombrir la carte elle-même. */
.rv-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(70% 55% at 50% 42%, rgba(255, 255, 255, .07), transparent 70%), radial-gradient(130% 110% at 50% 50%, transparent 45%, rgba(0, 0, 0, .72) 100%);
}

.rv-skip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 3;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .72);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

@media (hover: hover) {
  .rv-skip:hover {
    color: #fff;
    background: rgba(255, 255, 255, .14);
  }
}

.rv-stage {
  --rv-large: min(300px, 66vw);
  position: relative;
  display: grid;
  place-items: center;
  /* La scène se mesure sur la place qui reste au-dessus du résultat, jamais sur sa largeur seule : sous le résultat
     posé, le boîtier rapetisse plutôt que de pousser les trois boutons hors de l'écran. */
  height: min(100%, calc(var(--rv-large) / .62));
  /* La scène tient sa hauteur : le résultat se pose dessous sans que rien ne saute quand le boîtier remplace la carte. */
  align-self: center;
  /* Le même rapport que `.slab` (--slab-ar, grading.css) : plus étroit, le boîtier dépassait de la scène et son nom
     se posait sur son bas. L'ombre portée du boîtier, elle, est dégagée par le `row-gap` de `.rv`. */
  aspect-ratio: .62;
  margin-top: 8px;
}

.rv-card,
.rv-slab {
  grid-area: 1 / 1;
  width: 100%;
}

.rv-card {
  position: relative;
  width: 78%;
  transform-origin: 50% 50%;
}

/* La carte remplit son cadre : plafonnée à 170 px (`.card`, styles.css), elle se collait à gauche de la scène et le
   scan, qui se mesure sur le cadre, débordait à sa droite. */
.rv-card > .card {
  max-width: none;
}

/* Le boîtier n'existe qu'à partir du « clac » : avant, c'est la carte nue qu'on regarde. */
.rv-slab {
  opacity: 0;
}

.rv--clac .rv-slab,
.rv--posed .rv-slab {
  opacity: 1;
}

.rv--clac .rv-card,
.rv--posed .rv-card {
  opacity: 0;
}

/* Le tour du boîtier, de la fermeture jusqu'à la face : une fois et demie, puis il s'arrête net sur l'étiquette.
   Sa durée est celle de `BEATS.face - BEATS.clac` (client/grading-reveal.ts), pour que la note tombe sur une face lisible. */
@keyframes rv-seal {
  from { transform: rotateY(-540deg) scale(.82); }
  70% { transform: rotateY(-18deg) scale(1.05); }
  to { transform: rotateY(0deg) scale(1); }
}

.rv--clac .rv-slab .slab__box {
  will-change: transform;
  animation: rv-seal .7s cubic-bezier(.2, .72, .22, 1) both;
}

/* Après `rv--face` le tour n'est plus là pour figer la rotation : `.slab__box` retrouve son `transform` de base,
   donc la face, et le boîtier suit de nouveau le pointeur. Sans saut, l'animation finissant sur `rotateY(0deg)`.
   Cette règle doit rester après celle du tour : à spécificité égale, c'est l'ordre qui tranche. */
.rv--face .rv-slab .slab__box {
  animation: none;
  will-change: auto;
}

/* 1. Le vol : la carte arrive du bas, de loin, et se pose au centre. */
.rv--fly .rv-card {
  will-change: transform, opacity;
  animation: rv-fly .65s cubic-bezier(.17, .84, .44, 1) both;
}

/* 2. Le scan : un viseur se verrouille sur la carte, un quadrillage s'y imprime, deux passages de laser la
   balaient (descente puis remontée), et les quatre contrôles s'allument chacun sur sa zone : le centre, les coins,
   les bords, la surface. Juste avant le « clac », la carte glitche. */
.rv--scan .rv-card {
  will-change: transform, filter;
  animation: rv-turn 1.3s ease-in-out both;
  filter: saturate(.75) brightness(.9) contrast(1.08);
}

.rv-scan,
.rv-laser,
.rv-reticle {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.rv-scan {
  inset: 0;
  overflow: hidden;
  border-radius: var(--card-radius, 4.6% / 3.4%);
}

/* Le voile du scanner : un bleu froid et des lignes de balayage, comme un écran qui lit la carte. */
.rv-scan::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(40, 160, 255, .16), rgba(40, 160, 255, .16)), repeating-linear-gradient(0deg, rgba(0, 10, 30, .22) 0 2px, transparent 2px 4px);
}

.rv-scan i {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.rv-grid {
  background: repeating-linear-gradient(0deg, rgba(120, 220, 255, .28) 0 1px, transparent 1px 9%), repeating-linear-gradient(90deg, rgba(120, 220, 255, .28) 0 1px, transparent 1px 12.5%);
}

.rv--scan .rv-scan {
  opacity: 1;
  transition: opacity .15s;
}

.rv--scan .rv-grid {
  animation: rv-grid 1.3s ease-out both;
}

/* Le centrage : une croix de mire et ses deux axes. */
.rv-cross {
  background: linear-gradient(90deg, transparent calc(50% - 1px), #9be9ff calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)), linear-gradient(transparent calc(50% - 1px), #9be9ff calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)), radial-gradient(circle at 50% 50%, transparent 9%, rgba(155, 233, 255, .9) 9.5% 10.5%, transparent 11%);
}

/* Les bords : le liseré de la carte s'allume. */
.rv-edge {
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px #9be9ff, inset 0 0 22px rgba(80, 200, 255, .7);
}

.rv[data-check="0"] .rv-cross,
.rv[data-check="2"] .rv-edge {
  animation: rv-blink .3s ease-out both;
}

/* La surface : le quadrillage entier s'éclaire d'un coup. */
.rv[data-check="3"] .rv-grid {
  animation: rv-surface .3s ease-out both;
}

/* Le laser : une nappe de lumière plus large que la carte, avec sa traîne. Deux passages, le second en remontant. */
.rv-laser {
  inset: 0 -9%;
  overflow: hidden;
  /* La nappe s'éteint sur ses deux bords au lieu de s'y couper net. */
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.rv-laser i {
  position: absolute;
  inset: 0;
  transform: translateY(-100%);
  background: linear-gradient(to bottom, transparent 55%, rgba(70, 200, 255, .1) 78%, rgba(120, 225, 255, .5) 97.6%, #f4feff 98.8%, rgba(150, 235, 255, .3) 99.4%, transparent 100%);
}

.rv-laser i.up {
  transform: translateY(100%);
  background: linear-gradient(to top, transparent 55%, rgba(70, 200, 255, .1) 78%, rgba(120, 225, 255, .5) 97.6%, #f4feff 98.8%, rgba(150, 235, 255, .3) 99.4%, transparent 100%);
}

.rv--scan .rv-laser {
  opacity: 1;
  overflow: visible;
}

.rv--scan .rv-laser i {
  will-change: transform, opacity;
  animation: rv-sweep-down .62s cubic-bezier(.45, 0, .55, 1) .05s both;
}

.rv--scan .rv-laser i.up {
  animation: rv-sweep-up .58s cubic-bezier(.45, 0, .55, 1) .7s both;
}

/* Le viseur : quatre équerres qui tombent en place sur les coins, sonnent au contrôle des coins et virent au vert
   quand tout est vérifié. */
.rv-reticle {
  inset: -5% -6%;
}

.rv-reticle i {
  position: absolute;
  width: 15%;
  aspect-ratio: 1;
  border: 2px solid #8fe6ff;
  filter: drop-shadow(0 0 6px rgba(80, 200, 255, .9));
}

.rv-reticle i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.rv-reticle i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.rv-reticle i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.rv-reticle i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

.rv--scan .rv-reticle {
  opacity: 1;
  animation: rv-lock .38s cubic-bezier(.2, 1.5, .4, 1) both;
}

.rv[data-check="1"] .rv-reticle i {
  border-color: #fff;
  animation: rv-ping .3s ease-out both;
}

.rv--glitch .rv-reticle i {
  border-color: #8dffb0;
  filter: drop-shadow(0 0 8px rgba(80, 255, 150, .9));
}

/* Le fond s'anime aussi : un quadrillage qui défile derrière la carte, le temps du scan. */
.rv-sky::after {
  content: "";
  position: absolute;
  inset: -10% 0 0;
  opacity: 0;
  background: repeating-linear-gradient(0deg, rgba(90, 190, 255, .09) 0 1px, transparent 1px 38px), repeating-linear-gradient(90deg, rgba(90, 190, 255, .09) 0 1px, transparent 1px 38px);
  mask-image: radial-gradient(60% 50% at 50% 45%, #000, transparent);
}

.rv--scan .rv-sky::after {
  animation: rv-floor 1.5s linear both;
}

/* Le relevé, en un seul bloc sous la carte : « Analyse » et sa progression, puis les quatre contrôles sur une ligne.
   Deux textes à deux endroits ne se lisent pas pendant un scan de deux secondes. */
.rv-readout {
  position: absolute;
  top: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  opacity: 0;
  transition: opacity .2s;
}

.rv-hud,
.rv-checks {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .2s;
}

.rv-hud {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: #8fd6ff;
  font-size: 11px;
  text-shadow: 0 0 12px rgba(80, 190, 255, .7);
}

/* Le point rouge d'un enregistrement en cours. */
.rv-hud span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #ff4d6d;
  box-shadow: 0 0 8px #ff4d6d;
  animation: rv-rec .5s steps(1) infinite;
}

.rv-count {
  color: #eafbff;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.rv-checks {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: rgba(143, 214, 255, .35);
  font-size: 10.5px;
}

.rv-checks li {
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color .15s, text-shadow .15s;
}

.rv-checks b {
  color: #8dffb0;
  opacity: 0;
  transform: scale(.3);
  transition: opacity .12s, transform .3s cubic-bezier(.2, 1.8, .4, 1);
}

.rv-checks li.on {
  color: #c9f3ff;
  text-shadow: 0 0 10px rgba(80, 190, 255, .7);
}

.rv-checks li.on b {
  opacity: 1;
  transform: none;
}

.rv--scan .rv-readout {
  opacity: 1;
}

.rv--glitch .rv-hud {
  color: #8dffb0;
  text-shadow: 0 0 12px rgba(80, 255, 150, .7);
}

/* Le boîtier est plus haut que la carte : le relevé s'efface au « clac » pour ne pas passer sous lui. */
.rv--clac .rv-readout {
  opacity: 0;
}

/* Le glitch : la carte décroche, ses couches rouge et cyan se séparent, juste avant que le boîtier se ferme. */
.rv--glitch .rv-card {
  animation: rv-glitch .2s steps(2, jump-none) both;
  filter: drop-shadow(-4px 0 rgba(255, 40, 120, .8)) drop-shadow(4px 0 rgba(40, 230, 255, .8)) contrast(1.2);
}

.rv--glitch .rv-scan::before {
  background: linear-gradient(rgba(255, 255, 255, .25), rgba(255, 255, 255, .25)), repeating-linear-gradient(0deg, rgba(0, 10, 30, .4) 0 3px, transparent 3px 7px);
}

/* 3. Le clac : le boîtier se referme, éclair blanc bref et petite secousse. */
.rv--clac .rv-stage {
  animation: rv-shake .26s ease-in-out both;
}

.rv--clac::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #fff 0, #d9f7ff 35%, rgba(110, 215, 255, .75) 100%);
  animation: rv-flash .3s ease-out both;
}

/* 4. La note : la caméra plonge sur l'étiquette du boîtier, la note s'y imprime d'un coup et brille, puis on recule.
   Le point visé (--zx, --zy) est le centre du chiffre, mesuré au moment du drop. */
.rv--drop .rv-slab {
  transform-origin: var(--zx, 80%) var(--zy, 12%);
  will-change: transform;
  animation: rv-zoom 1.9s cubic-bezier(.3, 0, .2, 1) both;
}

/* Un 9 ou un 10 passe au ralenti : la plongée et la note durent plus longtemps (BEATS.slowmo côté JS). */
.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-slab {
  animation-duration: 3s;
  animation-timing-function: cubic-bezier(.2, 0, .1, 1);
}

.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-slab .sl-digit {
  animation-duration: .7s, 3s;
  animation-delay: .45s, .9s;
}

.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-slab .sl-word {
  animation-duration: .7s;
  animation-delay: .45s;
}

.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-parts i {
  animation-duration: 1.3s;
  animation-delay: calc(var(--d) * .4 + .5s);
}

/* Pour un 10, le dézoom se termine avant que « PARFAITE » arrive : le mot ne se pose pas sur un boîtier en mouvement. */
.rv[data-tier="gold"].rv--drop .rv-slab {
  animation-duration: 2.6s;
}

.rv[data-tier="gold"].rv--drop .rv-perfect {
  animation-delay: 2.6s;
}

/* Avant le drop, la note n'est pas encore sur l'étiquette : le boîtier se ferme sur une case vide. */
.rv:not(.rv--drop):not(.rv--posed) .rv-slab :is(.sl-word, .sl-digit) {
  opacity: 0;
}

/* The word and the digit are full-width lines with right-aligned text: scaled from their middle, they would fly in
   from the centre of the label and slide over to the right. They grow from where their text sits, together, without
   bouncing past their size. */
.rv--drop .rv-slab :is(.sl-word, .sl-digit) {
  transform-origin: 100% 50%;
}

.rv--drop .rv-slab .sl-digit {
  animation: rv-stamp .32s cubic-bezier(.2, .8, .2, 1) .22s both, rv-glow 2.2s ease-out .4s both;
}

.rv--drop .rv-slab .sl-word {
  animation: rv-stamp .32s cubic-bezier(.2, .8, .2, 1) .22s both;
}

/* Le reflet qui traverse l'étiquette une fois la note posée. */
.rv--drop .rv-slab .sl-label--front {
  overflow: hidden;
}

.rv--drop .rv-slab .sl-label--front::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .85) 48%, transparent 60%);
  mix-blend-mode: screen;
  animation: rv-glint .6s ease-out .45s both;
}

/* Posed, the grade is printed and stays still: client/grading-reveal.ts re-lays the slab out each time the stage resizes,
   which would replay the stamp, the glow and the glint on the result. */
.rv.rv--posed .rv-slab .slab :is(.sl-digit, .sl-word) {
  animation: none;
}

.rv--posed .rv-slab .sl-label--front::after {
  content: none;
}

/* L'intensité suit la note : les couleurs du chiffre et des particules changent, pas le nombre d'animations. */
.rv { --rv-glow: rgba(120, 200, 255, .9); }
.rv[data-tier="spark"] { --rv-glow: rgba(255, 200, 80, .9); }
.rv[data-tier="silver"] { --rv-glow: rgba(190, 225, 255, 1); }
.rv[data-tier="gold"] { --rv-glow: rgba(255, 190, 60, 1); }

.rv-parts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Chaque particule part du centre dans sa direction (--a), à sa distance (--r), avec son retard (--d). */
.rv-parts i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  opacity: 0;
  background: linear-gradient(#fff, #ffd34d);
  box-shadow: 0 0 8px rgba(255, 200, 70, .95);
  transform: translate(-50%, -50%);
}

.rv[data-tier="silver"] .rv-parts i { background: linear-gradient(#fff, #cfe4ff); box-shadow: 0 0 8px rgba(200, 230, 255, .95); }
.rv[data-tier="spark"] .rv-parts i { background: #ffe08a; width: 4px; height: 10px; }

.rv--drop .rv-parts i {
  will-change: transform, opacity;
  animation: rv-part .9s ease-out both;
  animation-delay: calc(var(--d) + .4s);
}

/* 9 et 10 sont rares : au moment où la note frappe l'étiquette, éclair et onde de choc. Pas de secousse : pendant le
   zoom, bouger la scène fait sauter toute l'image. */
.rv-boom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.rv-boom::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid var(--rv-glow);
  box-shadow: 0 0 30px var(--rv-glow), inset 0 0 30px var(--rv-glow);
  transform: translate(-50%, -50%) scale(.2);
}

.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-boom {
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), var(--rv-glow) 45%, transparent);
  animation: rv-boom .5s ease-out .5s both;
}

.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-boom::before {
  animation: rv-wave .9s cubic-bezier(.1, .7, .3, 1) .5s both;
}

/* Les rayons, dorés pour 10 et argentés pour 9, et le mot « PARFAITE » qui n'appartient qu'à la note 10. */
.rv-rays {
  position: absolute;
  width: 190%;
  aspect-ratio: 1;
  opacity: 0;
  pointer-events: none;
  background: conic-gradient(from 0deg, rgba(255, 210, 90, .5) 0 4deg, transparent 4deg 18deg);
  mask-image: radial-gradient(closest-side, transparent 28%, #000 46%, transparent 78%);
}

.rv[data-tier="silver"] .rv-rays {
  background: conic-gradient(from 0deg, rgba(200, 230, 255, .45) 0 4deg, transparent 4deg 18deg);
}

.rv:is([data-tier="gold"], [data-tier="silver"]).rv--drop .rv-rays {
  will-change: transform, opacity;
  animation: rv-rays 3.6s linear .5s both;
}

.rv-perfect {
  position: absolute;
  bottom: 2%;
  opacity: 0;
  color: #ffd34d;
  font-size: clamp(26px, 9vw, 44px);
  font-weight: 900;
  letter-spacing: .14em;
  text-shadow: 0 0 30px rgba(255, 190, 60, .9);
}

.rv--drop .rv-perfect {
  animation: rv-perfect .6s ease-out 1.5s both;
}

/* 5. Le résultat posé : plus rien ne bouge, tout se lit. */
.rv--posed .rv-stage {
  animation: none;
}

.rv--posed .rv-parts,
.rv--posed .rv-rays,
.rv--posed .rv-boom,
.rv--posed .rv-perfect,
.rv--posed .rv-readout,
.rv--posed .rv-scan,
.rv--posed .rv-laser,
.rv--posed .rv-reticle {
  display: none;
}

/* Rien de lourd ne survit à la séquence : plus une seule couche GPU réservée une fois le résultat posé. */
.rv--posed * {
  will-change: auto;
}

.rv-result {
  width: min(430px, 100%);
  padding: 0 16px max(16px, env(safe-area-inset-bottom));
  text-align: center;
  animation: rv-rise .3s ease both;
}

.rv-title {
  margin: 0 0 2px;
  font-weight: 700;
}

.rv-note {
  margin: 0 0 10px;
  font-size: 18px;
}

.rv-note b {
  font-size: 22px;
}

.rv-facts {
  display: grid;
  gap: 2px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  list-style: none;
  font-size: 14px;
}

.rv-facts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rv-facts span {
  color: rgba(255, 255, 255, .6);
}

/* Le gain de la note, sur la ligne de la valeur : l'ancien prix barré en gris, puis le nouveau dans une pastille verte
   (vert = encaisser, charte), flèche montante et pièce. */
.rv-cote b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.rv-facts .rv-was {
  position: relative;
  color: rgba(255, 255, 255, .45);
  font-size: 13px;
  text-decoration: none;
}

/* Le trait qui barre : un vrai trait, pour pouvoir le tirer de gauche à droite quand la hausse se joue. */
.rv-facts .rv-was::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -2px;
  left: -2px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform-origin: left center;
}

.rv-facts .rv-was .amt,
.rv-facts .rv-was .amt-n {
  background: none;
  color: inherit;
  -webkit-text-fill-color: currentColor;
  filter: none;
  font-weight: 700;
}

.rv-facts .rv-was .coin-mark {
  opacity: .5;
}

.rv-facts .rv-gain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 7px;
  /* La pastille déborde d'un pixel en haut et en bas sans pousser la ligne : la valeur garde la hauteur des autres
     lignes, et rien ne bouge quand elle arrive. */
  margin-block: -1px;
  border-radius: 999px;
  background: rgba(110, 231, 183, .16);
  color: #6ee7b7;
  font-size: 14px;
  font-weight: 900;
  line-height: 20px;
}

.rv-num {
  display: inline-flex;
  justify-content: flex-end;
}

.rv-facts .rv-gain svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
}

/* `.rv-facts span` grise les intitulés : le prix, fait de spans, reprend son vert. */
.rv-facts .rv-gain .amt,
.rv-facts .rv-gain .amt-n {
  background: none;
  color: #6ee7b7;
  -webkit-text-fill-color: #6ee7b7;
  filter: none;
}

/* Ligne étroite et gros prix (une Gem Mint à 140 000 sur un écran de 320 px) : l'intitulé reste sur une ligne, l'ancien
   prix laisse sa pièce au nouveau et les écarts se resserrent. Jugé sur la ligne elle-même (charte, § rangées), pas sur
   la fenêtre : la ligne mesure 330 px sur un téléphone de 390 px, où tout tient avec les deux pièces. */
.rv-facts .rv-cote {
  container-type: inline-size;
}

/* Dernier recours, pour un prix à sept chiffres : l'intitulé s'abrège plutôt que la ligne déborde de sa boîte. */
.rv-cote > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@container (max-width: 310px) {
  .rv-cote b { gap: 5px; }
  .rv-facts .rv-was .coin-mark { display: none; }
  .rv-facts .rv-gain { padding: 1px 7px 1px 6px; }
}

/* La hausse jouée (riseUp dans client/grading-reveal.ts) : l'ancien prix pâlit et se barre, la pastille rebondit pendant
   que son prix compte, puis la flèche saute. */
@media (prefers-reduced-motion: no-preference) {
  .rv-up .rv-was {
    animation: rv-was-dim .3s ease-out .1s both;
  }

  .rv-up .rv-was::after {
    animation: rv-strike .25s ease-out .15s both;
  }

  .rv-up .rv-gain {
    animation: rv-gain-pop .5s cubic-bezier(.3, 1.6, .5, 1) .35s both;
  }

  .rv-up .rv-gain svg {
    animation: rv-arrow-hop .45s ease-out 1.15s both;
  }
}

@keyframes rv-was-dim {
  from { color: #fff; }
}

@keyframes rv-strike {
  from { transform: scaleX(0); }
}

@keyframes rv-gain-pop {
  from { opacity: 0; transform: scale(.4); }
}

@keyframes rv-arrow-hop {
  40% { transform: translateY(-4px); }
}

.rv-acts {
  display: grid;
  gap: 8px;
}

.rv .btn.ghost {
  color: #f4f7fb;
  border-color: rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06);
}

.rv-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.rv-again {
  margin-top: 10px;
  color: rgba(255, 255, 255, .62);
}

/* Les deux tailles de référence : à 390x844 et à 1280x800, le résultat et ses trois boutons tiennent sans défilement. */
@media (max-height: 820px) {
  .rv-stage { --rv-large: min(210px, 46vw); }
  .rv-facts { margin-bottom: 8px; padding: 7px 12px; }
  .rv-note { margin-bottom: 7px; }
}

@media (min-width: 720px) {
  .rv { grid-template-columns: 1fr; }
  .rv-stage { --rv-large: min(250px, 30vw); }
}

/* Un écran large mais bas (1280x800) : c'est la hauteur qui commande, sinon la règle ci-dessus rend au boîtier les
   50 px qui font sortir les trois boutons de l'écran. */
@media (min-width: 720px) and (max-height: 820px) {
  .rv-stage { --rv-large: min(210px, 30vw); }
}

@keyframes rv-in {
  from { opacity: 0; }
}

@keyframes rv-rise {
  from { opacity: 0; transform: translateY(14px); }
}

@keyframes rv-fly {
  from { opacity: 0; transform: translate3d(0, 46vh, 0) scale(.42) rotate(-9deg); }
  to { opacity: 1; transform: none; }
}

@keyframes rv-turn {
  from { transform: perspective(900px) rotateY(0deg); }
  40% { transform: perspective(900px) rotateY(-12deg) rotateX(4deg); }
  to { transform: perspective(900px) rotateY(14deg) rotateX(-2deg); }
}

@keyframes rv-grid {
  from { opacity: 0; }
  30% { opacity: .9; }
  to { opacity: .45; }
}

@keyframes rv-surface {
  from { opacity: 1; filter: brightness(2.2); }
  to { opacity: .5; filter: none; }
}

@keyframes rv-blink {
  from { opacity: 0; }
  20% { opacity: 1; }
  45% { opacity: .4; }
  65% { opacity: 1; }
  to { opacity: 0; }
}

@keyframes rv-sweep-down {
  from { opacity: 0; transform: translateY(-100%); }
  10% { opacity: 1; }
  88% { opacity: 1; }
  to { opacity: 0; transform: translateY(0); }
}

@keyframes rv-sweep-up {
  from { opacity: 0; transform: translateY(100%); }
  10% { opacity: 1; }
  88% { opacity: 1; }
  to { opacity: 0; transform: translateY(0); }
}

@keyframes rv-lock {
  from { opacity: 0; transform: scale(1.4) rotate(8deg); }
  to { opacity: 1; transform: none; }
}

@keyframes rv-ping {
  from { transform: scale(1); }
  40% { transform: scale(1.35); }
  to { transform: scale(1); }
}

@keyframes rv-floor {
  from { opacity: 0; transform: translateY(0); }
  20% { opacity: 1; }
  80% { opacity: 1; }
  to { opacity: 0; transform: translateY(38px); }
}

@keyframes rv-rec {
  50% { opacity: .15; }
}

@keyframes rv-glitch {
  0% { transform: translate3d(-5px, 0, 0) skewX(-6deg); }
  33% { transform: translate3d(6px, -2px, 0) skewX(4deg) scaleY(.98); }
  66% { transform: translate3d(-3px, 2px, 0) scaleX(1.03); }
  100% { transform: translate3d(2px, 0, 0); }
}

@keyframes rv-shake {
  20% { transform: translate3d(-7px, 3px, 0); }
  45% { transform: translate3d(6px, -3px, 0); }
  70% { transform: translate3d(-3px, 1px, 0); }
  to { transform: none; }
}

@keyframes rv-flash {
  from { opacity: .85; }
  to { opacity: 0; }
}

@keyframes rv-zoom {
  /* Each leg starts and stops gently: an easing that leaves at full speed reads as a jump on the first frame. */
  from { transform: none; animation-timing-function: cubic-bezier(.45, 0, .2, 1); }
  16%, 70% { transform: translate(var(--zdx, 0), var(--zdy, 0)) scale(2.8); animation-timing-function: cubic-bezier(.45, 0, .25, 1); }
  to { transform: none; }
}

@keyframes rv-stamp {
  from { opacity: 0; transform: scale(2.2); }
  to { opacity: 1; transform: none; }
}

@keyframes rv-glow {
  /* In em: the digit is printed ten times larger and scaled down (.sl-print, grading.css). */
  from { text-shadow: 0 0 .2em #fff, 0 0 1em var(--rv-glow), 0 0 2.2em var(--rv-glow); }
  to { text-shadow: none; }
}

@keyframes rv-glint {
  from { opacity: 1; transform: translateX(-100%); }
  to { opacity: 1; transform: translateX(100%); }
}

/* Une particule part d'un anneau autour de la note, jamais du centre : le zoom y amène le chiffre, et un éclat qui
   l'attendrait là ferait une tache dessus. Elle file en trait dans sa direction. */
@keyframes rv-part {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-90px) scaleY(.4); }
  8% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-100px) scaleY(1.4); }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-100px - var(--r) * 2)) scaleY(.6); }
}

@keyframes rv-boom {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes rv-wave {
  from { opacity: 1; transform: translate(-50%, -50%) scale(.2); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(3.2); }
}

@keyframes rv-rays {
  from { opacity: 0; transform: rotate(0deg) scale(.7); }
  12% { opacity: .9; }
  to { opacity: 0; transform: rotate(150deg) scale(1.1); }
}

@keyframes rv-perfect {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rv,
  .rv *,
  .rv::after,
  .rv *::before,
  .rv *::after {
    animation: none !important;
    will-change: auto !important;
  }

  .rv-card { opacity: 0; }
  .rv-slab { opacity: 1; }
}

/* Une copie gradée se montre en vitrine dans son boîtier, comme partout ailleurs (lotFace) : la tuile du boîtier se
   centre dans sa case, chez soi comme sur le profil public. */
.show-slot .slab,
.player-body .pick-tile .slab { margin: 0 auto; }

/* A low grade is met with the invitation to Le vendeur (client/vendeur-tile.ts): the case gives it its room, the wear
   leaves the facts and the three gestures tighten, so the whole still holds in 390x844 and 1280x800 without scrolling. */
.rv-result .vdi-card { margin: 0 0 8px; }
.rv:has(.rv-result .vdi-card) .rv-slab .slab, .rv:has(.rv-result .vdi-card) .rv-stage { max-height: 36dvh; }
.rv-acts.rv-acts-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rv .rv-acts-row .rv-mini { display: grid; justify-items: center; align-content: center; gap: 4px; width: 100%; min-height: 60px; margin: 0; padding: 8px 4px; border-radius: 16px; font-size: 13.5px; line-height: 1.1; }
.rv .rv-acts-row .rv-mini svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rv .rv-acts-row .rv-mini span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
