/* Rapizza OS · panel v3 — Redes · Toda la historia (redes-historia.js). Prefijo rh-.
   Barras de la evolución = ui.barras (--s1, seleccionada --s1-sel). A y B de la comparación = --s1 / --s2, siempre con
   letra. Temas: barra --s1 con la rayita de 1× (lo normal). Todo con los tokens de estilo.css: el oscuro sale solo. */

.rd-historia { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ───────────── resumen ───────────── */
.rh-intro { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border-radius: var(--r-card); background: var(--surface); border: var(--borde-card); box-shadow: var(--sombra); }
.rh-intro-g { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: center; }
.rh-frases { margin: 0; }
.rh-link { all: unset; cursor: pointer; font-weight: 600; color: var(--brand-tx); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rh-link:hover { text-decoration-thickness: 2px; }
.rh-link:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; border-radius: 3px; }
.rh-anios { display: flex; align-items: flex-end; gap: 6px; padding: 4px 0; }
.rh-anio { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 38px; }
.rh-anio-b { display: flex; align-items: flex-end; width: 22px; height: 64px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.rh-anio-b i { display: block; width: 100%; background: var(--s1); border-radius: 4px 4px 0 0; }
.rh-anio b { font-size: 13px; font-variant-numeric: tabular-nums; }
.rh-anio small { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rh-sorteos { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.rh-sorteos-t { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.45; min-width: 0; flex: 1 1 260px; }
.rh-sorteos-t .ic { flex: none; margin-top: 1px; color: var(--s3); }
.rh-sorteos-t b { color: var(--ink); }

/* ───────────── evolución ───────────── */
.rh-evo-barra { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.rh-met { min-width: 0; max-width: 100%; }
.rh-evo { min-height: 240px; }
.rh-evo .g-hit[role="button"] { cursor: pointer; }
.rh-evo-det { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.rh-evo-det:empty { display: none; }
.rh-det-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 13px; color: var(--ink-3); }
.rh-det-cab b { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.rh-det-cab b .ic { color: var(--warn); flex: none; }
.rh-det-vacio { margin: 0; }
.rh-mini-pubs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }

/* una publicación chica (detalle del período y la mejor de cada época) */
.rh-mini {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; transition: border-color .12s, background .12s; min-width: 0; width: 100%;
}
.rh-mini:hover { border-color: var(--line-2); background: var(--surface); }
.rh-mini:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.rh-mini-img { position: relative; display: block; width: 64px; height: 64px; border-radius: 9px; overflow: hidden; }
.rh-mini-img > .rd-img-caja { position: absolute; inset: 0; }
.rh-mini-p { position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.rh-mini-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rh-mini-tx b { font-size: 14px; }
.rh-mini-tx small { font-size: 12px; color: var(--ink-3); }
.rh-mini-tx > span { font-size: 12.5px; line-height: 1.35; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ───────────── ranking ───────────── */
.rh-rank-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.rh-rank-sel { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; max-width: 100%; }
.rh-rank-sel .sel { min-width: 0; max-width: 100%; }
.rh-rank-sel .sel select { max-width: 100%; }
.rh-rank-nota { margin: -4px 0 10px; }
.rh-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rh-rank > li + li { border-top: 1px solid var(--line); }
.rh-rank-f {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 28px 64px minmax(0, 1fr) minmax(96px, auto);
  gap: 12px; align-items: center; padding: 10px 6px; border-radius: 10px;
}
.rh-rank-f:hover { background: var(--surface-2); }
.rh-rank-f:focus-visible { outline: 2px solid var(--foco); outline-offset: -2px; }
.rh-rank-n { font-family: var(--f-titulo); font-size: 20px; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.rh-rank-f--podio .rh-rank-n { color: var(--brand-tx); }
.rh-rank-img { position: relative; display: block; width: 64px; height: 64px; border-radius: 9px; overflow: hidden; }
.rh-rank-img > .rd-img-caja { position: absolute; inset: 0; }
.rh-rank-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rh-rank-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.rh-rank-cab b { font-size: 13.5px; margin-right: 2px; }
.rh-rank-cab .chip { font-size: 11px; }
.rh-rank-texto { font-size: 13px; line-height: 1.4; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rh-rank-tx small { font-size: 12px; color: var(--ink-3); }
.rh-rank-v { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.rh-rank-v b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rh-rank-v small { font-size: 11.5px; color: var(--ink-3); }
.rh-rank-pista { display: block; width: 96px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 3px; }
.rh-rank-pista i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }

/* ───────────── comparar ───────────── */
.rh-cmp-elegir { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.rh-cmp-c { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 240px; }
.rh-cmp-c .sel { flex: 1; min-width: 0; }
.rh-cmp-c .sel select { width: 100%; }
.rh-cmp-vs { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.rh-cmp-k { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.rh-cmp-k--a { background: var(--s1); }
.rh-cmp-k--b { background: var(--s2); }
.rh-cmp-frase { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin: 0 0 12px; }
.rh-cmp-frase b { color: var(--ink); }
.rh-cmp-tbl th[scope="row"] { font-weight: 500; color: var(--ink-2); }
.rh-cmp-tbl thead .rh-cmp-k { width: 20px; height: 20px; font-size: 11px; }
.rh-cmp-fmt { font-size: 12px; color: var(--ink-2); white-space: normal; }
.rh-cmp-mejores { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.rh-cmp-mt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.rh-cmp-mt .rh-cmp-k { width: 18px; height: 18px; font-size: 10.5px; border-radius: 5px; }

/* ───────────── temas ───────────── */
.rh-temas { display: flex; flex-direction: column; }
.rh-tema {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.5fr) 72px; gap: 6px 16px; align-items: center;
  padding: 11px 6px; border-top: 1px solid var(--line); border-radius: 0;
}
.rh-tema:first-child { border-top: 0; }
.rh-tema:hover { background: var(--surface-2); border-radius: 10px; }
.rh-tema:focus-visible { outline: 2px solid var(--foco); outline-offset: -2px; border-radius: 10px; }
.rh-tema-n { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rh-tema-n .ic { flex: none; color: var(--ink-3); }
.rh-tema-n > span { display: flex; flex-direction: column; min-width: 0; }
.rh-tema-n b { font-size: 14px; }
.rh-tema-n small { font-size: 12px; color: var(--ink-3); }
.rh-tema-b { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rh-tema-pista { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--surface-2); }
.rh-tema-pista i { display: block; height: 100%; border-radius: 4px; background: var(--s1); }
.rh-tema-pista em { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink-2); border-radius: 1px; }
.rh-tema-d { font-size: 12.5px; color: var(--ink-3); }
.rh-tema-e { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.rh-tema-e b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rh-tema-e small { font-size: 11px; color: var(--ink-3); }
.rh-tema--alto .rh-tema-e { background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.rh-tema--alto .rh-tema-e b { color: var(--good-tx); }
.rh-tema--bajo .rh-tema-e b { color: var(--bad-tx); }
.rh-tema--pocas .rh-tema-n b, .rh-tema--pocas .rh-tema-e b { color: var(--ink-3); }
.rh-tema--pocas .rh-tema-pista i { background: var(--s-otros); }

/* ───────────── teléfono ───────────── */
@media (max-width: 640px) {
  .rh-intro { padding: 14px; }
  .rh-intro-g { grid-template-columns: minmax(0, 1fr); }
  .rh-anios { justify-content: space-between; }
  .rh-anio { width: auto; flex: 1; }
  .rh-rank-f { grid-template-columns: 22px 52px minmax(0, 1fr); gap: 10px; }
  .rh-rank-img { width: 52px; height: 52px; }
  .rh-rank-v { grid-column: 3; flex-direction: row; align-items: baseline; gap: 6px; text-align: left; }
  .rh-rank-v b { font-size: 16px; }
  .rh-rank-pista { display: none; }
  .rh-tema { grid-template-columns: minmax(0, 1fr) 64px; grid-template-areas: "n e" "b b"; }
  .rh-tema-n { grid-area: n; }
  .rh-tema-e { grid-area: e; }
  .rh-tema-b { grid-area: b; }
  .rh-cmp-vs { display: none; }
  .rh-rank-sel { width: 100%; }
  .rh-rank-sel .sel { flex: 1 1 100%; }
  .rh-rank-sel .sel select { width: 100%; }
  .rh-met, .rh-met select { width: 100%; }
}
