/* La ficha grande de una carta, como una física de 63x88. La pinta src/ficha.mjs.

   Cada franja mide un porcentaje fijo del alto, así que el dibujo tiene el mismo tamaño y el mismo
   sitio en todas y la caja de texto también. Los tamaños van en cqw (centésimas del ancho de la
   ficha): la misma carta se ve igual a 300 px que a 400, solo que más grande. */

.ficha-tcg {
  container-type: inline-size;
  width: min(100%, 420px, calc((100dvh - 150px) * 63 / 88));
  margin: 0 auto;
}
/* A pantalla completa, sin sitio para botones: es lo que usan las capturas. */
.ficha-tcg.pantalla { width: min(100%, calc((100dvh - 20px) * 63 / 88)); }

.ficha-tcg .card.size-lg {
  width: 100%; height: auto; aspect-ratio: 63 / 88;
  cursor: default; transform: none; border-radius: 4.5cqw;
}
.ficha-tcg .card.size-lg:hover { transform: none; }
/* cabecera · dibujo · franja de tipo · caja de texto · pie */
.ficha-tcg .c-inner { grid-template-rows: 10.5% 39% 5.5% 1fr 11%; }
.ficha-tcg .c-head { padding: 0 4%; gap: 3%; min-height: 0; }
.ficha-tcg .cost { width: 10.5cqw; height: 10.5cqw; min-width: 0; font-size: 5.8cqw; }
.ficha-tcg .c-name { font-size: 5.6cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ficha-tcg .c-art { aspect-ratio: auto; min-height: 0; }
.ficha-tcg .c-band { padding: 0 4%; font-size: 3.3cqw; display: flex; align-items: center; }
.ficha-tcg .c-body {
  margin: 2.6% 3.2% 0; padding: 3% 3.6%; min-height: 0; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--aff) 38%, transparent); border-radius: 2cqw;
  background: rgba(255, 255, 255, .035);
  display: flex; flex-direction: column; justify-content: flex-start; gap: .45em;
  font-size: 4.1cqw;
}
/* Nada se encoge ni se recorta dentro de la caja: en ui.css la ambientación se corta a tres líneas
   y, como hijo de un flex con overflow, se encogía y se cortaba sola, así que la caja nunca parecía
   desbordarse y el ajuste de letra no se enteraba. */
.ficha-tcg .c-body > * { flex-shrink: 0; }
.ficha-tcg .c-hab { margin: 0; font-size: 1em; line-height: 1.32; text-align: left; }
.ficha-tcg .c-hab b { color: var(--aff); }
.ficha-tcg .c-hab.nada { color: var(--muted); font-style: italic; text-align: center; }
.ficha-tcg .c-flavor {
  font-size: .92em; line-height: 1.35; margin: .2em 0 0;
  display: block; overflow: visible; -webkit-line-clamp: unset;
}
/* La historia larga, como el texto de ambientación de Magic: cursiva, separada de las reglas por
   una raya fina, alineada a la izquierda para que un párrafo se lea bien. */
.ficha-tcg .c-flavor.larga {
  text-align: left; font-size: .86em; line-height: 1.38; margin-top: .35em; padding-top: .55em;
  border-top: 1px solid color-mix(in srgb, var(--aff) 30%, transparent);
}
.ficha-tcg .c-foot { padding: 0 4%; gap: 2.5%; min-height: 0; overflow: hidden; }
.ficha-tcg .stat { width: 10cqw; height: 10cqw; min-width: 0; font-size: 5.5cqw; flex: none; }
.ficha-tcg .c-ped { display: none; }
/* Lleva también la clase `pedigri` de ui.css, que la prueba de navegador busca, y de ella hereda
   un borde, relleno y rejilla que en el pie la empujaban hacia abajo y la cortaban: se anulan. */
.ficha-tcg .c-ficha {
  margin-left: auto; text-align: right; font-size: 2.7cqw; line-height: 1.3; color: #8e84a6;
  border: 0; padding: 0; gap: 0; max-width: none; display: block;
}
.ficha-tcg .c-ficha b { color: #cfc6e2; font-weight: 600; }
.ficha-tcg .c-ficha .hist { color: #b59f6c; }

/* En el juego, la hoja de detalle ya no pinta su fondo: la carta es la ficha. */
.overlay .sheet.detail.con-ficha { background: none; border: 0; padding: 0; max-width: 440px; width: 100%; gap: 12px; }
/* Con ancho explícito: la hoja centra a sus hijos (justify-items: center) y los encoge a su
   contenido, y una ficha con container-type no aporta ancho propio. Sin esto la carta medía 2 px. */
.overlay .sheet.detail.con-ficha .ficha-sitio { width: 100%; }

/* ── Descubrir: la hoja para quedarse una de tres (src/match.mjs, mostrarEleccion) ── */
.overlay .sheet.eleccion { max-width: 560px; }
.eleccion-cartas { justify-content: center; gap: 12px; flex-wrap: wrap; }
.eleccion-carta {
  --card-w: 150px; width: 150px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 12px; transition: transform .15s, box-shadow .15s;
}
.eleccion-carta:hover, .eleccion-carta:focus-visible { transform: translateY(-6px); box-shadow: 0 0 0 2px var(--gold); outline: none; }
@media (max-width: 520px) { .eleccion-carta { --card-w: 104px; width: 104px; } }

/* Trampas boca abajo, junto al invocador. */
.pill.trampas { border-color: #8a5cd6; color: #d6c2ff; }

/* El dorso dibujado (art/manual/marca/dorso), cuando lo hay: llena la carta entera. */
.card.card-back.con-dorso { padding: 0; overflow: hidden; }
.card.card-back.con-dorso .cb-dorso { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Arte de interfaz encargado a la ComfyUI (se enciende solo si existe cada imagen) ── */
/* Cabecera de pantalla: la imagen arriba, fundida con el fondo para que el título se lea. */
.screen.con-cabecera {
  background-image: linear-gradient(to bottom, rgba(10, 8, 14, .72), rgba(10, 8, 14, .86) 150px, var(--bg, #0c0911) 280px), var(--cabecera);
  background-size: 100% 300px, 100% 300px; background-repeat: no-repeat; background-position: top center;
}
/* Legibilidad antes que el dibujo: el texto que cae sobre la cabecera lleva sombra. */
.screen.con-cabecera > * h1, .screen.con-cabecera > * > p, .screen.con-cabecera h1 { text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .6); }
/* La ficha del mundo, sobre su ilustración. */
.mundo-detalle.con-arte {
  background-image: linear-gradient(to bottom, rgba(10, 8, 14, .55), rgba(10, 8, 14, .92) 70%), var(--mundo);
  background-size: cover; background-position: center; border-radius: 14px; padding: 16px;
}
.gremio-emblema { width: 72px; height: 72px; flex: none; border-radius: 50%; overflow: hidden; }
.gremio-emblema .arte-emblema { width: 100%; height: 100%; object-fit: cover; display: block; }
.icono-arte { width: 1.1em; height: 1.1em; border-radius: 50%; object-fit: cover; vertical-align: -.15em; margin-right: .3em; }

/* ── «¿Cómo se juega?» (src/bienvenida.mjs) ── */
.overlay .sheet.bienvenida { max-width: 420px; text-align: center; display: grid; gap: 12px; }
.bienvenida h2 { margin: 0; font-size: 24px; }
.bienvenida p { margin: 0; line-height: 1.5; text-align: left; }
.bienvenida .rojo { color: #ff8a7a; } .bienvenida .verde { color: #7be09a; }
.bv-puntos { display: flex; justify-content: center; gap: 6px; }
.bv-puntos i { width: 8px; height: 8px; border-radius: 50%; background: var(--line, #444); }
.bv-puntos i.on { background: var(--accent, #f6d06b); }
.bv-carta { display: flex; justify-content: center; pointer-events: none; }
.bv-carta .card { --card-w: 150px; }
.bv-botones { display: flex; justify-content: space-between; gap: 10px; }
.bv-botones .btn { flex: 1; }
.bv-mirar { background: none; border: 0; color: var(--muted, #a99fbb); text-decoration: underline; cursor: pointer; font-size: 13px; }
.ini-como { margin-top: 10px; }
