/* Head-to-head pages, on top of profile.css: the two-crest hero, the
   mirrored comparison and the game-by-game strip. The side column is the
   profile's own side lists.

   Every picture here would give the result away through its shape, so each
   one is drawn level while its seal is closed: the split bar evenly, the
   comparison bars at one width, the strip's cells unlit. The lit and bright
   states are keyed on `.seal.revealed`, never on the markup alone. */

/* ---------- Hero ---------- */
.h2h-hero {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "a rec b";
  min-height: 300px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r);
}
.h2h-hero > .h2h-side:first-child { grid-area: a; }
.h2h-hero > .h2h-side:last-child { grid-area: b; }
.h2h-side {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px 16px; min-width: 0; text-align: center;
  background: var(--deep); color: var(--text);
}
.h2h-side:hover .h2h-name { color: var(--bright); text-decoration: underline; text-underline-offset: 4px; }
.h2h-crest {
  width: 128px; height: 128px; flex: none; border-radius: var(--r); overflow: hidden;
  display: grid; place-items: center; background: var(--panel2);
  font-size: 54px; font-weight: 700; letter-spacing: -0.04em; color: #fff;
}
.h2h-crest.h0 { background: var(--m0); } .h2h-crest.h1 { background: var(--m1); }
.h2h-crest.h2 { background: var(--m2); } .h2h-crest.h3 { background: var(--m3); }
.h2h-crest.h4 { background: var(--m4); } .h2h-crest.h5 { background: var(--m5); }
.h2h-crest.h6 { background: var(--m6); } .h2h-crest.h7 { background: var(--m7); }
.h2h-crest.has-img { background: var(--panel2); }
.h2h-crest img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h2h-name {
  font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--bright);
  max-width: 100%; overflow-wrap: anywhere;
}
.h2h-ctx { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.h2h-rec {
  grid-area: rec; min-width: 0; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border-left: 1px solid var(--rule); border-right: 1px solid var(--rule);
}
.h2h-score { display: flex; align-items: center; gap: 18px; }
.h2h-score .n {
  font-size: 88px; font-weight: 700; line-height: 1; letter-spacing: -0.04em;
  color: var(--faint); font-variant-numeric: tabular-nums;
}
.h2h-score .n.is-lead { color: var(--bright); }
/* One bar size whatever the score, so a sealed 11 and a sealed 3 match. */
.h2h-score .seal { min-width: 1.25em; text-align: center; }
.h2h-score .dash { font-size: 30px; color: var(--faint); }
.h2h-split { width: 220px; height: 6px; display: flex; gap: 2px; }
.h2h-split i { flex: var(--a); background: var(--b-mid); border-radius: 2px 0 0 2px; }
.h2h-split i + i { flex: var(--b); border-radius: 0 2px 2px 0; }
.h2h-split i.is-lead { background: var(--b-podium); }
.h2h-rec:has(.h2h-score .seal:not(.revealed)) .h2h-split i { flex: 1; background: var(--bar); }
.h2h-split[style*="--a:0;--b:0"] i { flex: 1; }
.h2h-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.h2h-never { font-size: 22px; font-weight: 700; color: var(--text); }

/* ---------- Mirrored comparison ---------- */
.h2h-rows { padding: 6px 16px 10px; }
.h2h-row {
  display: flex; align-items: center; gap: 12px; min-height: 46px;
  border-bottom: 1px solid var(--line);
}
.h2h-row:last-child { border-bottom: 0; }
.h2h-row .v {
  width: 60px; flex: none; font-family: var(--mono); font-size: 15px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.h2h-row .v.is-a { text-align: right; }
.h2h-row .v .seal { min-width: 44px; }
.h2h-row .bar { flex: 1; height: 8px; display: flex; background: var(--panel2); border-radius: 2px; }
.h2h-row .bar.is-a { justify-content: flex-end; }
.h2h-row .bar i { display: block; height: 100%; width: var(--w); background: var(--b-mid); border-radius: 2px; }
.h2h-row .lab { width: 140px; flex: none; text-align: center; line-height: 1.3; }
.h2h-row .note {
  display: block; margin-top: 2px; font-size: 9px; letter-spacing: 0.04em;
  text-transform: none; color: var(--faint);
}
.h2h-row.lead-a .v.is-a, .h2h-row.lead-b .v.is-b { color: var(--bright); }
.h2h-row.lead-a .bar.is-a i, .h2h-row.lead-b .bar.is-b i { background: var(--b-podium); }
.h2h-row:has(.seal:not(.revealed)) .bar i { width: 70%; background: var(--bar); }

/* ---------- Game by game ---------- */
.h2h-strip-body { display: flex; gap: 4px; padding: 16px; }
.h2h-strip-names {
  width: 96px; flex: none; display: flex; flex-direction: column; gap: 4px;
}
.h2h-strip-names span {
  height: 34px; display: flex; align-items: center; min-width: 0;
  font-size: 12px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.h2h-strip-names .cuplab, .h2h-strip-cup .cuplab { height: 16px; }
.h2h-strip-scroll { flex: 1; min-width: 0; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: thin; }
.h2h-strip-cup { display: flex; flex-direction: column; gap: 4px; }
.h2h-strip-cup .cuplab {
  display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); line-height: 16px;
  /* Never wider than the games under it: the columns set the width. */
  width: 0; min-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.h2h-strip-cup .cuplab:hover { color: var(--bright); }
.h2h-strip-stages { display: flex; gap: 4px; }
.h2h-strip-stage { display: flex; flex-direction: column; }
.h2h-strip-cols { display: flex; gap: 4px; }
.h2h-col { flex: 1; min-width: 28px; display: flex; flex-direction: column; gap: 4px; }
.h2h-col .c {
  height: 34px; border-radius: var(--r); display: grid; place-items: center;
  font-family: var(--mono); font-size: 13px; color: var(--muted); background: var(--panel2);
  position: relative;
}
.h2h-col .c .seal { position: static; display: grid; place-items: center; width: 100%; height: 100%; }
.h2h-col .c .seal-bar { border-radius: var(--r); }
.h2h-col:has(.seal.revealed).lead-a .c.is-a,
.h2h-col:has(.seal.revealed).lead-b .c.is-b { background: var(--b-podium); color: var(--ground); font-weight: 600; }
.h2h-strip-stage .stagelab {
  margin-top: 8px; padding-left: 6px; border-left: 1px solid var(--bar);
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: 0; min-width: 100%;
}

/* ---------- Side column ---------- */
.h2h-pick form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.h2h-pick .fld { display: flex; flex-direction: column; gap: 6px; }
.h2h-pick select, .h2h-pick .fixed {
  height: 34px; background: var(--ground); border: 1px solid var(--bar); border-radius: var(--r);
  color: var(--text); padding: 0 10px; font: inherit; font-size: 13px; max-width: 100%;
}
.h2h-pick .fixed { display: flex; align-items: center; color: var(--muted); }
.h2h-pick .acts { display: flex; gap: 8px; margin-top: 4px; }
.h2h-pick .acts .rev { padding: 8px 10px; text-align: center; }
.h2h-pick .acts button.rev { flex: 1; }
.pside-row .rgn { flex: none; }
.h2h-people .dot { width: 6px; height: 6px; border-radius: 1px; flex: none; background: var(--muted); }
.h2h-people .dot.h0 { background: var(--m0); } .h2h-people .dot.h1 { background: var(--m1); }
.h2h-people .dot.h2 { background: var(--m2); } .h2h-people .dot.h3 { background: var(--m3); }
.h2h-people .dot.h4 { background: var(--m4); } .h2h-people .dot.h5 { background: var(--m5); }
.h2h-people .dot.h6 { background: var(--m6); } .h2h-people .dot.h7 { background: var(--m7); }
.h2h-people .pside-row { min-height: 38px; }
.h2h-people .n a { color: var(--text); }
.h2h-people .n a:hover { color: var(--bright); }
.h2h-people .sq { display: block; font-size: 11px; font-weight: 400; color: var(--muted); white-space: normal; }
.h2h-people .sq a { color: var(--muted); }
.h2h-people .pside-row:has(.sq) { padding-top: 8px; padding-bottom: 8px; }
.h2h td.name .s { display: block; font-size: 10.5px; color: var(--faint); margin-top: 1px; }

/* ---------- Narrow ---------- */
/* A phone: the two crests side by side, the record under them. */
@media (max-width: 620px) {
  .h2h-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "a b" "rec rec"; min-height: 0;
  }
  .h2h-side { padding: 18px 10px 14px; gap: 8px; }
  .h2h-hero > .h2h-side:first-child { border-right: 1px solid var(--rule); }
  .h2h-crest { width: 72px; height: 72px; font-size: 30px; }
  .h2h-name { font-size: 18px; }
  .h2h-ctx { font-size: 10px; }
  .h2h-rec { border: 0; border-top: 1px solid var(--rule); padding: 18px 16px; gap: 10px; }
  .h2h-score .n { font-size: 64px; }
  .h2h-rows { padding: 4px 12px 8px; }
  .h2h-row { gap: 8px; }
  .h2h-row .v { width: 40px; font-size: 13px; }
  .h2h-row .v .seal { min-width: 32px; }
  .h2h-row .lab { width: 96px; font-size: 9px; letter-spacing: 0.08em; }
  .h2h-strip-body { padding: 12px; }
  .h2h-strip-names { width: 64px; }
  .h2h-strip-names span { font-size: 11px; }
  .h2h-col { min-width: 30px; }
}
