/* The rating badge, My record and the lobby filter. Colors come from the page's --sw-* roles, so a theme restyles all of
   it, and nothing here names a title. Laid out to fit 375 px. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The badge: level, rating, a marker while provisional, and the count of games. */
.rating-badge {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .1rem .5rem;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: var(--sw-raised);
  color: var(--sw-on-raised);
  font-family: var(--sw-body);
  font-size: .85rem;
  line-height: 1.4;
}
.rating-badge .rating-level { font-weight: 700; }
.rating-badge .rating-number { font-variant-numeric: tabular-nums; }
.rating-badge .rating-provisional { color: var(--sw-caution); font-weight: 700; }
.rating-badge .rating-games { color: var(--sw-muted); }
.rating-badge[data-rank="0"] .rating-level { color: var(--sw-muted); font-weight: 600; }

/* My record */
.my-record { font-family: var(--sw-body); color: var(--sw-on-surface); max-width: 48rem; margin-inline: auto; padding: .5rem; }
.my-record h2 { font-family: var(--sw-display); font-size: 1.2rem; margin: 1rem 0 .4rem; }
.my-record h2:focus { outline: 2px solid var(--sw-focus); outline-offset: 2px; }
.my-record h3 { font-size: .95rem; margin: .4rem 0 .2rem; text-transform: capitalize; }
.my-record button { font: inherit; min-height: 2.75rem; padding: .3rem .8rem; border-radius: var(--sw-radius); border: 1px solid var(--sw-border); background: var(--sw-action); color: var(--sw-on-action); cursor: pointer; }
.my-record button:focus-visible, .my-record .record-scroll:focus-visible, .lobby-filter :focus-visible { outline: 2px solid var(--sw-focus); outline-offset: 2px; }
.my-record .record-hint, .my-record .record-last { color: var(--sw-muted); margin: .25rem 0; }
.my-record .record-error { color: var(--sw-danger); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.record-rating { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .5rem 0; border-bottom: 1px solid var(--sw-border); }
.record-rating .record-hint { flex-basis: 100%; }
.record-spark { width: 10rem; height: 2.5rem; flex: none; }
.record-spark .spark-line { fill: none; stroke: var(--sw-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.record-spark .spark-end { fill: var(--sw-accent); }

.record-scroll { overflow-x: auto; margin: .5rem 0; max-width: 100%; }
.record-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.record-table caption { text-align: left; font-weight: 700; padding: .25rem 0; }
.record-table th, .record-table td { padding: .3rem .5rem; text-align: right; border-bottom: 1px solid var(--sw-border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.record-table th:first-child, .record-table td:first-child { text-align: left; }
.record-table thead th { color: var(--sw-muted); font-weight: 600; }
.record-table tr[data-you="true"] { background: var(--sw-raised); color: var(--sw-on-raised); font-weight: 700; }

/* A finished game is one button, a few lines that wrap on a phone. */
.record-games { list-style: none; margin: 0; padding: 0; }
.record-game + .record-game { margin-top: .4rem; }
.record-open { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; width: 100%; text-align: left; background: var(--sw-raised) !important; color: var(--sw-on-raised) !important; }
.record-open .record-when { color: var(--sw-muted); }
.record-open .record-what { grid-column: 1; font-weight: 700; }
.record-open .record-place { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; }
.record-open .record-place[data-outcome="won"] { color: var(--sw-positive); }
.record-open .record-place[data-outcome="left"] { color: var(--sw-caution); }
.record-open .record-score, .record-open .record-others { color: var(--sw-muted); }
.record-open .record-change { grid-column: 2; grid-row: 2; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.record-open .record-change[data-sign="1"] { color: var(--sw-positive); }
.record-open .record-change[data-sign="-1"] { color: var(--sw-caution); }
.record-open .record-others { grid-column: 1 / -1; overflow-wrap: anywhere; }
.record-more { margin-top: .6rem; }
.record-figures { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .5rem 0; }
.record-figures dt { color: var(--sw-muted); }
.record-figures dd { margin: 0; font-variant-numeric: tabular-nums; }

/* The lobby filter */
.lobby-filter fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; border: 1px solid var(--sw-border); border-radius: var(--sw-radius); padding: .4rem .7rem; color: var(--sw-on-surface); }
.lobby-filter legend { font-weight: 700; padding: 0 .3rem; }
.lobby-filter select { font: inherit; min-height: 2.75rem; border-radius: var(--sw-radius); border: 1px solid var(--sw-border); background: var(--sw-raised); color: var(--sw-on-raised); }
.lobby-filter .lobby-filter-check { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; }
.lobby-filter input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--sw-action); }
.lobby-filter .lobby-filter-count { flex-basis: 100%; margin: 0; color: var(--sw-muted); font-size: .85rem; }

@media (prefers-reduced-motion: no-preference) {
  .my-record button, .lobby-filter select { transition: background-color var(--sw-quick) ease; }
}
