/* Redis sorted sets — Salvatore Sanfilippo's "give people powerful primitives and do
   less," made visible. A live ranked leaderboard is painful in a traditional database
   (re-sort and re-rank on every score change) but trivial in Redis: it is one sorted
   set. Each player is a member with a score; the set stays ranked automatically. Bump
   a score and the board re-orders on its own -- the equivalent commands are just ZADD
   to set a score and ZREVRANK to read a rank. A complex feature collapses to a few
   commands because the right primitive already exists. Vanilla JS, no deps, no build.
   Palette shared with siblings: green = the just-updated member (the win), neutral
   otherwise. No red. */

#sorted-set {
  --zs-hit: #30d158;
  --zs-cmd: #5ac8fa;
  font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background: var(--color-bg-elevated, #111111);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
  border-radius: 16px; padding: clamp(16px, 3vw, 26px); margin: 2.5rem 0;
  color: var(--color-text-primary, #ffffff);
}
.zs-title { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }
.zs-explain { font-size: 0.9rem; line-height: 1.55; margin: 8px 0 16px; color: var(--color-text-secondary, rgba(255,255,255,0.7)); }

.zs-board { display: flex; flex-direction: column; gap: 6px; }
.zs-row { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 12px; background: var(--color-bg-surface, #1a1a1a); border: 1px solid var(--color-border-subtle, rgba(255,255,255,0.08)); border-radius: 10px; padding: 9px 12px; transition: border-color 0.3s, background 0.3s; }
.zs-row.hit { border-color: var(--zs-hit); background: rgba(48,209,88,0.10); }
.zs-rank { font-family: var(--font-mono, monospace); font-size: 0.95rem; font-weight: 700; color: var(--color-text-tertiary, rgba(255,255,255,0.5)); text-align: center; }
.zs-row.hit .zs-rank { color: var(--zs-hit); }
.zs-name { font-family: var(--font-mono, monospace); font-size: 0.92rem; color: #fff; }
.zs-score { font-family: var(--font-mono, monospace); font-size: 0.92rem; font-variant-numeric: tabular-nums; color: var(--color-text-secondary, rgba(255,255,255,0.7)); }
.zs-row.hit .zs-score { color: var(--zs-hit); }
.zs-add { appearance: none; cursor: pointer; font: inherit; font-size: 0.74rem; font-weight: 700; border: 1px solid var(--color-border, rgba(255,255,255,0.18)); background: transparent; color: var(--color-text-secondary, rgba(255,255,255,0.78)); padding: 4px 9px; border-radius: 7px; transition: border-color 0.16s, color 0.16s; }
.zs-add:hover { color: var(--zs-hit); border-color: var(--zs-hit); }

.zs-cmd { margin-top: 14px; font-family: var(--font-mono, monospace); font-size: 0.8rem; line-height: 1.5; background: #0c0c0f; border: 1px solid var(--color-border-subtle, rgba(255,255,255,0.08)); border-radius: 9px; padding: 11px 13px; color: var(--zs-cmd); min-height: 1.5em; word-break: break-word; }
.zs-cmd .zs-ret { color: var(--zs-hit); }
.zs-cmd .zs-prompt { color: var(--color-text-tertiary, rgba(255,255,255,0.4)); }

.zs-caption { margin-top: 12px; font-size: 0.9rem; line-height: 1.55; color: var(--color-text-secondary, rgba(255,255,255,0.78)); min-height: 2.6em; }
.zs-caption b { color: #fff; }
.zs-caption .zs-hl { color: var(--zs-hit); font-weight: 650; }
.zs-noscript { font-size: 0.9rem; color: var(--color-text-secondary, rgba(255,255,255,0.65)); line-height: 1.6; }
