/* ==========================================================================
   Paneles: detalle de carta, progreso, añadir colección, faltantes, ajustes...
   ========================================================================== */

/* ---------- Detalle de carta ---------- */
.card-detail { display: grid; grid-template-columns: minmax(220px, 330px) minmax(0, 1fr); gap: 30px; align-items: start; }
.holo-wrap { perspective: 1100px; position: sticky; top: 0; }
.holo-card {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  position: relative;
  aspect-ratio: 63 / 88;
  border-radius: 4.6% / 3.3%;
  overflow: hidden;
  background: var(--surface-2);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .6s var(--ease), box-shadow .3s;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
  will-change: transform;
}
.holo-card.active { transition: transform .06s linear; box-shadow: 0 34px 70px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .1); }
.holo-card img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.holo-card::before, .holo-card::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .35s; }
.holo-card::before { background: radial-gradient(farthest-corner circle at var(--mx) var(--my), rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, .1) 30%, transparent 62%); mix-blend-mode: overlay; }
.holo-card.holo::after {
  background: repeating-linear-gradient(115deg, rgba(255, 0, 132, .5) 0%, rgba(252, 164, 0, .45) 8%, rgba(255, 255, 0, .4) 16%, rgba(0, 255, 138, .4) 24%, rgba(0, 207, 255, .45) 32%, rgba(204, 76, 250, .5) 40%, rgba(255, 0, 132, .5) 48%);
  background-size: 300% 300%;
  background-position: var(--mx) var(--my);
  mix-blend-mode: color-dodge;
  filter: brightness(.65) contrast(1.4) saturate(1.2);
}
.holo-card.active::before { opacity: 1; }
.holo-card.holo.active::after { opacity: .55; }
.holo-hint { margin-top: 10px; text-align: center; color: var(--muted); font-size: var(--fs-xs); }

.detail-info { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.detail-kicker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.detail-name { margin: 2px 0 0; font-family: var(--serif); font-size: 32px; line-height: 1.12; letter-spacing: -.015em; font-weight: 500; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-xs); background: var(--surface-3); font-size: var(--fs-xs); font-weight: 560; color: var(--text-2); }
.tag.version { background: var(--accent-soft); color: var(--accent-2); }
.tag .dot { width: 9px; height: 9px; border-radius: 50%; }
.price-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.price-box { display: grid; gap: 3px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color .15s, background .15s; }
a.price-box:hover { border-color: var(--line-3); background: var(--surface-2); }
.price-box .lbl { display: flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--muted); font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; }
.price-box .lbl .i { width: 13px; height: 13px; margin-left: auto; }
.price-box .val { font-family: var(--serif); font-weight: 500; font-variant-numeric: tabular-nums lining-nums; font-size: 24px; letter-spacing: -.01em; }
.price-box .val.none { font-family: var(--font); color: var(--muted); font-size: var(--fs-md); font-weight: 500; }
.detail-stats { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 16px; margin: 0; font-size: var(--fs-sm); }
.detail-stats dt { color: var(--muted); }
.detail-stats dd { margin: 0; color: var(--text-2); }
.effect { margin: 0; font-size: var(--fs-sm); line-height: 1.55; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 11px 13px; white-space: pre-line; max-height: 150px; overflow: auto; }

.mine { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); }
.mine-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
/* Cambiar · Mover · Quitar: si no caben junto al título, bajan y se reparten en más líneas */
.mine-head > div { flex-wrap: wrap; justify-content: flex-end; }
.mine-head h3 { margin: 0; font-size: var(--fs-2xs); font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; color: var(--muted); }
.own-toggle { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 3px; gap: 3px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line); }
.own-toggle button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 600; }
.own-toggle button:hover { color: var(--text); }
.own-toggle .on.missing { background: var(--bad-soft); color: var(--bad-2); }
.own-toggle .on.owned { background: var(--ok); color: var(--ok-ink); box-shadow: var(--e-1); }
details.adv summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary .i { width: 14px; height: 14px; transition: transform .2s; }
details.adv[open] summary .i { transform: rotate(90deg); }
details.adv .field { margin-top: 10px; }

.versions h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: var(--fs-2xs); font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; color: var(--muted); }
/* Las versiones en filas, nunca en una tira que se desplace de lado: la ficha crece hacia abajo */
.versions-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 12px 10px; padding: 4px 2px 10px; }
.versions-list .version:not(.tag) { width: auto; min-width: 0; }
.version:not(.tag) {
  position: relative;
  flex: none;
  width: 78px;
  display: grid;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
}
.version .vt { position: relative; aspect-ratio: 63 / 88; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s, transform .15s; }
.version .vt img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.version:hover .vt { transform: translateY(-2px); box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.version.current .vt { box-shadow: 0 0 0 1.5px var(--accent); }
.version .vl { font-size: var(--fs-2xs); font-weight: 650; letter-spacing: .03em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version .vp { font-size: var(--fs-2xs); color: var(--muted); }
.version .in { position: absolute; top: 4px; left: 4px; z-index: 2; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: rgba(11, 11, 12, .85); color: #fff; }
.version .in.owned { background: var(--ok); color: var(--ok-ink); }
.version .in .i { width: 10px; height: 10px; stroke-width: 3.4; }

/* ---------- Progreso ---------- */
.stats-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 26px; padding: 4px 0 18px; }
.hero-figure { font-family: var(--serif); font-size: 64px; font-weight: 400; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.hero-figure small { font-size: var(--fs-2xl); color: var(--muted); font-weight: 400; margin-left: 2px; }
.hero-side { display: grid; gap: 10px; }
.hero-side p { margin: 0; color: var(--text-2); font-size: var(--fs-md); }
.hero-side .meter { height: 10px; }
/* Las cifras de Progreso (en un diálogo; las de las páginas, en pages.css) */
.dialog .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 26px; }
.stat-tile { display: grid; gap: 4px; padding: 14px 16px; border-radius: 0; background: transparent; border: 0; box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line); }
.stat-tile .lbl { color: var(--muted); font-size: var(--fs-2xs); font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; }
.stat-tile .val { font-family: var(--serif); font-weight: 500; font-variant-numeric: tabular-nums lining-nums; font-size: 24px; letter-spacing: -.01em; }
.stat-tile .sub { color: var(--muted); font-size: var(--fs-xs); }
.stat-tile .delta.up { color: var(--ok); }
.stat-tile .delta.down { color: var(--bad); }
.stats-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; }
.meter-rows { display: grid; gap: 2px; }
.meter-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 56px 74px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.meter-row:hover { background: var(--surface-2); }
.meter-row .k { font-weight: 600; }
.meter-row .meter { height: 8px; }
.meter-row .meter > i { background: var(--accent); }
.meter-row.complete .meter > i { background: var(--ok); }
.meter-row .n { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter-row .v { text-align: right; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.meter-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) 56px 74px; gap: 12px; padding: 0 8px 6px; color: var(--muted); font-size: var(--fs-2xs); font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; }
.meter-head span:nth-child(3), .meter-head span:nth-child(4) { text-align: right; }
.top-list { display: grid; gap: 6px; margin-bottom: 22px; }
.top-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 8px; border-radius: var(--r-md); cursor: pointer; }
.top-item:hover { background: var(--surface-2); }
.top-item img, .top-item .ph { width: 40px; aspect-ratio: 63 / 88; border-radius: var(--r-xs); object-fit: cover; background: var(--surface-3); display: block; }
.top-item .t1 { font-weight: 650; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-item .t2 { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-item .t3 { font-weight: 650; font-size: var(--fs-sm); text-align: right; }
.empty-note { color: var(--muted); font-size: var(--fs-sm); padding: 8px; }

/* ---------- Añadir colección ---------- */
.coll-preview { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); }
.coll-preview .summary { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-md); color: var(--text-2); }
.coll-preview .summary strong { font-family: var(--serif); font-weight: 500; font-variant-numeric: tabular-nums lining-nums; font-size: 24px; color: var(--text); letter-spacing: -.01em; }
.coll-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; min-height: 84px; }
.coll-strip .ct { position: relative; flex: none; width: 56px; aspect-ratio: 63 / 88; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-3); }
.coll-strip .ct img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; }
.coll-strip .ct .fallback { font-size: var(--fs-2xs); padding: 2px; }
.coll-strip .more { flex: none; align-self: center; color: var(--muted); font-size: var(--fs-xs); padding: 0 8px; }

/* ---------- Faltantes ---------- */
.missing-summary { color: var(--text-2); margin: 0 0 16px; line-height: 1.6; }
.missing-group { margin-bottom: 18px; }
.missing-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-family: var(--serif); font-size: var(--fs-lg); font-weight: 500; color: var(--text); }
.missing-group h3 .count { color: var(--muted); font-weight: 600; }
.missing-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 8px; border-radius: var(--r-md); cursor: pointer; }
.missing-item:hover { background: var(--surface-2); }
.missing-item img, .missing-item .ph { width: 38px; aspect-ratio: 63 / 88; border-radius: var(--r-xs); object-fit: cover; background: var(--surface-3); display: block; }
.missing-item .mi-name { font-weight: 650; font-size: var(--fs-sm); }
.missing-item .mi-sub { color: var(--muted); font-size: var(--fs-xs); }
.missing-item .mi-right { text-align: right; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.missing-item .mi-right b { display: block; color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- Binders ---------- */
.binder-row { display: flex; align-items: center; gap: 10px; }
.binder-row .sw { width: 16px; height: 20px; border-radius: 3px 2px 2px 3px; flex: none; box-shadow: inset -2px 0 0 rgba(0, 0, 0, .3); }
.binder-row .mini { width: 46px; height: 4px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--accent) 15%, transparent); overflow: hidden; flex: none; }
.binder-row .mini i { display: block; height: 100%; background: var(--accent); }

/* ---------- Ajustes ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: var(--r-md); border: 2px solid transparent; padding: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.swatch:hover { border-color: rgba(255, 255, 255, .5); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.color-input { width: 44px; height: 34px; padding: 2px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--bg-2); }
.info-box { padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.55; }

/* ---------- Atajos ---------- */
.shortcuts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; align-items: center; font-size: var(--fs-sm); }
.shortcuts > span:nth-child(odd) { color: var(--text-2); }
.shortcuts > span:nth-child(even) { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------- Exportar ---------- */
.export-preview { margin-top: 6px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); display: grid; place-items: center; min-height: 160px; }
.export-preview canvas { max-width: 100%; max-height: 46vh; display: block; }

@media (max-width: 900px) {
  .card-detail { grid-template-columns: minmax(0, 1fr); }
  .holo-wrap { position: static; max-width: 280px; margin: 0 auto; }
  .kpis, .dialog .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* Con un número impar de cifras, la última ocupa la fila entera */
  .dialog .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats-cols { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .stats-hero { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
