/* Estilos del tracker de victorias/derrotas (wl.js). Se apoya en style.css. */
.wl-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0 8px;
  max-width: 900px;
}
.wl-stat {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 8px 12px;
}
.wl-stat span { display: block; font-size: 0.75rem; color: #94a3b8; }
.wl-stat strong { font-size: 1.25rem; color: #e5e7eb; }
.wl-progress { height: 6px; background: #1e293b; border-radius: 99px; overflow: hidden; max-width: 900px; }
.wl-progress-fill { height: 100%; width: 0; background: #22c55e; transition: width 0.3s; }

.wl-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.wl-controls select {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 8px;
  color: #e5e7eb;
  padding: 5px 8px;
  font-size: 0.85rem;
  font-family: inherit;
}
.wl-controls label { font-size: 0.85rem; color: #cbd5f5; }
.wl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wl-danger { background: #3f1d1d; }
.wl-danger:hover { background: #7f1d1d; }

.wl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
}
.wl-card {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.wl-card.wl-played { border-color: #334155; }
.wl-card img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; }
.wl-name { font-size: 0.75rem; color: #cbd5f5; margin-top: 4px; }
.wl-pct { font-size: 1.05rem; font-weight: 700; color: #64748b; }
.wl-pct.wl-good { color: #86efac; }
.wl-pct.wl-mid { color: #fde68a; }
.wl-pct.wl-bad { color: #fca5a5; }
.wl-record { font-size: 0.72rem; color: #94a3b8; }
.wl-btns { display: flex; gap: 6px; margin-top: 6px; }
.wl-add {
  height: 28px;
  min-width: 40px;
  padding: 0 8px;
  /* Centrado real: style.css da a todos los <button> otro display/padding. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1px solid #1e293b;
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: #e5e7eb;
}
.wl-add-w { background: rgba(34, 197, 94, 0.18); }
.wl-add-w:hover { background: rgba(34, 197, 94, 0.35); }
.wl-add-l { background: rgba(239, 68, 68, 0.18); }
.wl-add-l:hover { background: rgba(239, 68, 68, 0.35); }
.wl-empty { color: #94a3b8; padding: 20px 0; }

.wl-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e5e7eb;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  z-index: 50;
}
.wl-toast[hidden] { display: none; }

.wl-controls .search-wrapper { flex: 1 1 100%; }
.wl-field { display: inline-flex; align-items: center; gap: 6px; }

/* Corrección: −W / −L, discretos, sólo cuando hay algo que restar. */
.wl-fix { display: flex; gap: 6px; min-height: 22px; margin-top: 4px; }
.wl-sub {
  height: 22px;
  min-width: 34px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #94a3b8;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}
.wl-sub:hover { color: #e5e7eb; border-color: #64748b; background: #1e293b; }
.wl-toast { display: flex; align-items: center; gap: 14px; }
.wl-toast-undo {
  height: auto;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--gold, #c8aa6e);
  border-radius: 6px;
  color: var(--gold, #c8aa6e);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.wl-toast-undo:hover { background: rgba(200, 170, 110, 0.15); }

/* ===== Fase 1 (2026-10-29) ===== */

/* Estados de la tarjeta: se lee el rendimiento sin leer números. */
.wl-card { transition: border-color 0.15s, background-color 0.15s; }
.wl-card.wl-unplayed img { filter: grayscale(0.85); opacity: 0.55; }
.wl-card.wl-unplayed .wl-name { color: #94a3b8; }
.wl-card.wl-unplayed:hover img,
.wl-card.wl-unplayed:focus-within img { filter: none; opacity: 1; }
.wl-card.wl-is-good { border-color: #1f5f3f; background: linear-gradient(180deg, rgba(74, 222, 128, 0.07), #020617 70%); }
.wl-card.wl-is-bad { border-color: #5f1f2a; background: linear-gradient(180deg, rgba(248, 113, 113, 0.06), #020617 70%); }
.wl-card.wl-few .wl-pct { color: #cbd5e1; }

/* El campeón al que irá el Enter del buscador. */
.wl-card.wl-target { outline: 2px solid var(--gold, #c8aa6e); outline-offset: 2px; }

/* Confirmación breve al apuntar (sólo si no se ha pedido menos movimiento). */
@media (prefers-reduced-motion: no-preference) {
  .wl-card.wl-flash { animation: wl-flash 0.6s ease-out; }
  @keyframes wl-flash {
    from { box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.55); }
    to { box-shadow: 0 0 0 3px rgba(200, 170, 110, 0); }
  }
}

/* Últimas partidas */
.wl-recent { margin: 0 0 24px; max-width: 900px; }
.wl-recent-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.wl-recent-head h2 { font-size: 1.05rem; color: #f1f5f9; margin: 0; }
.wl-recent-more {
  height: auto; padding: 0; background: none; border: none; border-radius: 0;
  color: var(--gold, #c8aa6e); font: inherit; font-size: 0.85rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.wl-recent-more:hover { background: none; color: var(--gold-light, #f0e6d2); }
.wl-recent-empty { color: #94a3b8; font-size: 0.9rem; line-height: 1.5; max-width: 70ch; }
.wl-recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wl-game {
  display: grid;
  grid-template-columns: 32px 1fr auto auto 28px;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  background: #020617;
  border: 1px solid #1e293b;
  border-left-width: 3px;
  border-radius: 8px;
}
.wl-game-w { border-left-color: #4ade80; }
.wl-game-l { border-left-color: #f87171; }
.wl-game img { width: 32px; height: 32px; border-radius: 5px; }
.wl-game-name { color: #e5e7eb; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-game-res { font-weight: 700; font-size: 0.85rem; min-width: 1.2em; text-align: center; }
.wl-game-w .wl-game-res { color: #86efac; }
.wl-game-l .wl-game-res { color: #fca5a5; }
.wl-game-time { color: #94a3b8; font-size: 0.78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wl-game-del {
  height: 26px; width: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: #64748b; font: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
}
.wl-game-del:hover { color: #e5e7eb; border-color: #334155; background: #1e293b; }
.wl-pct, .wl-record, #wlGames, #wlWins, #wlLosses, #wlPct, #wlPlayed, #wlWonWith { font-variant-numeric: tabular-nums; }
/* style.css da display a todos los <button>: sin esto [hidden] no oculta. */
.wl-recent-more[hidden], .wl-recent-list[hidden], .wl-recent-empty[hidden] { display: none; }

/* ===== Fases 2 y 3 (2026-10-29) ===== */

/* Acento por modo: hielo para ARAM (Abismo de los Lamentos), dorado para el resto. */
body { --wl-accent: var(--gold, #c8aa6e); --wl-track: #1e293b; --wl-track-played: #334155; }
body[data-wl-mode="aram-mayhem"] { --wl-accent: #8fd3f4; --wl-track: #13283a; --wl-track-played: #1d3a52; }
.wl-card.wl-target { outline-color: var(--wl-accent); }
@media (prefers-reduced-motion: no-preference) {
  @keyframes wl-flash {
    from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--wl-accent) 60%, transparent); }
    to { box-shadow: 0 0 0 3px transparent; }
  }
}

/* Resumen superior: un número protagonista y el contexto a su lado. */
.wl-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
  margin: 14px 0 12px;
  max-width: 900px;
}
.wl-hero-main { display: flex; flex-direction: column; min-width: 150px; }
.wl-big {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.wl-big.wl-good { color: #86efac; }
.wl-big.wl-mid { color: #fde68a; }
.wl-big.wl-bad { color: #fca5a5; }
.wl-big-label { font-size: 0.85rem; color: #94a3b8; margin-top: 4px; }
.wl-hero-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 320px; }
.wl-record-line { font-size: 1.05rem; color: #e5e7eb; font-variant-numeric: tabular-nums; }
.wl-streak-line { font-size: 0.85rem; color: #cbd5e1; }
.wl-strip { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.wl-strip-item { width: 28px; height: 28px; border-radius: 6px; border: 2px solid; overflow: hidden; background: #0f172a; }
.wl-strip-item img { width: 100%; height: 100%; display: block; }
.wl-strip-w { border-color: #4ade80; }
.wl-strip-l { border-color: #f87171; }
.wl-strip-item:last-child { box-shadow: 0 0 0 2px var(--wl-accent); }

/* Barra del reto en dos capas: jugados (fondo) y con victoria (acento). */
.wl-challenge { max-width: 900px; }
.wl-challenge .wl-progress { position: relative; height: 10px; background: var(--wl-track); }
.wl-progress-played,
.wl-challenge .wl-progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  border-radius: 99px; transition: width 0.3s;
}
.wl-progress-played { background: var(--wl-track-played); }
.wl-challenge .wl-progress-fill { background: var(--wl-accent); }
.wl-challenge-text { font-size: 0.82rem; color: #94a3b8; margin-top: 6px; }

/* Historial y "tus campeones": dos columnas en pantallas anchas. */
.wl-panels {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px 32px;
  margin-bottom: 28px;
  align-items: start;
}
@media (max-width: 900px) { .wl-panels { grid-template-columns: minmax(0, 1fr); } }
.wl-panels .wl-recent { margin: 0; max-width: none; }
.wl-panels h2 { font-size: 1.05rem; color: #f1f5f9; margin: 0 0 8px; }
.wl-hist-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.wl-hist-filters select {
  background: #020617; border: 1px solid #1e293b; border-radius: 8px;
  color: #e5e7eb; padding: 5px 8px; font-size: 0.85rem; font-family: inherit;
}
.wl-hist-filters[hidden], .wl-hist-summary[hidden], .wl-ins-cols[hidden], .wl-strip[hidden], .wl-streak-line[hidden] { display: none; }
.wl-hist-summary { font-size: 0.85rem; color: #cbd5e1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.wl-panels .wl-recent-more { margin-top: 8px; }

.wl-insights h3 { font-size: 0.9rem; color: #cbd5e1; margin: 0 0 6px; font-weight: 600; }
.wl-ins-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .wl-ins-cols { grid-template-columns: 1fr; } }
.wl-ins-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wl-ins-item {
  display: grid; grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto;
  column-gap: 8px; align-items: center;
  padding: 4px 8px 4px 4px; background: #020617; border: 1px solid #1e293b; border-radius: 8px;
}
.wl-ins-item img { width: 28px; height: 28px; border-radius: 5px; grid-row: 1 / 3; }
.wl-ins-name { font-size: 0.85rem; color: #e5e7eb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-ins-pct { font-size: 0.9rem; font-weight: 700; color: #f1f5f9; grid-row: 1 / 3; grid-column: 3; font-variant-numeric: tabular-nums; }
.wl-ins-pct.wl-good { color: #86efac; }
.wl-ins-pct.wl-mid { color: #fde68a; }
.wl-ins-pct.wl-bad { color: #fca5a5; }
.wl-ins-rec { font-size: 0.72rem; color: #94a3b8; font-variant-numeric: tabular-nums; }

/* Tarjeta: +V / +D como base, dos mitades a todo el ancho. */
.wl-card { padding-bottom: 0; overflow: hidden; }
.wl-fix { margin-top: auto; padding-top: 4px; }
.wl-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: calc(100% + 12px);
  margin: 8px -6px 0;
}
.wl-btns .wl-add {
  height: 34px;
  min-width: 0;
  width: 100%;
  border: none;
  border-top: 1px solid #1e293b;
  border-radius: 0;
  font-size: 0.85rem;
}
.wl-btns .wl-add-l { border-left: 1px solid #1e293b; }
.wl-btns .wl-add:focus-visible { outline: 2px solid var(--wl-accent); outline-offset: -2px; }

/* ===== HUD (2026-11-08) ===== */

/* Sin partidas, el resumen y la barra no dicen nada: fuera. La línea de
   instrucciones hace de estado vacío y el grid sube. */
body.wl-no-games .wl-hero,
body.wl-no-games .wl-challenge { display: none; }

/* Sin partidas, ningún campeón en gris: si no, todo parece desactivado. */
body.wl-no-games .wl-card.wl-unplayed img { filter: none; opacity: 1; }
.wl-card.wl-unplayed img { filter: grayscale(0.6); opacity: 0.7; }

/* Filtros: abiertos en escritorio (sin título), plegables en el móvil. */
.wl-filters > summary { display: none; list-style: none; }
.wl-filters > summary::-webkit-details-marker { display: none; }
.wl-filters-body { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 720px) {
  .wl-filters { flex: 1 1 100%; }
  .wl-filters > summary { display: inline-flex; gap: 6px; }
  .wl-filters > summary::after { content: "▾"; font-size: 0.75rem; transition: transform 0.15s; }
  .wl-filters[open] > summary::after { transform: rotate(180deg); }
  .wl-filters[open] .wl-filters-body { margin-top: 10px; }
  .wl-panels .wl-insights:has(#wlInsightsCols[hidden]) { display: none; }
}

/* "Borrar progreso" vive ahora en el menú "Más", en rojo suave. */
.wl-actions .more-menu { display: inline-block; }

/* Móvil: dos tarjetas por fila, más compactas, y la nota de privacidad más discreta. */
@media (max-width: 600px) {
  .wl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .wl-btns .wl-add { height: 44px; }
  .wl-sub { height: 30px; }
  .local-note { font-size: 0.78rem; }
}
/* Móvil sin partidas: el historial vacío no aporta nada antes del grid. */
@media (max-width: 720px) {
  body.wl-no-games .wl-panels { display: none; }
}
/* Mismo arreglo que el aviso de la portada: ancho según el texto. */
.wl-toast { width: max-content; max-width: calc(100vw - 32px); }
