/* Visor de carta en 3D (01-10). Ver js/visor-carta.js.
   Fondo oscuro neutro en todos los aspectos (como una vitrina): la carta es
   lo único que tiene color. Halo suave del color del elemento detrás y sombra
   en el «suelo» que se estira al girar. */
.visor { position: absolute; inset: 0; z-index: 45; display: flex; flex-direction: column; overflow: hidden;
  padding: max(env(safe-area-inset-top), var(--safe-area-inset-top, 0px)) 0 max(env(safe-area-inset-bottom), var(--safe-area-inset-bottom, 0px));
  background: #08090C; color: #ECEEF2; font-family: var(--f-texto); animation: vc-entra .22s ease; touch-action: none; }
.visor.saliendo { animation: vc-sale .18s ease forwards; }
@keyframes vc-entra { from { opacity: 0; } } @keyframes vc-sale { to { opacity: 0; } }
.vc-fondo { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 42% at 50% 44%, color-mix(in srgb, var(--el) 26%, transparent), transparent 70%),
              radial-gradient(120% 60% at 50% 0%, #1A1D24, transparent 70%),
              linear-gradient(180deg, #0C0D11, #050608); }
.vc-fondo::after { /* suelo: una línea de horizonte muy tenue */
  content: ''; position: absolute; left: 0; right: 0; top: 78%; height: 40%;
  background: radial-gradient(60% 50% at 50% 0%, rgba(255,255,255,.05), transparent 70%); }

.vc-cab { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 16px 4px; }
.vc-tit { flex: 1; min-width: 0; }
.vc-tit small { display: block; font: 600 11px/1.2 var(--f-titulo); letter-spacing: .16em; text-transform: uppercase; color: #8C92A0; }
.vc-tit b { display: block; font: 700 24px/1.1 var(--f-titulo); letter-spacing: .01em; overflow-wrap: anywhere; }
.vc-x { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff;
  background: linear-gradient(180deg, #2A2E37, #1A1D23); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 6px 16px rgba(0,0,0,.5); }
.vc-x svg { width: 20px; height: 20px; }

/* ── La escena 3D ─────────────────────────────────────────────────────── */
.vc-escena { position: relative; z-index: 1; flex: 1; min-height: 0; display: grid; place-items: center; perspective: 1300px; cursor: grab; }
.vc-escena:active { cursor: grabbing; }
.vc-carta { --w: min(86vw, 390px, calc((100dvh - 285px) * 2 / 3)); position: relative; width: var(--w); aspect-ratio: 2 / 3;
  transform-style: preserve-3d; will-change: transform;
  --m: #C9D2E3; --m2: #6F7A90; }
.vc-carta.r-rara { --m: #7FB8FF; --m2: #2552C8; } .vc-carta.r-epica { --m: #CFA8FF; --m2: #6A2FC4; }
.vc-carta.r-legendaria { --m: #FFE08A; --m2: #B07A12; } .vc-carta.r-mitica { --m: #FF9AD0; --m2: #C21E78; }
.vc-cara { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: calc(var(--w) * .022); }
.vc-frente { transform: translateZ(2.6px); }
.vc-dorso { transform: rotateY(180deg) translateZ(2.6px); }
/* la carta de siempre, pero quieta (el giro lo lleva el visor) y heredando el brillo */
.vc-frente .carta { width: 100%; height: 100%; transform: none !important; transition: none; --mx: inherit; --my: inherit; box-shadow: none; }
.vc-frente .carta .tcg-brillo { opacity: .9; }
/* reflejo especular: una franja de luz que cruza la carta según el ángulo */
.vc-reflejo { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 6; mix-blend-mode: screen;
  background: linear-gradient(calc(105deg + var(--ang, 0deg) * .4), transparent calc(var(--mx, 50%) - 22%), rgba(255,255,255,.16) var(--mx, 50%), transparent calc(var(--mx, 50%) + 22%)); }
/* foil holográfico solo desde épica, como las cartas de verdad */
.vc-foil { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 5; opacity: 0; mix-blend-mode: color-dodge;
  background: repeating-linear-gradient(calc(120deg + var(--ang, 0deg)), rgba(255,0,140,.0) 0 4%, rgba(255,0,140,.35) 7%, rgba(255,230,0,.35) 10%, rgba(0,255,170,.35) 13%, rgba(0,160,255,.35) 16%, rgba(255,0,140,0) 20% 26%);
  background-size: 300% 300%; background-position: var(--mx, 50%) var(--my, 50%); filter: saturate(1.3); }
.r-epica .vc-foil { opacity: .22; } .r-legendaria .vc-foil { opacity: .3; } .r-mitica .vc-foil { opacity: .45; }

/* el canto: capas apiladas del metal del marco, así al girarla tiene grosor */
.vc-grosor { position: absolute; inset: 0; transform-style: preserve-3d; pointer-events: none; }
.vc-grosor i { position: absolute; inset: 0; border-radius: calc(var(--w) * .022); transform: translateZ(var(--z));
  background: linear-gradient(90deg, var(--m2), var(--m) 50%, var(--m2)); }
.vc-suelo { position: absolute; left: 50%; bottom: 3%; width: calc(var(--w, 300px) * .8); height: 26px; margin-left: calc(var(--w, 300px) * -.4); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0,0,0,.75), transparent); filter: blur(4px); }
.vc-escena .vc-suelo { --w: min(86vw, 390px, calc((100dvh - 285px) * 2 / 3)); }

/* ── El dorso: la ficha ───────────────────────────────────────────────── */
.vc-dorso { overflow: hidden; container-type: inline-size; background: #0B0D12;
  box-shadow: inset 0 0 0 1.6cqw var(--m2), inset 0 0 0 2.1cqw var(--m), inset 0 0 0 2.7cqw #05060A; }
.vc-dorso::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 40% at 50% 0%, color-mix(in srgb, var(--el) 22%, transparent), transparent 70%),
              repeating-linear-gradient(45deg, rgba(255,255,255,.018) 0 2px, transparent 2px 7px); }
.vc-dorso-in { position: relative; height: 100%; padding: 6cqw 6.5cqw 5.5cqw; display: flex; flex-direction: column; gap: 3cqw; font-size: 4.1cqw; line-height: 1.33; }
.vc-d-cab { display: flex; align-items: center; gap: 3cqw; padding-bottom: 3cqw; border-bottom: .35cqw solid color-mix(in srgb, var(--m) 35%, transparent); }
.vc-d-cab > div { flex: 1; min-width: 0; }
.vc-d-cab b { display: block; font: 700 7.6cqw/1 var(--f-titulo); text-transform: uppercase; letter-spacing: .02em; }
.vc-d-cab small { display: block; margin-top: 1cqw; font: 600 3.3cqw/1.2 var(--f-titulo); letter-spacing: .14em; text-transform: uppercase; color: #9AA3B5; }
.vc-d-el { flex: none; width: 13cqw; height: 13cqw; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #232A3B, #07080C 75%);
  box-shadow: 0 0 0 .5cqw var(--m), 0 0 4cqw color-mix(in srgb, var(--el) 55%, transparent); }
.vc-d-el img { width: 112%; height: 112%; object-fit: contain; }
.vc-d-rz { flex: none; padding: 1cqw 2.6cqw; border-radius: 99px; font: 700 3cqw/1.2 var(--f-titulo); letter-spacing: .18em; text-transform: uppercase; color: var(--m); box-shadow: inset 0 0 0 .35cqw var(--m); }
.vc-d-hist { color: #C9CEDA; font-style: italic; }
.vc-d-stats { display: grid; gap: 2.2cqw; }
.vc-stat { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 1cqw; }
.vc-stat-n { font: 600 3.3cqw/1 var(--f-titulo); letter-spacing: .12em; text-transform: uppercase; color: #9AA3B5; }
.vc-stat b { font: 700 4.6cqw/1 var(--f-titulo); }
.vc-stat i { grid-column: 1 / -1; height: 1.6cqw; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; box-shadow: inset 0 .3cqw .6cqw rgba(0,0,0,.6); }
.vc-stat em { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--m) 55%, #fff), var(--m)); box-shadow: 0 0 2cqw color-mix(in srgb, var(--m) 60%, transparent); }
.vc-d-fila { display: grid; gap: .6cqw; }
.vc-d-fila small { font: 600 3.1cqw/1 var(--f-titulo); letter-spacing: .14em; text-transform: uppercase; color: var(--m); }
.vc-d-fila b { font-weight: 700; color: #fff; } .vc-d-fila span { color: #C3C8D4; }
.vc-d-pie { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1cqw 3cqw; padding-top: 2.6cqw; font-size: 3.3cqw; color: #9AA3B5;
  border-top: .35cqw solid color-mix(in srgb, var(--m) 35%, transparent); }
.vc-d-pie b { color: #fff; }
.vc-d-res { font-size: 3.2cqw; color: #9AA3B5; }

/* ── Rarezas y botones ────────────────────────────────────────────────── */
.vc-rarezas { position: relative; z-index: 2; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 6px 16px 0; }
.vc-rarezas button { padding: 7px 12px; border-radius: 99px; font: 700 11px/1 var(--f-titulo); letter-spacing: .1em; text-transform: uppercase; color: #A7ADBA;
  background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.vc-rarezas button.sel { color: #fff; background: color-mix(in srgb, var(--rc) 28%, #14161B); box-shadow: inset 0 0 0 1px var(--rc), 0 0 16px color-mix(in srgb, var(--rc) 35%, transparent); }
.vc-acciones { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 16px 4px; }
.vc-acciones button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px; border-radius: 16px; color: #E6E8EE; min-width: 0;
  background: linear-gradient(180deg, #22262E, #16191F); box-shadow: inset 0 1px 0 rgba(255,255,255,.09), inset 0 -2px 0 rgba(0,0,0,.35), 0 8px 18px rgba(0,0,0,.45); }
.vc-acciones button:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 3px 8px rgba(0,0,0,.5); }
.vc-acciones button.sel { color: #0B0C10; background: linear-gradient(180deg, color-mix(in srgb, var(--el) 70%, #fff), var(--el)); }
.vc-acciones svg { width: 22px; height: 22px; }
.vc-acciones span { font: 600 11.5px/1.15 var(--f-titulo); letter-spacing: .04em; text-align: center; overflow-wrap: anywhere; }
.vc-pista { position: relative; z-index: 2; text-align: center; font-size: 12px; color: #737A88; padding: 6px 16px 10px; }

/* ── Dibujo a pantalla completa ───────────────────────────────────────── */
.vc-zoom { position: absolute; inset: 0; z-index: 5; background: #000; display: grid; place-items: center; overflow: hidden; touch-action: none; animation: vc-entra .2s ease; }
.vc-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.vc-zoom .vc-x { position: absolute; top: calc(max(env(safe-area-inset-top), var(--safe-area-inset-top, 0px)) + 12px); right: 16px; }
.vc-zoom .vc-pista { position: absolute; left: 0; right: 0; bottom: calc(max(env(safe-area-inset-bottom), var(--safe-area-inset-bottom, 0px)) + 10px); pointer-events: none; }

/* botón «Ver en grande» del detalle de carta */
.detalle .carta { cursor: zoom-in; }
.btn-visor { display: inline-flex; align-items: center; gap: 8px; }
.btn-visor svg { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) { .visor, .vc-zoom { animation: none; } }
.vc-d-interna { font-size: 3cqw; color: #E8C66E; padding: 1.4cqw 2.4cqw; border-radius: 1.6cqw; background: rgba(232,198,110,.08); box-shadow: inset 0 0 0 .3cqw rgba(232,198,110,.3); }
.vc-rarezas button i { font-style: normal; }
.pista-visor { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 16px; text-align: center; }
.pista-visor svg { width: 14px; height: 14px; color: var(--acento); }
/* 02-10: con historia + elemento + raza no cabía el pie (se cortaba el aviso de
   dibujo interno): estadísticas en dos columnas y todo un poco más prieto. */
.vc-dorso-in { gap: 2.4cqw; font-size: 3.75cqw; line-height: 1.3; padding: 5.5cqw 6cqw 5cqw; }
.vc-d-stats { grid-template-columns: 1fr 1fr; column-gap: 5cqw; row-gap: 2cqw; }
.vc-d-cab { padding-bottom: 2.4cqw; }
.vc-d-hist { font-size: 3.6cqw; }
.vc-d-pie { padding-top: 2cqw; font-size: 3.1cqw; }
.vc-d-res, .vc-d-interna { font-size: 2.9cqw; }
/* 02-10 (visto por el agente de vídeos): con RATÓN, Chrome empezaba a arrastrar la
   imagen de la carta (dragstart → pointercancel) y la carta casi no giraba. */
.visor :is(img, video) { -webkit-user-drag: none; user-select: none; }
.vc-escena :is(img, video) { pointer-events: none; }
