/* ══════════════════════════════════════════════
   TIERLIST VIEW  (css/tierlist-view.css)
   Pestaña Tierlist — esqueleto (tanda 1).
   Estética: pestaña Cartas (system-ui, neutro) + tarjeta
   "floaty / glossy" tipo Apple para la tierlist entera.
   La PÁGINA scrollea (no la tierlist): los tiers siempre visibles.
══════════════════════════════════════════════ */

#view-tierlist {
  position: fixed;
  top: 48px; left: 0; right: 0; bottom: 0;
  z-index: 9050;
  /* Destellos de color muy tenues: dan algo que refractar al cristal (blur). */
  background:
    radial-gradient(820px circle at 18% -6%, rgba(77, 171, 255, 0.07), transparent 55%),
    radial-gradient(760px circle at 88% 18%, rgba(177, 151, 252, 0.06), transparent 52%),
    radial-gradient(720px circle at 62% 108%, rgba(105, 219, 124, 0.045), transparent 55%),
    #111118;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Columna de contenido centrada y acotada (≈ ancho de Inicio, algo más) */
#tl-inner {
  width: 100%;
  max-width: 1120px;
  padding: 26px 28px 64px;
  box-sizing: border-box;
}

/* ── Título grande, centrado, editable (lápiz) ─────────────────── */
#tl-head {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 2px 0 20px;
}
#tl-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
#tl-title {
  width: auto;
  min-width: 80px;
  max-width: 62vw;
  background: transparent;
  border: none;
  outline: none;
  text-align: center;
  color: rgba(255, 255, 255, 0.96);
  font: 740 31px/1.15 inherit;
  letter-spacing: -0.02em;
  padding: 2px 0;
}
#tl-title::placeholder { color: rgba(255, 255, 255, 0.32); font-weight: 700; }
.tl-pencil {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, transform 0.1s;
}
.tl-pencil:hover { color: rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.06); }
.tl-pencil:active { transform: scale(0.92); }
.tl-pencil svg { width: 15px; height: 15px; }

/* ── La tierlist = UNA tarjeta floaty glossy dividida en filas ──── */
#tl-card {
  /* Estático normal en «Añadir cartas» / «Mis tierlists». Sticky + colapso SOLO en «Mi selección». */
  position: relative;
  z-index: 30;
  border-radius: 24px;
  overflow: hidden;
  /* Colapso al scroll: encoge TODA la tierlist a escala (mantiene proporción,
     no aplasta las filas). --tl-scale 1 → 0.7 lo fija el scroll handler. */
  transform: scale(var(--tl-scale, 1));
  transform-origin: top center;
  will-change: transform;
  /* Cristal oscuro translúcido (el blur refracta las cartas que pasan por detrás). */
  background: linear-gradient(180deg, rgba(40, 40, 54, 0.40), rgba(14, 14, 22, 0.52));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 28px 64px -18px rgba(0, 0, 0, 0.70),
    0 8px 24px -14px rgba(0, 0, 0, 0.60),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
}
/* Sticky (queda arriba) SOLO en «Mi selección»; en el resto es un elemento normal de la web. */
#view-tierlist.tl-pool-mode #tl-card { position: sticky; top: 10px; }

/* Brillo glossy superior — estático, una sola pieza (por encima de los tiers) */
#tl-card::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 3;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 30%);
}
/* Reflejo que sigue al cursor (hover): barre TODA la tarjeta como una pieza */
#tl-card::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.35s ease;
  /* Casi imperceptible: un velo de luz muy tenue que sigue al cursor. */
  background:
    radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%),
      rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 62%);
}
#tl-card:hover::after { opacity: 1; }

#tl-rows { display: flex; flex-direction: column; }

.tl-row {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 86px;     /* +10% (antes 78px) → cartas más grandes dentro */
}
.tl-row + .tl-row { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.tl-row-label {
  flex: 0 0 94px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f2f2f5;
  font-weight: 800;
  font-size: 30px;      /* fallback: el tamaño real lo fija fitLabel() según nº de caracteres */
  line-height: 1.08;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 6px;
  word-break: break-word;
  cursor: text;         /* renombrable (contenteditable) */
  outline: none;
  /* Cristal tintado: color desaturado + semitransparente (deja ver el cristal/
     las cartas de detrás) con un velo glossy muy sutil — no iluminación propia. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 46%),
    color-mix(in srgb, var(--tier-color, #888) 72%, transparent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
/* Foco de edición del nombre del tier — leve marco interior */
.tl-row-label:focus { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45); }
/* La etiqueta SÍ es seleccionable (renombrable); las zonas de drag, no. */
.tl-row-label { -webkit-user-select: text; user-select: text; }

.tl-row-cards {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px;            /* margen casi inexistente → cartas ligeramente más grandes */
  padding: 2px 5px;    /* margen vertical mínimo respecto al hueco de la tier */
  min-height: 0;
}

/* Botón de quitar fila (aparece al hover de la fila) */
.tl-row-remove {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.32);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.tl-row:hover .tl-row-remove { opacity: 1; }
.tl-row-remove:hover { background: rgba(255, 107, 107, 0.85); color: #fff; }

/* Añadir fila = ＋ pequeño (icono), no botón ancho */
#tl-row-tools {
  position: relative;
  height: 0;
}
#tl-add-row {
  position: absolute;
  left: 0; bottom: 24px;            /* centrado a la altura de la última tier (fila ~78px) */
  z-index: 5;                       /* por debajo de la tarjeta (z 30): queda tapado */
  display: flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  background: rgba(34, 34, 44, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  font: 500 12.5px/1 inherit;
  white-space: nowrap;
  border-radius: 9px;
  cursor: pointer;
  opacity: 0;
  transform: translateX(0);
  pointer-events: none;
  transition: transform 0.24s cubic-bezier(.2, .7, .3, 1), opacity 0.2s, background 0.15s, color 0.15s;
}
#tl-add-row .tl-add-ico { font-size: 17px; font-weight: 300; line-height: 1; }
/* Asoma deslizándose al pasar el ratón por la ZONA DE ETIQUETAS (letras/color),
   no por la zona de colocar cartas — SOLO sin scroll. .tl-labels-hover lo pone el JS. */
#view-tierlist:not(.tl-scrolled).tl-labels-hover #tl-add-row {
  opacity: 1;
  transform: translateX(calc(-100% + 6px));   /* 6px tucados tras la tarjeta */
  pointer-events: auto;
}
#tl-add-row:hover { background: rgba(48, 48, 62, 0.97); color: #fff; }
#tl-add-row:active { transform: translateX(calc(-100% + 6px)) scale(0.96); }
#tl-add-row.disabled { opacity: 0 !important; pointer-events: none; }

/* ＋ para añadir tier ARRIBA (S+): espejo del de abajo, anclado al borde superior
   de la tierlist; solo asoma al pasar por la etiqueta de la tier MÁS ALTA. */
#tl-row-tools-top { position: relative; height: 0; z-index: 6; }
#tl-add-row-top {
  position: absolute;
  left: 0; top: 30px;               /* a la altura de la tier más alta */
  z-index: 6;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  background: rgba(34, 34, 44, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  font: 500 12.5px/1 inherit;
  white-space: nowrap;
  border-radius: 9px;
  cursor: pointer;
  opacity: 0;
  transform: translateX(0);
  pointer-events: none;
  transition: transform 0.24s cubic-bezier(.2, .7, .3, 1), opacity 0.2s, background 0.15s, color 0.15s;
}
#tl-add-row-top .tl-add-ico { font-size: 17px; font-weight: 300; line-height: 1; }
#view-tierlist:not(.tl-scrolled).tl-top-hover:not(.tl-has-splus) #tl-add-row-top {
  opacity: 1;
  transform: translateX(calc(-100% + 6px));
  pointer-events: auto;
}
#tl-add-row-top:hover { background: rgba(48, 48, 62, 0.97); color: #fff; }
#tl-add-row-top:active { transform: translateX(calc(-100% + 6px)) scale(0.96); }
#tl-add-row-top.disabled { opacity: 0 !important; pointer-events: none; }

/* ── "Clasifica esto:" + pills (encabezado del buscador) ───────── */
#tl-presets {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
  scrollbar-width: thin;
}
#tl-presets-label {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}
#tl-pills { display: flex; gap: 8px; flex: 0 0 auto; }
.tl-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #dcdce2;
  font: 500 12.5px/1 inherit;
  white-space: nowrap;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.tl-pill:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.16); }
.tl-pill:active { transform: scale(0.96); }
.tl-pill svg { width: 14px; height: 14px; flex: 0 0 auto; opacity: 0.85; }
/* Sugerencia cargada actualmente en el pool */
.tl-pill.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ── Zona inferior: sub-pestañas + paneles (fluyen en la página) ─ */
#tl-bottom {
  margin-top: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
#tl-subtabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tl-subtab {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font: 600 13px/1 inherit;
  padding: 9px 14px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.tl-subtab:hover { color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.03); }
.tl-subtab.active { color: #f2f2f5; background: rgba(255, 255, 255, 0.06); }

.tl-pane { display: none; padding: 16px; }
.tl-pane.active { display: block; }
.tl-pane-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  color: rgba(255, 255, 255, 0.32);
  font-size: 13.5px;
  padding: 20px;
}

/* ── Pool (bandeja de cartas sin clasificar) ───────────────────── */
.tl-pool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tl-pool-count {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
}
.tl-pool-clear {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cfcfd6;
  font: 500 12px/1 inherit;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.tl-pool-clear:hover { background: rgba(255, 255, 255, 0.1); }
.tl-pool-clear:active { transform: scale(0.96); }

.tl-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}
.tl-pool-card {
  position: relative;
  aspect-ratio: 367 / 512;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.12s ease;
}
.tl-pool-card:hover { transform: translateY(-2px); }
.tl-pool-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.tl-pool-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px; line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.tl-pool-card:hover .tl-pool-remove { opacity: 1; }
.tl-pool-remove:hover { background: rgba(255, 107, 107, 0.9); color: #fff; }

/* ── Buscador embebido (esencial) ──────────────────────────────── */
#tls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
#tls-q {
  flex: 1 1 180px;
  min-width: 140px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ececf0;
  font: 400 13px/1 inherit;
  padding: 9px 12px;
  border-radius: 9px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
#tls-q::placeholder { color: rgba(255, 255, 255, 0.3); }
#tls-q:focus { border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08); }
#tls-set {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ececf0;
  font: 500 12.5px/1 inherit;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  outline: none;
}
/* Los chips de tipo/elemento/fase/rareza usan las clases .cv-chip de Cartas (estilo idéntico). */
#tls-bar .cv-chip-group { flex: 0 0 auto; }
/* Dropdown de orden (mismo look que el de Cartas) */
#tls-sort-wrap { position: relative; flex: 0 0 auto; }
#tls-sort-trigger {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 11px; border-radius: 9px; font: 600 12px/1 inherit;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.62); cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#tls-sort-trigger:hover { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.9); }
#tls-sort-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: rgba(16, 16, 26, 0.98); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px; padding: 4px; min-width: 150px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6); z-index: 60;
  backdrop-filter: blur(12px);
}
/* Botón único Seleccionar / Deseleccionar todo — a la izquierda del cluster */
.tls-bulk {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.6);
  font: 500 11.5px/1 inherit;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.tls-bulk:hover { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.9); }
.tls-bulk:active { transform: scale(0.96); }
/* El contador de resultados + el CTA se van a la derecha */
#tls-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}
/* «Ver mi selección»: neutro por defecto; VERDE (como el CTA de Cartas) con ≥2 cartas */
#tls-done {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e6e6ea;
  font: 700 12px/1 inherit;
  padding: 9px 15px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
#tls-done:hover { background: rgba(255, 255, 255, 0.14); }
#tls-done:active { transform: scale(0.96); }
#tls-done.is-cta {
  background: rgba(40, 180, 80, 0.18);
  border-color: rgba(60, 200, 100, 0.4);
  color: rgba(100, 230, 140, 0.95);
}
#tls-done.is-cta:hover {
  background: rgba(40, 180, 80, 0.32);
  border-color: rgba(80, 220, 120, 0.6);
  color: #6dffaa;
}
/* Línea cue (instrucción) sobre los resultados */
#tls-cue {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.42);
  margin: 0 2px 12px;
}

.tls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}
.tls-card {
  position: relative;
  aspect-ratio: 367 / 512;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.tls-card:hover { transform: translateY(-2px); }
.tls-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Marcada como ya añadida al pool */
.tls-card.in img { filter: brightness(0.5) saturate(0.8); }
.tls-card.in { outline: 2px solid rgba(76, 194, 104, 0.9); outline-offset: -2px; }
/* Badge ＋ / ✓ siempre visible (deja claro que se hace clic para añadir) */
.tls-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 15px; font-weight: 700; line-height: 1;
  pointer-events: none;
  transition: background 0.15s, transform 0.1s;
}
.tls-card:hover .tls-badge { background: rgba(0, 0, 0, 0.72); transform: scale(1.08); }
.tls-card.in .tls-badge {
  background: rgba(76, 194, 104, 0.96);
  border-color: rgba(76, 194, 104, 0.96);
  color: #0b1f12;
  font-weight: 800;
}
.tls-badge .tls-tick { display: none; }
.tls-card.in .tls-badge .tls-plus { display: none; }
.tls-card.in .tls-badge .tls-tick { display: inline; }

/* ══════════════════════════════════════════════════════════════════
   TANDA 3 — cartas dentro de los tiers + drag&drop + hold-zoom
══════════════════════════════════════════════════════════════════ */

/* Carta clasificada (alto ≈ contenido de una fila ~86px; ancho derivado) */
.tl-tier-card {
  position: relative;
  height: 80px;                 /* tuneable: alto de la carta en el tier (casi llena la fila) */
  aspect-ratio: 367 / 512;
  flex: 0 0 auto;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: grab;
  touch-action: none;           /* el gesto lo gestionan los pointer events */
  transition: transform 0.12s ease;
}
.tl-tier-card:hover { transform: translateY(-3px) scale(1.05); z-index: 2; }
.tl-tier-card:active { cursor: grabbing; }
.tl-tier-card img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* Las cartas de «Mi selección» también se arrastran / hacen zoom */
.tl-pool-card { cursor: grab; touch-action: none; }
.tl-pool-card:active { cursor: grabbing; }

/* Sin selección de texto (el tinte azul del navegador) en las zonas de arrastre.
   Las etiquetas (.tl-row-label) NO se incluyen: son renombrables y necesitan selección. */
.tl-row-cards, .tl-tier-card, .tl-pool-grid, .tl-pool-card, .tl-drag-ghost {
  -webkit-user-select: none;
  user-select: none;
}

/* Carta que se está arrastrando (atenuada en su sitio) */
.tl-tier-card.tl-dragging,
.tl-pool-card.tl-dragging { opacity: 0.3; }

/* Reordenar estilo home del iPhone: las cartas se apartan para abrir hueco (translateX
   por JS). Transición ÁGIL (snappy, responde al instante en ambas direcciones). */
#view-tierlist.tl-dragging-active .tl-tier-card {
  transition: transform 0.14s cubic-bezier(.2, .8, .3, 1);
}
/* Durante el arrastre, sin "pop" de hover en las cartas (lo que se mueve es el hueco). */
#view-tierlist.tl-dragging-active .tl-tier-card:hover { transform: none; }

/* SIN tinte/halo de color al reposicionar (lo pidió Daniel) → solo un BORDECITO sutil
   del color del tier en la zona de cartas, al pasar el ratón o al ser el destino. */
.tl-row:hover .tl-row-cards,
.tl-row.tl-drop-over .tl-row-cards {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tier-color, #888) 50%, transparent);
}
#tl-pane-pool.tl-drop-active { border-radius: 12px; }
#tl-pane-pool.tl-drop-over {
  box-shadow: inset 0 0 0 2px rgba(120, 200, 140, 0.5);
}

/* Punto de inserción al reordenar dentro de un tier */
.tl-drop-caret {
  flex: 0 0 auto;
  width: 3px;
  align-self: stretch;
  min-height: 56px;
  margin: 2px 1px;
  border-radius: 2px;
  background: var(--tier-color, #fff);
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--tier-color, #fff) 70%, transparent);
}

/* Fantasma que sigue al cursor (posición fija, fuera del flujo) */
.tl-drag-ghost {
  position: fixed;
  z-index: 99999;
  width: 84px;
  aspect-ratio: 367 / 512;
  transform: translate(-50%, -50%) rotate(-3deg);
  pointer-events: none;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.6));
  will-change: left, top;
}
.tl-drag-ghost img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; display: block; }

/* Aterrizaje "drop-slam": clon que cae por encima de TODO (no lo recorta #tl-card) */
.tl-slam-clone {
  position: fixed;
  z-index: 99998;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
  transform-origin: center bottom;
  will-change: transform;
}
/* Halo geométrico de gota al caer — anillo NÍTIDO (sin bloom), sutil */
.tl-slam-ring {
  position: fixed;
  z-index: 99997;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid var(--ring-color, #fff);
  will-change: transform, opacity;
}

/* ── Barra de acciones de la cabecera (Guardar/Compartir/Imagen/Reiniciar) ── */
#tl-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tl-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.6);
  font: 600 12px/1 inherit;
  padding: 7px 11px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.tl-act-btn:hover { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.92); border-color: rgba(255, 255, 255, 0.16); }
.tl-act-btn:active { transform: scale(0.95); }
.tl-act-btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.tl-act-btn.tl-reset:hover { background: rgba(255, 107, 107, 0.16); color: #ff9b9b; border-color: rgba(255, 107, 107, 0.38); }

/* ── Biblioteca «Mis tierlists» ── */
.tl-lib-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.tl-lib-item {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
}
.tl-lib-strip { display: flex; flex-direction: column; gap: 3px; width: 54px; flex: 0 0 auto; }
.tl-lib-seg { height: 7px; border-radius: 3px; background: #888; }
.tl-lib-seg.splus { background: linear-gradient(90deg, #9d6b86, #6b8a9d, #7e6b9d); }
.tl-lib-info { flex: 1 1 auto; min-width: 0; }
.tl-lib-name { font-size: 15px; font-weight: 700; color: #f2f2f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lib-meta { margin-top: 3px; font-size: 12px; color: rgba(255, 255, 255, 0.45); }
.tl-lib-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.tl-lib-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font: 600 12px/1 inherit;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.tl-lib-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.tl-lib-btn:active { transform: scale(0.95); }
.tl-lib-btn.danger:hover { background: rgba(255, 107, 107, 0.85); color: #fff; border-color: transparent; }

/* ══════════════════════════════════════════════════════════════════
   Tier especial S+ (encima de la S): etiqueta con holo RGB SUTIL, MUY LENTO y
   SIN cortes (ping-pong 0→100→0, sin reinicio brusco) + vaivén izq-der sutil.
   Solo en la etiqueta; y un bordecito RGB en la zona de cartas al hacer hover.
══════════════════════════════════════════════════════════════════ */
.tl-row--splus .tl-row-label {
  color: #fff;
  /* Colores apagados (no saturados) → holo discreto */
  background:
    linear-gradient(115deg, #9d6b86, #9d8a6b, #8f9d6b, #6b9d7e, #6b8a9d, #7e6b9d, #9d6b92);
  background-size: 220% 220%;
  animation: tl-rgb-slide 17s ease-in-out infinite;   /* 50% más rápido; SIN vaivén lateral */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.tl-row--splus .tl-row-label:focus { animation-play-state: paused; }   /* quieto al renombrar */

/* Ping-pong: vuelve al punto de partida → bucle continuo SIN salto/reinicio */
@keyframes tl-rgb-slide {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Bordecito RGB de la zona de cartas de la S+ (mismo holo sutil y lento) */
.tl-row--splus:hover .tl-row-cards,
.tl-row--splus.tl-drop-over .tl-row-cards { box-shadow: none; }
.tl-row--splus .tl-row-cards { position: relative; }
.tl-row--splus:hover .tl-row-cards::after,
.tl-row--splus.tl-drop-over .tl-row-cards::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  padding: 1.5px;
  background: linear-gradient(115deg, #9d6b86, #9d8a6b, #8f9d6b, #6b9d7e, #6b8a9d, #7e6b9d, #9d6b92);
  background-size: 220% 220%;
  animation: tl-rgb-slide 17s ease-in-out infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════
   Sugerencia «Mejores mazos actualizados»: ítems de MAZO (portada 50/50
   con los 2 protagonistas) en el pool/tiers + modal con el mazo completo.
══════════════════════════════════════════════════════════════════ */

/* Píldora de la sugerencia de mazos: un punto más destacada */
.tl-pill.tl-pill-meta { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.16); }
.tl-pill.tl-pill-meta svg { width: 15px; height: 15px; opacity: 0.95; }

/* Portada de arquetipo dividida 50/50 HORIZONTAL: la MITAD SUPERIOR de cada carta
   (arriba protagonista 1, abajo protagonista 2). Llena la celda (tier o selección). */
.tl-deck-cover { display: flex; flex-direction: column; width: 100%; height: 100%; }
.tl-deck-half {
  flex: 1 1 0;
  min-height: 0;
  background-size: 100% auto;        /* ancho completo → la banda muestra el TOP de la carta */
  background-position: center top;
  background-color: rgba(255, 255, 255, 0.04);
}
.tl-deck-half + .tl-deck-half { box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.5); }
/* Ítem de mazo: misma FORMA DE CARTA que una carta normal (mismo radio, no a sangre
   ni redondeado de más) + marquito sutil para distinguirlo. El radio lo hereda de
   .tl-tier-card / .tl-pool-card (6/7px); aquí solo el marquito. */
.tl-tier-card.tl-deck-item, .tl-pool-card.tl-deck-item {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.tl-pool-card.tl-deck-item { cursor: pointer; }
.tl-drag-ghost-deck .tl-deck-cover { border-radius: 7px; overflow: hidden; }
/* MONO (1 solo protagonista): la carta completa, sin dividir */
.tl-deck-full {
  width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.04);
}

/* ── Modal: mazo completo (mejor variante) — minimalista, acorde con la web ── */
/* z entre la vista (9050) y el zoom (9060): el zoom de una carta sale POR ENCIMA. */
#tl-deck-modal {
  position: fixed;
  inset: 0;
  z-index: 9055;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(8, 8, 12, 0.5);   /* velo ligero, sin blur (no saca de la web) */
}
#tl-deck-modal.open { display: flex; }
.tl-deck-panel {
  width: min(720px, 92vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: rgba(20, 20, 27, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 18px 48px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: tl-deck-pop 0.16s ease;
}
@keyframes tl-deck-pop { from { transform: scale(.98); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tl-deck-modal-head {
  position: relative;
  padding: 15px 50px 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tl-deck-modal-title { font: 700 16px/1.2 inherit; color: #f2f2f5; }
.tl-deck-modal-sub { margin-top: 3px; font-size: 12px; color: rgba(255, 255, 255, 0.45); }
.tl-deck-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px; cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.tl-deck-modal-close:hover { background: rgba(255, 107, 107, 0.85); color: #fff; }
.tl-deck-modal-close:active { transform: scale(0.92); }
.tl-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  padding: 16px;
  overflow-y: auto;
}
.tl-deck-card {
  position: relative;
  aspect-ratio: 367 / 512;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.tl-deck-card:hover { transform: translateY(-3px) scale(1.04); z-index: 2; }
.tl-deck-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-deck-count {
  position: absolute;
  right: 3px; bottom: 3px;
  padding: 2px 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font: 700 12px/1 inherit;
}
