/* Leaderboards (leaders.js) at /top: the rating first, the free play's boards in the other tab. Same rules as the app:
   one field colour, white ink, gold for the first place only, no shadows, rounded corners or transparency.
   Phone, and the sheet anywhere: one column. The rating: the four cards two by two, your league, the filters, the
   table. The boards: two by two, your place above the table. Computer (html.desk), on a page of its own: the rating's
   cards in a row over the table, your league and the rules beside it; the boards in a column at the start, the table
   in the middle, your place and the rules at the end from 1280 px, under the boards below. */
.lead-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 1440px; margin: 0 auto; }
.lead, .rate { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.lead-boards { order: 2; }
.lead-side { display: contents; }
.lead-you { order: 3; }
.lead-main { order: 4; }
.lead-rule { order: 5; }
.lead-play { order: 6; }

/* The page's Back on a phone and a tablet (leaders.js): before the title, as the sheet's is. A computer's header
   leads everywhere instead. */
.lead-top { display: flex; align-items: center; gap: 8px; }
.lead-back { flex: none; margin-inline-start: -6px; }
.desk .lead-back { display: none; }
.lead-h { margin: 0; font: 700 34px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.lead-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; }
/* In the sheet its title already names the page. */
.sh-body .lead-h { display: none; }
.sh-body .lead-sub { margin-top: 0; }

/* The two views, the rating and the free play's boards. */
.lead-views { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; background: var(--field-deep); }
.lead-views button { min-width: 0; height: 42px; padding: 0 10px; font: 700 17px/1 var(--display); letter-spacing: .03em; text-transform: uppercase;
                     color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-views [aria-selected="true"] { background: var(--ink); color: var(--field-deep); }
.lead-views button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.lead-boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.lead-boards button { min-width: 0; padding: 10px 12px 12px; background: var(--field-deep); text-align: start; }
.lead-boards b { display: block; font: 700 20px/1.05 var(--display); letter-spacing: .02em; text-transform: uppercase; overflow-wrap: anywhere; }
.lead-boards small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 13px; line-height: 1.25; }
.lead-boards [aria-selected="true"] { background: var(--ink); color: var(--field-deep); }
.lead-boards [aria-selected="true"] small { color: var(--field-tint); }

.lead-opts { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.lead-opts:empty { display: none; }
.lead-chips { display: flex; gap: 2px; padding: 2px; background: var(--field-deep); }
.lead-chips button { height: 36px; padding: 0 12px; font: 700 12px/1 var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.lead-chips [aria-pressed="true"] { background: var(--ink); color: var(--field-deep); }

.lead-list { min-height: 160px; }
.lead-list[aria-busy="true"] .lead-rows { opacity: .6; }
.lead-th, .lead-rows li { display: grid; grid-template-columns: 40px 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.lead-th { padding: 0 10px 6px; color: var(--ink-muted); font-size: 11px; }
.lead-th span:first-child, .lead-th span:last-child { text-align: end; }
.lead-rows { list-style: none; margin: 0; padding: 0; }
.lead-rows li { padding: 9px 10px; border-bottom: 1px solid var(--field-tint); font-variant-numeric: tabular-nums; }
.lead-rows em { font: 700 18px/1 var(--display); font-style: normal; text-align: end; color: var(--ink-muted); }
.lead-rows b { font: 700 21px/1 var(--display); letter-spacing: .02em; text-align: end; }
.lead-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* The name, and in the rating the league and the days under it. */
.lead-w { min-width: 0; }
.lead-w .lead-n { display: block; }
.lead-w small { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); font-size: 12px; }
.lead-rows li.me .lead-w small { color: var(--field); }
.lead-n[data-u] { cursor: pointer; }
/* A face as in the day's table: a photo, a letter, or the plain one of "Anonymous". */
.lead-a { width: 26px; height: 26px; }
.lead-a .av { width: 26px; height: 26px; font: 700 15px/1 var(--display); outline: 0; }
.lead-rows li.me .lead-a .av { background: var(--field); color: var(--ink); }
.lead-n[data-u]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.lead-rows li.m1 em, .lead-rows li.m1 b { color: var(--speed); }
.lead-rows li.me { background: var(--ink); color: var(--field-deep); }
.lead-rows li.me em, .lead-rows li.me b { color: var(--field-deep); }
/* A rank that skips ahead: a dashed line says there are rows between. */
.lead-rows li.skip { margin-top: 12px; border-top: 1px dashed var(--field-tint); }
.lead-count { margin: 10px 0 0; color: var(--ink-muted); font-size: 13px; }
.lead-wait { margin: 8px 0 12px; color: var(--ink-soft); }
.lead-retry { padding: 10px 14px; background: var(--field-deep); font: 700 13px/1 var(--label); letter-spacing: .08em; text-transform: uppercase; }

.lead-you { padding: 12px; background: var(--field-deep); }
.lead-you .up { display: block; color: var(--ink-muted); font-size: 11px; letter-spacing: .08em; }
.lead-you b { display: block; margin-top: 6px; font: 700 28px/1 var(--display); letter-spacing: .02em; }
.lead-you small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 13px; }
.lead-you .lead-wait { margin: 0; }
.lead-rule { margin: 0; color: var(--ink-soft); font-size: 14px; }
/* "a.lead-play" under its view outweighs the links of a page shell (desktop.css's .dk-page a), which would paint it in --ink-soft. */
.lead a.lead-play, .rate a.lead-play { display: flex; align-items: center; justify-content: center; height: 48px; background: var(--panel); color: var(--on-panel);
                    font: 700 15px/1 var(--label); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }

/* The profile's places, each a way to its board. */
.lead-places li { padding: 0; }
.lead-at { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 9px 2px; text-align: start; }
.lead-at span { min-width: 0; }
.lead-at small { display: block; margin-top: 2px; color: var(--ink-muted); font-size: 12px; }
.lead-at b { flex: none; }
.lead-at b.gold { color: var(--speed); }

@media (hover: hover) {
  .lead-boards button:not([aria-selected="true"]):hover, .lead-chips button:not([aria-pressed="true"]):hover { color: var(--ink); background: var(--field-tint); }
  .lead-rows li:not(.me):hover { background: var(--field-deep); }
  .lead a.lead-play:hover, .rate a.lead-play:hover { background: var(--ink-soft); color: var(--on-panel); }
  .lead-at:hover span { text-decoration: underline; }
}

/* ---------- Computer ---------- */
/* On a page of its own (.lead-wide, not the sheet) the table spans the rows beside the boards and your place; the
   last row takes its height, so your place stays right under the boards. */
html.desk .lead-page.wide { gap: 24px; }
html.desk .lead-page.wide .lead-h { font-size: 40px; }
html.desk .lead-page.wide .lead-views { max-width: 560px; }
html.desk .lead-wide { grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "boards main" "side main";
                       gap: 24px; align-items: start; }
html.desk .lead-wide > * { order: 0; }
html.desk .lead-wide .lead-boards { grid-area: boards; grid-template-columns: minmax(0, 1fr); }
html.desk .lead-wide .lead-boards button { padding: 14px 16px; }
html.desk .lead-wide .lead-boards b { font-size: 24px; }
html.desk .lead-wide .lead-main { grid-area: main; }
html.desk .lead-wide .lead-side { grid-area: side; display: grid; gap: 14px; align-content: start; }
html.desk .lead-wide .lead-you { padding: 20px; }
html.desk .lead-wide .lead-you b { font-size: 34px; }
html.desk .lead-wide .lead-rows li { padding: 11px 14px; }
html.desk .lead-wide .lead-th, html.desk .lead-wide .lead-rows li { grid-template-columns: 44px 32px minmax(0, 1fr) auto; gap: 14px; }
html.desk .lead-wide .lead-a, html.desk .lead-wide .lead-a .av { width: 32px; height: 32px; }
html.desk .lead-wide .lead-a .av { font-size: 18px; }
html.desk .lead-wide .lead-th { padding: 0 14px 8px; }
@media (min-width: 1280px) {
  html.desk .lead-wide { grid-template-columns: 280px minmax(0, 1fr) 300px; grid-template-rows: auto; grid-template-areas: "boards main side"; }
}
@media (min-width: 1440px) {
  html.desk .lead-wide { grid-template-columns: 320px minmax(0, 1fr) 340px; gap: 32px; }
}

/* ---------- The rating ---------- */
.rate-cards { order: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.rate-side { display: contents; }
.rate .lead-you { order: 2; }
.rate-main { order: 3; min-width: 0; }
.rate .lead-rule { order: 4; }
.rate .lead-play { order: 5; }

.rate-card { min-width: 0; padding: 10px 12px 12px; background: var(--field-deep); }
.rate-card .up { display: block; color: var(--ink-muted); font-size: 11px; line-height: 1.25; letter-spacing: .08em; overflow-wrap: anywhere; }
.rate-cp { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 8px; }
.rate-cp .lead-a { flex: none; }
.rate-cp .lead-a .av:not(.ph) { background: var(--field-tint); color: var(--ink); }
.rate-cp .lead-n { font: 700 18px/1.1 var(--display); letter-spacing: .02em; }
.rate-card small { display: block; margin-top: 6px; color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.rate-card.none .lead-n { color: var(--ink-muted); }

/* The filters: the period and the circle as buttons, the league and the order as lists side by side. */
.rate-opts { gap: 8px; }
/* The period and the circle span the width in equal parts; a long name takes two lines rather than the screen's edge. */
.rate-opts .lead-chips { flex: 1 1 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.rate-opts .lead-chips button { height: auto; min-height: 36px; padding: 6px; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
.rate-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; flex: 1 1 100%; }
.rate-pick { position: relative; display: block; min-width: 0; background: var(--field-deep); }
.rate-pick span { position: absolute; inset-inline-start: 12px; top: 6px; color: var(--ink-muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.rate-pick select { width: 100%; height: 44px; padding: 16px 30px 0 12px; padding-inline: 12px 30px; border: 0; border-radius: 0; background: transparent;
                    color: var(--ink); font: 700 13px/1 var(--label); letter-spacing: .06em; text-transform: uppercase; appearance: none; -webkit-appearance: none; cursor: pointer; }
.rate-pick select option { background: var(--field-deep); color: var(--ink); text-transform: none; }
.rate-pick::after { content: ""; position: absolute; inset-inline-end: 12px; top: 50%; width: 7px; height: 7px; margin-top: -2px;
                    border: solid var(--ink-soft); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.rate-pick select:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Your league and how far the next one is. */
.rate-bar { display: block; height: 6px; margin-top: 10px; background: var(--field-tint); }
.rate-bar i { display: block; height: 100%; background: var(--ink); }
.rate .lead-you small + small { margin-top: 2px; }
.rate-rows li { padding-block: 8px; }

/* A narrow phone gives the name its room: a smaller place column and gaps. */
@media (max-width: 360px) {
  .lead-th, .lead-rows li { grid-template-columns: 28px 26px minmax(0, 1fr) auto; gap: 8px; }
  .lead-rows li, .lead-th { padding-inline: 6px; }
}

@media (hover: hover) {
  .lead-views button:not([aria-selected="true"]):hover { color: var(--ink); background: var(--field-tint); }
  .rate-pick:hover { background: var(--field-tint); }
}

/* On a computer's page: the cards in a row, the table and beside it your league and the rules. */
html.desk .rate-wide { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "cards cards" "main side"; gap: 24px; align-items: start; }
html.desk .rate-wide > * { order: 0; }
html.desk .rate-wide .rate-cards { grid-area: cards; grid-template-columns: repeat(4, minmax(0, 1fr)); }
html.desk .rate-wide .rate-card { padding: 14px 16px 16px; }
html.desk .rate-wide .rate-cp .lead-n { font-size: 22px; }
html.desk .rate-wide .rate-main { grid-area: main; }
html.desk .rate-wide .rate-side { grid-area: side; display: grid; gap: 14px; align-content: start; }
html.desk .rate-wide .lead-you { padding: 20px; }
html.desk .rate-wide .lead-you b { font-size: 34px; }
html.desk .rate-wide .rate-opts .lead-chips { flex: 0 1 auto; grid-auto-columns: auto; }
html.desk .rate-wide .rate-opts .lead-chips button { padding: 0 12px; white-space: nowrap; }
html.desk .rate-wide .rate-lists { flex: 1 1 100%; max-width: 480px; }
html.desk .rate-wide .lead-rows li { padding: 10px 14px; }
html.desk .rate-wide .lead-th, html.desk .rate-wide .lead-rows li { grid-template-columns: 44px 32px minmax(0, 1fr) auto; gap: 14px; }
html.desk .rate-wide .lead-a, html.desk .rate-wide .lead-a .av { width: 32px; height: 32px; }
html.desk .rate-wide .lead-a .av { font-size: 18px; }
html.desk .rate-wide .lead-th { padding: 0 14px 8px; }
@media (min-width: 1440px) {
  html.desk .rate-wide { grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; }
}
