/* ==========================================================================
   Estructura: barra superior, zona del binder y catálogo
   ========================================================================== */

.app { position: relative; z-index: 1; height: 100%; display: grid; grid-template-rows: var(--topbar-h) 1fr; grid-template-columns: minmax(0, 1fr); }
.app > * { min-width: 0; }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 20;
}
/* Logo: el símbolo de Kolekto y, si cabe, el nombre con el juego debajo */
.logo { display: flex; align-items: center; gap: 10px; flex: none; }
.logo .k-mark { width: 26px; height: 26px; }
.logo-text { display: grid; gap: 3px; line-height: 1; }
.logo-text .k-word { font-size: 19px; }
.logo-text small { display: block; font-family: var(--font); font-size: 9.5px; font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: .16em; color: var(--accent-2); }
/* El selector de juego, junto a la marca, va en game-switch.css */
/* Filete entre la marca y la navegación */
.topbar > .logo, .topbar > .game-switch { position: relative; }
.topbar > .logo::after, .topbar > .game-switch::after { content: ""; position: absolute; right: -9px; top: 50%; width: 1px; height: 22px; margin-top: -11px; background: var(--line-2); }

/* El binder: «Mis binders» y el nombre del abierto, juntos. El nombre tiene prioridad sobre las cifras:
   con la barra llena, primero se esconden detalles (más abajo) y solo trunca un nombre largo de verdad */
.binder-nav { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; }
/* «Mis binders»: la página de portadas. En ella, marcado con el acento */
.binders-btn { flex: none; width: 38px; height: 38px; padding: 0; color: var(--text-2); }
.binders-btn:hover { color: var(--text); }
.binders-btn[aria-current="page"] { background: var(--surface-2); border-color: var(--line); color: var(--accent-2); }
body[data-section="binders"] .binder-nav { min-width: 0; }
.binder-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 440px;
  height: 40px;
  padding: 0 9px 0 8px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background var(--dur-1), border-color var(--dur-1);
}
.binder-switch:hover, .binder-switch[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); }
.binder-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.binder-switch .sw { width: 16px; height: 22px; border-radius: 3px 2px 2px 3px; box-shadow: inset -2px 0 0 rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(255, 255, 255, .1); flex: none; }
.binder-switch .nm { min-width: 0; font-family: var(--display); font-weight: 500; font-size: 18px; line-height: 1.1; letter-spacing: -.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.binder-switch .i { flex: none; color: var(--muted); width: 15px; height: 15px; }

/* Resumen en la barra superior: una tira de cifras con filetes, como los KPIs. Cada cifra en dos líneas
   (etiqueta y valor) que caben en los 40 px de la barra; el detalle va junto al valor si sobra sitio, y
   el progreso, como un filete del acento al pie de «Conseguidas» */
.top-kpis { display: flex; align-items: stretch; flex: none; height: 40px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.tk {
  position: relative;
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 0 13px;
  line-height: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background var(--dur-1);
}
.tk + .tk { border-left: 1px solid var(--line); }
.tk:hover { background: var(--surface-2); }
.tk:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tk-l { font-size: 10px; line-height: 1; font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tk-v { display: flex; align-items: baseline; gap: 2px; font-family: var(--display); font-size: 17px; line-height: 1; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.tk-v small { font-family: var(--font); font-size: var(--fs-xs); font-weight: 560; color: var(--muted); }
.tk-v em { margin-left: 6px; font-family: var(--font); font-style: normal; font-size: var(--fs-xs); font-weight: 650; color: var(--accent-2); }
.tk-s { margin-left: 7px; font-family: var(--font); font-size: var(--fs-2xs); font-weight: 500; letter-spacing: 0; color: var(--muted); }
.tk-bar { position: absolute; left: 13px; right: 13px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--surface-4); overflow: hidden; }
.tk-bar i { display: block; height: 100%; background: var(--accent); }
/* El detalle, solo con sitio de sobra */
@media (max-width: 2259px) { .tk-s { display: none; } }
.binder-switch .sw.all, .binder-row .sw.all { display: grid; place-items: center; background: var(--surface-3); color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.binder-switch .sw.all .i { width: 13px; height: 13px; color: var(--accent-2); }
.binder-row .sw.all .i { width: 11px; height: 11px; }

.meter { height: 6px; border-radius: var(--r-pill); background: var(--surface-4); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .5s var(--ease); }

/* Herramientas del álbum: botones sin caja (solo iconos hasta 1800 px), agrupados con filetes */
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar-actions .btn:not(.btn-primary), .section-tools .btn:not(.btn-primary):not(.btn-accent) { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.topbar-actions .btn:not(.btn-primary):hover, .section-tools .btn:not(.btn-primary):not(.btn-accent):hover { background: var(--surface-2); color: var(--text); }
.topbar-actions .btn:disabled { opacity: .32; }
.topbar-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex: none; transition: background var(--dur-2); }
.save-dot.saving { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.save-dot.error { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.catalog-toggle { display: none; }

/* ---------- Zona principal ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--catalog-w); min-height: 0; }
.layout > * { min-height: 0; }
.binder-area { position: relative; display: flex; flex-direction: column; overflow: hidden; }


.book-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px 0;
  flex-wrap: wrap;
}
.pager { display: flex; align-items: center; gap: 10px; }
.pager .nav { width: 36px; height: 36px; border-radius: var(--r-md); padding: 0; }
.pager .nav.drag-hover { border-color: var(--accent); background: var(--accent-soft); }
.pager-mid { display: grid; gap: 5px; justify-items: center; min-width: 210px; }
.pager-label { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pager-label strong { color: var(--text); font-weight: 600; }
.scrubber { width: 210px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.scrubber::-webkit-slider-runnable-track { height: 3px; border-radius: var(--r-pill); background: var(--surface-4); }
.scrubber::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -5px; width: 13px; height: 13px; border-radius: 50%; background: var(--ivory); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.scrubber { -webkit-appearance: none; appearance: none; background: transparent; }
.scrubber::-moz-range-track { height: 3px; border-radius: var(--r-pill); background: var(--surface-4); }
.scrubber::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--ivory); border: 2px solid var(--bg); }

.book-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 14px 28px 26px;
  position: relative;
  touch-action: pan-y pinch-zoom;
}
.book-stage.can-grab { cursor: grab; }
.book-stage.grabbing, .page-grabbing, .page-grabbing * { cursor: grabbing !important; }
.page-grabbing .book-stage { user-select: none; }
.book-toolbar { transition: opacity .2s; }
.binder-area.card-drag-on .book-toolbar { opacity: .12; }

/* Bordes del libro: flecha al pasar el ratón y, al arrastrar una carta, barra que se llena antes de pasar */
.edge-hint {
  position: absolute;
  z-index: 25;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: var(--r-xl);
  background: linear-gradient(var(--to), color-mix(in srgb, var(--accent) 13%, transparent), color-mix(in srgb, var(--accent) 0%, transparent) 90%);
  color: color-mix(in srgb, var(--accent-2) 75%, transparent);
  overflow: hidden;
  pointer-events: none;
  animation: hint-in .2s var(--ease);
  transition: color .15s;
}
.edge-hint.next { --to: to left; }
.edge-hint.prev { --to: to right; }
.edge-hint::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(var(--to), color-mix(in srgb, var(--accent) 32%, transparent), color-mix(in srgb, var(--accent) 4%, transparent) 95%);
}
.edge-hint .i { position: relative; width: 26px; height: 26px; stroke-width: 2.2; }
.edge-hint span { position: relative; writing-mode: vertical-rl; font-size: var(--fs-2xs); font-weight: 600; font-stretch: var(--label-stretch); letter-spacing: var(--label-track); text-transform: uppercase; }
.edge-hint.prev span { transform: rotate(180deg); }
.edge-hint.slim span { display: none; }
.edge-hint.armed { color: var(--accent-2); }
.edge-hint.armed::before { animation: hint-fill var(--arm-ms, 450ms) linear forwards; }
.edge-hint.armed .i { animation: hint-nudge .5s ease-in-out infinite alternate; }
.edge-hint.prev.armed .i { animation-name: hint-nudge-back; }
.edge-hint.quiet { background: none; color: rgba(255, 255, 255, .5); animation-duration: .3s; }
.edge-hint.quiet span { display: none; }
@keyframes hint-in { from { opacity: 0; } }
@keyframes hint-fill { to { height: 100%; } }
@keyframes hint-nudge { to { transform: translateX(4px); } }
@keyframes hint-nudge-back { to { transform: translateX(-4px); } }

/* Selector de páginas mientras arrastras una carta */
.page-dock {
  position: absolute;
  z-index: 40;
  top: 8px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 8px 12px 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: var(--overlay);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--e-2);
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
  transition: opacity .18s, transform .22s var(--ease);
}
.page-dock.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.pd-head { font-size: var(--fs-xs); color: var(--muted); }
.pd-head b { color: var(--text); font-weight: 600; }
.pd-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.pd-page {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 5px 5px 4px;
  min-width: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  line-height: 1;
  transition: background .12s, border-color .12s, transform .16s var(--ease), opacity .12s;
}
.pd-page b { font-weight: 650; font-variant-numeric: tabular-nums; }
.pd-map { display: grid; gap: 1.5px; }
.pd-map i { width: 7px; aspect-ratio: 63 / 88; border-radius: 1.5px; box-shadow: inset 0 0 0 1px var(--line-2); }
.pd-map i.fill { background: #5f5e5a; box-shadow: none; }
.pd-map i.own { background: var(--ok); box-shadow: none; }
.pd-map i.src { background: var(--accent); box-shadow: none; }
.pd-page.here { border-color: var(--accent-line); color: var(--accent-2); }
.pd-page.full { opacity: .45; }
.pd-page.over { opacity: 1; transform: translateY(-3px) scale(1.1); border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.pd-page.full.over { border-color: var(--bad); background: var(--bad-soft); }
.overview {
  flex: 1;
  overflow: auto;
  padding: 22px 28px 80px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 30px 34px;
}
.ov-item { display: grid; gap: 8px; }
.ov-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); font-weight: 560; font-variant-numeric: tabular-nums; }
.ov-label .link-btn { font-size: var(--fs-xs); }
.ov-add {
  align-self: center;
  display: grid;
  place-items: center;
  gap: 6px;
  width: 150px;
  height: 140px;
  border: 1px dashed var(--line-3);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--muted);
  font-weight: 560;
  transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
}
.ov-add:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-glow); }

/* Vista de todos los binders */
.overview.all-binders { display: block; }
.ab-section { margin-bottom: 40px; }
.ab-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--line);
}
.ab-sw { width: 16px; height: 22px; flex: none; border-radius: 3px 2px 2px 3px; box-shadow: inset -2px 0 0 rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(255, 255, 255, .1); }
.ab-title { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ab-title h3 { margin: 0; font-family: var(--display); font-size: var(--fs-xl); font-weight: 500; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-title span { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.ab-spreads { display: flex; flex-wrap: wrap; gap: 18px 22px; }
.all-binders .pocket.filled { cursor: pointer; }

.loading-state { text-align: center; color: var(--muted); max-width: 420px; line-height: 1.6; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface-4); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Catálogo ---------- */
.catalog {
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.catalog-head { padding: 16px 16px 12px; display: grid; gap: 12px; border-bottom: 1px solid var(--line); }
.catalog-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.catalog-title h2 { margin: 0; font-family: var(--display); font-size: var(--fs-xl); font-weight: 500; letter-spacing: -.01em; }
.catalog-title h2 small, .catalog-title h2 span { font-family: var(--font); }
.catalog-close { display: none; }

.target-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--text);
  font-size: var(--fs-sm);
}
.target-banner .grow { flex: 1; min-width: 0; }
.target-banner .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); } 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); } }

.search { position: relative; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { height: 40px; padding-left: 38px; padding-right: 34px; font-size: var(--fs-md); border-radius: var(--r-md); }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.presets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.presets::-webkit-scrollbar { display: none; }
.preset {
  flex: none;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 560;
}
.preset:hover { border-color: var(--line-2); color: var(--text); }
.preset.on { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }

.filters-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filters-toggle > button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); padding: 0; }
.filters-toggle > button .i { transition: transform .2s; width: 15px; height: 15px; }
.filters-toggle.collapsed > button .i { transform: rotate(-90deg); }
.filters { display: grid; gap: 11px; }
.filter-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: start; gap: 8px; }
.filter-row > span { color: var(--muted); font-size: var(--fs-xs); font-weight: 560; padding-top: 6px; }
.filter-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.filter-grid .full { grid-column: 1 / -1; }
.filter-grid .select { height: 34px; font-size: var(--fs-sm); }

.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: var(--fs-xs); color: var(--muted); border-bottom: 1px solid var(--line); background: var(--bg-2); font-variant-numeric: tabular-nums; }
.result-bar .check { font-size: var(--fs-xs); }

.results {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 18px 12px;
  align-content: start;
}
/* align-content: arriba, para que el nombre de cada carta de una fila empiece a la misma altura aunque unas tengan más líneas */
.result { position: relative; display: grid; align-content: start; gap: 8px; cursor: pointer; min-width: 0; }
.thumb {
  position: relative;
  aspect-ratio: 63 / 88;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: linear-gradient(110deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.6s linear infinite;
  box-shadow: var(--shadow-card);
  transition: transform .18s var(--ease), box-shadow .18s;
}
.thumb.loaded { animation: none; background: var(--surface-2); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.result:hover .thumb { transform: translateY(-3px); box-shadow: 0 0 0 1.5px var(--accent), 0 16px 28px -8px rgba(0, 0, 0, .7); }
.thumb img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.thumb.loaded img { opacity: 1; }
.thumb.img-failed img { visibility: hidden; }
.thumb .add-hint {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--r-sm);
  background: var(--ivory);
  color: var(--ink-950);
  font-size: var(--fs-xs);
  font-weight: 650;
  box-shadow: var(--e-1);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s, transform .15s;
}
.thumb .add-hint .i { width: 14px; height: 14px; stroke-width: 2.4; }
.result:hover .add-hint { opacity: 1; transform: none; }
.thumb .info-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(11, 11, 12, .78);
  color: #fff;
  opacity: 0;
  transition: opacity .15s, background .15s;
}
.thumb .info-btn .i { width: 15px; height: 15px; }
.result:hover .info-btn, .thumb .info-btn:focus-visible { opacity: 1; }
.thumb .zoom-btn { top: 6px; z-index: 3; }
/* Las dos zonas de la carta: arriba, la información; abajo, añadirla. Al pasar por encima se ven las dos y
   se ilumina a la que irías */
.thumb .tz { position: absolute; left: 0; right: 0; height: 50%; z-index: 1; display: flex; align-items: center; justify-content: center; padding: 8px 6px; color: #fff; opacity: 0; cursor: pointer; transition: opacity .12s, background .12s; }
.thumb .tz-info { top: 0; }
.thumb .tz-add { bottom: 0; border-top: 1px dashed rgba(255, 255, 255, .28); }
.result:hover .tz, .thumb .tz:focus-visible { opacity: 1; }
.thumb .tz:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.thumb .tz-l { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 5px 9px; border-radius: var(--r-sm); background: rgba(11, 11, 12, .72); font-size: var(--fs-xs); font-weight: 620; line-height: 1.15; text-align: center; transition: background .12s, color .12s; }
.thumb .tz-l .i { flex: none; width: 14px; height: 14px; }
.thumb .tz-info:hover { background: rgba(11, 11, 12, .5); }
.thumb .tz-add:hover { background: color-mix(in srgb, var(--accent) 34%, rgba(11, 11, 12, .3)); }
.thumb .tz:hover .tz-l { background: var(--ivory); color: var(--ink-950); }
.in-binder, .thumb .lang-tag { z-index: 2; }
.thumb .info-btn:hover { background: var(--ivory); color: var(--ink-950); }
.in-binder {
  position: absolute;
  left: 6px;
  top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-2xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: rgba(11, 11, 12, .85);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
}
.in-binder .i { width: 11px; height: 11px; stroke-width: 3; }
.in-binder.owned { background: var(--ok); color: var(--ok-ink); border-color: transparent; }
.in-binder:hover { filter: brightness(1.15); }
.result .meta { display: grid; gap: 2px; min-width: 0; font-size: var(--fs-xs); }
.result .name { font-weight: 600; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* El número, la rareza y la versión: si no caben en una línea, la versión baja (antes se cortaba) */
.result .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.result .tags { color: var(--accent-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .price { color: var(--text); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 8px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
  overflow: hidden;
}
.fallback b { color: var(--text-2); font-size: var(--fs-xs); }
.empty-results { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 50px 16px; display: grid; gap: 10px; justify-items: center; }
.empty-results .i { width: 32px; height: 32px; color: var(--faint); }
.sentinel { grid-column: 1 / -1; height: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  :root { --catalog-w: 380px; }
  .logo-text { display: none; }
}
/* ---------- Qué se pliega y cuándo (la barra no puede salirse a ningún ancho: barrido de 390 a 2560) ----------
   Las cuentas, con la pieza del juego más ancha y unos 300 px para el binder (unos 30 letras de nombre):
     desde 2260, todo · hasta 2259, sin el detalle de las cifras · hasta 2119, el chip de datos solo con
     su punto · hasta 1999, las herramientas y la mesa solo con su icono · hasta 1560, sin la marca junto
     al selector · hasta 1499, las secciones solo con su icono · hasta 1279, dos pisos.
   Las tres cifras se ven siempre. Si aun así el nombre no cabe, se trunca: es lo único que encoge. */
@media (min-width: 1280px) and (max-width: 1499px) {
  body[data-section="album"] .sections a { padding: 0 10px; }
  body[data-section="album"] .sections a span { display: none; }
}
@media (max-width: 1560px) { body[data-section="album"] .topbar > .logo:has(+ .game-switch) { display: none; } }
/* La mesa no se queda nunca en solo un icono: hasta 1499, el icono con la etiqueta «3D» */
@media (max-width: 1499px) {
  .topbar > .mesa-btn { padding: 0 9px; }
  .topbar > .mesa-btn .label { display: none; }
  .topbar > .mesa-btn .badge-3d { display: inline-block; }
}
@media (max-width: 1999px) {
  .topbar-actions .label { display: none; }
  .topbar-actions .btn:not(.icon-btn) { padding: 0 10px; }
}
/* ---------- Barra en dos pisos (álbum, de 701 a 1279 px) ----------
   Arriba lo de toda la app (logo, secciones, mesa, datos, idioma, cuenta); abajo, tras un filete, lo del
   binder (el nombre, sus cifras y sus herramientas). Así el nombre y las cifras caben enteros */
.bar-break { display: none; }
@media (min-width: 701px) and (max-width: 1279px) {
  :root { --topbar-h: auto; }
  .topbar { min-height: 60px; }
  body[data-section="album"] .topbar { flex-wrap: wrap; padding: 0 16px; column-gap: 10px; row-gap: 0; }
  body[data-section="album"] .topbar > :is(.logo, .game-switch) { order: 0; margin-block: 9px; }
  body[data-section="album"] .topbar > .sections { order: 0; align-self: stretch; height: auto; }
  body[data-section="album"] .sections a { padding: 0 12px; }
  body[data-section="album"] .sections a span { display: inline; }
  body[data-section="album"] .topbar > :is(.mesa-btn, .live-chip, .lang-btn, .account-btn) { order: 1; margin-block: 9px; }
  body[data-section="album"] .topbar > .mesa-btn { margin-left: auto; }
  body[data-section="album"] .bar-break { display: block; order: 2; flex: 0 0 calc(100% + 32px); height: 1px; margin: 0 -16px; background: var(--line); }
  body[data-section="album"] .topbar > :is(.binder-nav, .top-kpis, .topbar-actions, .catalog-toggle) { order: 3; margin-block: 8px; }
  body[data-section="album"] .topbar > .topbar-actions { margin-left: auto; }
  /* Sin base propia: un nombre muy largo se trunca en vez de bajar a otra fila (crece hasta su ancho) */
  body[data-section="album"] .topbar > .binder-nav { flex: 1 1 0; max-width: max-content; }
}
/* En la tableta, el segundo piso lleva el nombre, las herramientas y el catálogo; las cifras, debajo */
@media (min-width: 701px) and (max-width: 900px) {
  body[data-section="album"] .topbar > .top-kpis { order: 5; margin-top: 0; }
  body[data-section="album"] .topbar > .topbar-actions { width: auto; justify-content: flex-end; }
  body[data-section="album"] .topbar > .catalog-toggle { order: 4; margin-left: 0; }
  body[data-section="album"] .topbar > .binder-nav { max-width: none; }
}
@media (max-width: 900px) {
  :root { --topbar-h: auto; }
  body { overflow-x: hidden; overflow-y: auto; }
  .app { height: auto; min-height: 100%; grid-template-rows: auto 1fr; }
  .topbar { flex-wrap: wrap; padding: 10px 12px; gap: 8px 10px; }
  .topbar > .logo::after, .topbar > .game-switch::after { display: none; }
  .logo .k-mark { width: 24px; height: 24px; }
  .binder-nav { flex: 1 1 auto; }
  .binder-switch { flex: 1 1 auto; max-width: none; padding-left: 4px; }
  /* Las cifras, en una fila entera bajo el nombre; las herramientas, en la siguiente */
  .top-kpis { order: 4; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 46px; }
  .tk { padding: 0 12px; }
  .tk-bar { left: 12px; right: 12px; }
  .ab-head { flex-wrap: wrap; }
  .catalog-toggle { display: inline-flex; order: 3; margin-left: auto; }
  .topbar-actions { order: 5; margin-left: 0; width: 100%; justify-content: space-between; gap: 4px; }
  .topbar-actions .btn:not(.icon-btn) { padding: 0 11px; }
  .topbar-sep { display: none; }
  .layout { display: block; }
  .binder-area { overflow: visible; }
  .book-toolbar { padding: 12px 12px 0; gap: 10px; }
  .pager-mid { min-width: 0; }
  .scrubber { width: 150px; }
  .book-stage { padding: 12px 10px 30px; touch-action: pan-y; }
  .page-dock { position: fixed; top: 8px; }
  .overview { padding: 16px 12px 60px; gap: 22px; }
  .catalog {
    position: fixed;
    inset: 0;
    z-index: 60;
    border-left: 0;
    background: var(--bg);
    transform: translateY(100%);
    transition: transform .3s var(--ease);
  }
  body.catalog-open { overflow: hidden; }
  body.catalog-open .catalog { transform: none; }
  .catalog-close { display: inline-flex; }
  .desk-only { display: none; }
  .results { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .thumb .add-hint, .thumb .info-btn { opacity: 1; transform: none; }
  .thumb .add-hint { display: none; }
}
.fallback em { font-style: normal; color: var(--accent-2); font-size: .92em; }
.loaded:not(.img-failed) > .fallback { visibility: hidden; }

/* El punto de guardado solo aparece mientras guarda o si falla: cuando todo está guardado, el chip
   de "Datos hace…" ya dice que está al día (dos puntos verdes seguidos confundían) */
.save-dot:not(.saving):not(.error) { display: none; }

/* El nombre del binder no puede desaparecer cuando la barra va llena: como poco, unas letras */
@media (min-width: 701px) { .binder-nav { min-width: 190px; } }
/* Barra superior en pantallas medianas: el logo sin texto y el chip de datos solo con su punto */
/* El chip de los datos, solo con su punto salvo en pantallas muy anchas (el texto está en su aria-label
   y en el aviso que abre): el sitio es antes para el nombre del binder y las etiquetas de las herramientas */
@media (max-width: 2119px) {
  .live-chip .lc-t { display: none; }
  .live-chip { padding: 0 9px; }
}
@media (max-width: 1680px) {
  .logo-text { display: none; }
  /* Con la barra llena, el idioma solo con su bandera y las cifras más justas */
  .topbar .lang-btn { padding: 0 9px; }
  .topbar .lang-btn .lang-code { display: none; }
  .tk { padding: 0 10px; }
  .tk-bar { left: 10px; right: 10px; }
  .topbar { gap: 8px; }
  .sections a { padding: 0 10px; }
  .topbar-actions .btn:not(.icon-btn) { padding: 0 8px; }
  .topbar-sep { margin: 0 4px; }
}
/* De 1280 a 1365 px la barra va en una fila y justa: las cifras y los huecos, un poco más apretados, para
   que un nombre de binder normal («Viva el orden y la ley») quepa entero */
@media (min-width: 1280px) and (max-width: 1365px) {
  .tk { padding: 0 8px; }
  .tk-bar { left: 8px; right: 8px; }
  .topbar { gap: 6px; }
}

/* El catálogo a toda la pantalla (catalog-view.js): los filtros a un lado y las cartas, más grandes. En
   el móvil y la tableta ya ocupa toda la pantalla: esto no se aplica */
@media (min-width: 901px) {
  body.catalog-full .layout { grid-template-columns: 0 minmax(0, 1fr); }
  body.catalog-full .binder-area { visibility: hidden; overflow: hidden; min-width: 0; }
  body.catalog-full .catalog { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); border-left: 0; }
  body.catalog-full .catalog-head { grid-row: 1 / span 2; align-content: start; overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--line); }
  body.catalog-full .catalog-head .filters { max-height: none; }
  body.catalog-full .result-bar { grid-column: 2; }
  body.catalog-full .results { grid-column: 2; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 24px 18px; padding: 18px 24px 40px; }
}

/* La carta en grande (card-zoom.js) */
.dialog.card-zoom { width: fit-content; max-width: calc(100vw - 24px); background: transparent; border: 0; box-shadow: none; overflow: visible; }
.card-zoom .dlg-head { width: 0; min-width: 100%; border: 0; padding: 0 2px 8px; gap: 12px; background: none; } /* del ancho de la carta, sin ensancharla */
.card-zoom .dlg-head h2 { min-width: 0; font-size: var(--fs-md); font-family: var(--font); font-weight: 560; color: #fff; overflow-wrap: anywhere; }
.card-zoom .dlg-head .btn { color: #fff; background: rgba(11, 11, 12, .6); }
.card-zoom .dlg-body { padding: 0; overflow: visible; cursor: zoom-out; }
.cz-art { position: relative; display: block; border-radius: 3.6% / 2.6%; overflow: hidden; background: var(--surface-3); margin-inline: auto; width: fit-content; }
.cz-art img { display: block; height: min(calc(100vh - 84px), calc((100vw - 24px) * 88 / 63)); height: min(calc(100dvh - 84px), calc((100vw - 24px) * 88 / 63)); aspect-ratio: 63 / 88; width: auto; max-width: 100%; object-fit: contain; }
.card-zoom.sealed .cz-art { background: radial-gradient(120% 90% at 50% 30%, #fff, #e3e7ef); }
.card-zoom.sealed .cz-art img { aspect-ratio: auto; mix-blend-mode: multiply; }

/* En la pantalla táctil no hay «pasar por encima»: las dos zonas se ven siempre, pequeñas */
@media (max-width: 900px), (hover: none) {
  .thumb .tz { opacity: 1; padding: 6px; }
  .thumb .tz-add { border-top: 0; align-items: flex-end; }
  .thumb .tz-info { align-items: flex-end; justify-content: center; pointer-events: auto; }
  .thumb .tz-info .tz-l { display: none; }
  .thumb .tz-l { padding: 4px 7px; }
}
