/* AoE tournaments - powered by age4greeks. One small stylesheet, no frameworks.
   Dark "gold on stone" theme after age4greeks.gr; contrast checked for WCAG AA. */
:root {
  --bg: #12110f; --surface: #1b1916; --surface-2: #24211c; --border: #3b352c; --border-strong: #5a5042;
  --text: #ede7dc; --muted: #ada392; --gold: #d39542; --gold-strong: #e9b768; --gold-ink: #1a1206;
  --red: #c23a2f; --good: #7fd59a; --bad: #ff8f85; --info: #8fb8ff;
  --radius: 10px; --shadow: 0 1px 0 rgb(255 255 255 / 3%), 0 6px 18px rgb(0 0 0 / 35%);
  --serif: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* the type scale: steps of 1.2 from the body size; a label is one step under it */
  --t-label: .833rem; --t-3: 1.2rem; --t-2: 1.44rem; --t-1: clamp(1.6rem, 1.15rem + 1.9vw, 2.488rem);
  --measure: 75ch;  /* the longest line of running text */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.55;
  font-family: var(--sans);
  background-image: radial-gradient(1200px 400px at 50% -200px, rgb(211 149 66 / 10%), transparent);
  min-height: 100vh; display: flex; flex-direction: column;
}
.wrap { max-width: 140rem; margin: 0 auto; padding: 0 clamp(1rem, 2.5vw, 2.5rem); width: 100%; }  /* the whole window, with breathing room */
a { color: var(--gold-strong); text-underline-offset: 2px; }
a:hover { color: #ffd38f; }
:focus-visible { outline: 3px solid var(--gold-strong); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--gold-ink); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: 1rem; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--t-1); margin: 0 0 .25rem; color: var(--gold-strong); letter-spacing: -.005em; }
h2 { font-size: var(--t-2); margin: 2.25rem 0 .75rem; }
h3 { font-size: var(--t-3); margin: 0 0 .5rem; line-height: 1.3; }
p { margin: .5rem 0; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: var(--measure); overflow-wrap: anywhere; }
/* a note on the page itself keeps a readable line on a wide window; one in a card follows its card */
:where(main, .manage-body, [data-panel]) > p:is(.muted, .hint) { max-width: var(--measure); }
.muted { color: var(--muted); }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.pre { white-space: pre-wrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
main { padding-block: 1rem 4rem; flex: 1; }
main:focus { outline: none; }

/* -- site header ---------------------------------------------------------------------- */
header.site { background: linear-gradient(#0b0a09, #15130f); border-bottom: 2px solid var(--gold); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding-block: .5rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
.brand img { height: 44px; width: auto; display: block; }
.brand span { font-family: var(--serif); font-size: 1.1rem; color: var(--gold-strong); white-space: nowrap; }
nav.site-nav { flex: 1 1 16rem; min-width: 0; }
nav ul { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; }
nav.site-nav a { display: inline-block; padding: .4rem .75rem; border-radius: 999px; color: var(--text); text-decoration: none; }
nav.site-nav a:hover { background: var(--surface-2); }
nav.site-nav a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.account { margin-left: auto; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font-size: .95rem; }
/* I6: the account's menu. Its avatar and name open Profile, API tokens and Sign out, three items that look
   alike (.menu-item, links and the button). A <details>: app.js closes it on Escape, a click elsewhere or
   when the keyboard leaves it */
:is(.account-menu, .lang-menu) { position: relative; }
:is(.account-menu, .lang-menu) > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem;
  padding: .2rem .55rem .2rem .2rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text);
  transition: border-color .15s, background-color .15s; }
:is(.account-menu, .lang-menu) > summary::-webkit-details-marker { display: none; }
:is(.account-menu, .lang-menu) > summary:hover, :is(.account-menu, .lang-menu)[open] > summary { border-color: var(--gold); background: var(--surface-2); }
.account-name { font-weight: 600; font-size: .95rem; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(.account-menu, .lang-menu) > summary .icon { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
:is(.account-menu, .lang-menu)[open] > summary .icon { transform: rotate(180deg); }
.avatar.tiny { width: 28px; height: 28px; border-width: 1px; }
.avatar.tiny.none { font-size: .85rem; }
:is(.account-menu, .lang-menu) .menu { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 30; width: 13rem;
  min-width: 100%; max-width: calc(100vw - 2rem); padding: .35rem; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
:is(.account-menu, .lang-menu)[open] .menu { animation: menu-in .12s ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
:is(.account-menu, .lang-menu) .menu ul { display: grid; gap: 2px; }
:is(.account-menu, .lang-menu) .menu .menu-end { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .3rem; }
.menu-item { display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 2.5rem; padding: .45rem .7rem;
  border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-weight: 500;
  text-align: left; text-decoration: none; cursor: pointer; }
.menu-item .icon { flex: none; color: var(--muted); }
.menu-item:hover, .menu-item[aria-current] { background: var(--surface-2); color: var(--gold-strong); }
.menu-item:hover .icon, .menu-item[aria-current] .icon { color: var(--gold-strong); }
.menu-item[aria-current] { box-shadow: inset 3px 0 0 var(--gold); }
.menu-item:focus-visible { outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  :is(.account-menu, .lang-menu)[open] .menu { animation: none; }
  :is(.account-menu, .lang-menu) > summary .icon { transition: none; }
}
/* I9: the language menu, left of the account menu: the page's flag and code in a pill, opening the
   languages with their flags. It shares the account menu's look and behaviour (above) */
.lang-menu > summary { padding: .2rem .55rem; }
.lang-menu > summary .flag { font-size: 1.15rem; line-height: 1; }
.lang-code { font-size: .85rem; font-weight: 600; letter-spacing: .04em; }
.lang-menu .menu { width: 11rem; }
.lang-menu .menu-item .flag { font-size: 1.2rem; line-height: 1; }

/* -- breadcrumbs ------------------------------------------------------------------------ */
.crumbs { font-size: .9rem; color: var(--muted); padding-block: .75rem .25rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--border-strong); }
.crumbs a { color: var(--muted); }
.crumbs [aria-current="page"] { color: var(--text); font-weight: 600; }

/* -- footer ----------------------------------------------------------------------------- */
footer.site { border-top: 1px solid var(--border); background: #0e0d0b; color: var(--muted); font-size: .9rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: center; justify-content: space-between; padding-block: 1rem; }
.powered { display: flex; align-items: center; gap: .6rem; color: var(--muted); text-decoration: none; }
.powered img { height: 32px; width: auto; }
footer.site ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0; padding: 0; }

/* -- messages --------------------------------------------------------------------------- */
.flash { padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface-2); margin: .75rem 0; }
.flash.error { border-color: var(--bad); background: #2c1614; }
.flash.success { border-color: var(--good); background: #142519; }
.flash.info { border-color: var(--info); background: #151d2b; }
.flash ul { margin: .25rem 0 0; }

/* -- tournament header and tabs ---------------------------------------------------------- */
.t-head { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: end; margin: .5rem 0 0; }
.facts { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 0; padding: 0; list-style: none; }
.tabs { margin: 1rem 0 1.25rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs ul { flex-wrap: nowrap; gap: .25rem; }
.tabs a { display: inline-block; padding: .65rem 1rem; font-size: 1.05rem; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--gold-strong); border-bottom-color: var(--gold); }
.tabs a.manage { color: var(--gold); }
.subnav { margin: -.5rem 0 1rem; }
.subnav ul { gap: .35rem; }
.subnav a { display: inline-block; padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; color: var(--text); font-size: .95rem; }
.subnav a[aria-current="page"] { border-color: var(--gold); background: rgb(211 149 66 / 15%); color: var(--gold-strong); font-weight: 600; }

/* -- manage area: section navigation beside the page -------------------------------------- */
.manage { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.manage-nav { position: sticky; top: 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem; }
.manage-nav p { margin: .25rem .5rem .5rem; font-size: var(--t-label); font-weight: 600; color: var(--muted); }
.manage-nav ul { flex-direction: column; gap: .1rem; }
.manage-nav a { display: block; padding: .45rem .7rem; border-radius: 6px; color: var(--text); text-decoration: none; }
.manage-nav a:hover { background: var(--surface-2); }
.manage-nav a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.manage-body > h2:first-child { margin-top: 0; }
@media (max-width: 52rem) {
  .manage { grid-template-columns: minmax(0, 1fr); }
  .manage-nav { position: static; }
  .manage-nav ul { flex-direction: row; flex-wrap: wrap; }
}

/* -- cards, grids, stats ----------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-block: 1rem; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.grid .table-wrap { margin-block: .5rem; }
.grid th, .grid td { padding: .4rem .6rem; }
.grid > .card { margin: 0; }
/* key numbers keep their size: a few of them don't stretch across the window */
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); margin: 1rem 0 1.5rem; }
@media (min-width: 40rem) { .stats { grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem .85rem; }
.stat .label { display: block; font-size: var(--t-label); font-weight: 600; color: var(--muted); }
.stat .value { font-family: var(--serif); font-size: 1.728rem; line-height: 1.25; color: var(--gold-strong); }
/* a key number that opens what it counts (I6): the whole card is the link, and its focus ring */
/* S9: a player's ladder rank, the first and widest of their key numbers, in its game's colour */
.stat.ladder-rank { grid-column: span 2; border-color: var(--game, var(--gold)); box-shadow: inset 4px 0 0 var(--game, var(--gold)); }
.stat.ladder-rank .value { font-size: 2.488rem; line-height: 1.1; }
.stat.ladder-rank small { color: var(--muted); }
@media (max-width: 40rem) { .stat.ladder-rank { grid-column: 1 / -1; } }  /* a whole row, never a new column */
td.rank-cell strong { color: var(--gold-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Flags are emoji; the font draws them where the system has none (Windows), only for flags */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
  src: url("fonts/TwemojiCountryFlags.woff2") format("woff2");
  font-display: swap;
}
.flag { font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 400; }
.cup { font-weight: 400; white-space: nowrap; }
.cup-silver { filter: grayscale(1) brightness(1.2); }
.stat.link { position: relative; transition: border-color .15s; }
.stat.link:hover { border-color: var(--gold); }
.stat.link a { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.stat.link a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.stat.link a:focus-visible { outline: none; }
.stat.link a:focus-visible::after { outline: 3px solid var(--gold-strong); outline-offset: 2px; }
.stat .go { font-size: .85rem; color: var(--muted); }
.stat .go::after { content: " ›" / ""; }
.stat.link:hover .go { color: var(--gold-strong); text-decoration: underline; text-underline-offset: 2px; }
.hero { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  margin: 1rem 0 1.5rem; background: #000; }
.hero img { display: block; width: 100%; max-height: 320px; object-fit: cover; object-position: 50% 30%; opacity: .85; }  /* wide screens keep the skyline's towers */
.hero .over { position: absolute; inset: auto 0 0 0; padding: 4rem 1.25rem 1rem;
  background: linear-gradient(transparent, rgb(0 0 0 / 80%) 45%, rgb(0 0 0 / 94%)); }
.hero .over .lead { color: #efe8db; text-shadow: 0 1px 3px #000; margin-bottom: 0; max-width: 62ch; }
@media (max-width: 40rem) {  /* small screens: the text under the picture, never on it */
  .hero .over { position: static; background: var(--surface); padding: .9rem 1rem; }
  .hero img { max-height: 180px; }
}
.hero h1 { margin: 0 0 .15rem; font-size: clamp(1.7rem, 1.1rem + 2.6vw, 2.986rem); text-shadow: 0 2px 6px rgb(0 0 0 / 70%); }
.t-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.t-card img { width: 100%; height: 140px; object-fit: cover; display: block; border-bottom: 1px solid var(--border); }
.t-card .body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.t-card h2 { font-size: var(--t-3); margin: 0; }
.t-card .body > p.muted { font-size: .95rem; margin: 0; }
.t-card h2 a { color: var(--text); text-decoration: none; }
.t-card h2 a::after { content: ""; position: absolute; inset: 0; }  /* the whole card is the link */
.t-card { position: relative; }
.t-card:hover { border-color: var(--game, var(--gold)); }  /* the outline takes its game's colour, like the top edge */

/* -- badges and chips -------------------------------------------------------------------- */
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .12rem .6rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); white-space: nowrap;
  letter-spacing: .02em; }
.badge.status { border-color: var(--gold); color: var(--gold-strong); }
.badge.live { border-color: var(--good); color: var(--good); }
.badge.warn { border-color: var(--bad); color: var(--bad); }
.badge.private { border-style: dashed; color: var(--muted); }  /* A11: a private tournament */
.title-line { margin: .75rem 0 0; font-family: var(--serif); color: var(--gold-strong); }
.title-line.tie { color: var(--text); font-family: inherit; }
.chip { display: inline-block; font-size: .8rem; padding: .05rem .5rem; border-radius: 6px; background: #2b2620;
  border: 1px solid var(--border); color: var(--text); white-space: nowrap; margin: .1rem .1rem .1rem 0; }

/* -- tables -------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin-block: .75rem 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-family: var(--serif); font-weight: 700; font-size: 1.05rem; padding: .8rem 1rem .55rem; color: var(--gold-strong); }
caption .muted { font-family: var(--sans); font-weight: 400; font-size: .85rem; }
th, td { padding: .55rem 1rem; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
thead th { border-top: 0; font-size: var(--t-label); color: var(--muted); font-weight: 600; white-space: nowrap;
  background: var(--surface-2); }
tbody tr:nth-child(even) { background: rgb(255 255 255 / 2%); }
tbody tr:hover { background: rgb(211 149 66 / 6%); }
tbody th { font-weight: 600; }
.num { text-align: right; white-space: nowrap; }
.rank { width: 2.5rem; color: var(--muted); }
tr.me { background: rgb(211 149 66 / 14%) !important; }
tr.top > :first-child { box-shadow: inset 3px 0 0 var(--gold); }
.score { font-family: var(--serif); font-weight: 700; color: var(--gold-strong); }
.vs { color: var(--muted); font-size: .85rem; padding: 0 .25rem; }

/* -- forms ------------------------------------------------------------------------------- */
form.card { display: block; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  margin: 0 0 1rem; padding: .75rem 1.25rem 1rem; }
legend { font-family: var(--serif); font-weight: 700; padding: 0 .4rem; color: var(--gold-strong); }
fieldset .hint { margin-top: -.25rem; }
.fields { display: grid; gap: .25rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.fields select { width: auto; min-width: 100%; max-width: 100%; }
.field { margin: .4rem 0; }
.field.wide { grid-column: 1 / -1; }
label { font-weight: 600; }
/* :where() keeps this at element weight, so .score-in, .short, ... can narrow an input */
input:where(:not([type=checkbox]):not([type=radio])), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .65rem; font: inherit; color: var(--text);
  background: #0f0e0c; border: 1px solid var(--border-strong); border-radius: 6px;
}
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 1.05rem; height: 1.05rem; accent-color: var(--gold); vertical-align: middle; margin: 0 .35rem 0 0; }
.check { display: flex; align-items: center; gap: .25rem; margin: .5rem 0; }
.check label { font-weight: 500; }
small, .hint { display: block; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
input.score-in { width: 3.6rem; display: inline-block; text-align: center; margin: 0; padding: .35rem; }
input.short, select.short { width: 8rem; display: inline-block; margin: 0; }
td input:not([type=checkbox]), td select { margin: 0; min-width: 7rem; }
td input.score-in { min-width: 0; width: 3.6rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin: .5rem 0; }
.inline-form .field { margin: 0; }
.inline-form input:not([type=checkbox]):not([type=hidden]), .inline-form select { width: auto; min-width: 12rem; }
button, .button {
  font: inherit; font-weight: 600; padding: .5rem 1.1rem; border-radius: 6px; border: 1px solid var(--gold);
  background: transparent; color: var(--gold-strong); cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: rgb(211 149 66 / 15%); color: #ffd38f; }
button.primary, .button.primary { background: var(--gold); color: var(--gold-ink); }
button.primary:hover, .button.primary:hover { background: var(--gold-strong); color: var(--gold-ink); }
/* One look per kind of button, everywhere: primary (gold), the default (gold outline), danger (red:
   every delete, remove, revoke, disable and clear) and .small for an action in a table's row. */
button.danger, .button.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.danger:hover, .button.danger:hover { background: #a3291f; border-color: #a3291f; color: #fff; }
button.small, .button.small { padding: .25rem .7rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
/* A typed confirmation (confirm_dialog macro): a modal dialog in the middle of the screen. */
dialog.confirm { width: min(30rem, calc(100vw - 2rem)); padding: 1.25rem 1.5rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
dialog.confirm::backdrop { background: rgb(0 0 0 / 65%); }
dialog.confirm h2 { margin: 0 0 .75rem; overflow-wrap: anywhere; }
dialog.confirm label { display: block; line-height: 1.9; overflow-wrap: anywhere; }
/* the name to type, highlighted in gold; one click selects all of it */
dialog.confirm label code { padding: .1rem .45rem; border-radius: 4px; background: var(--gold); color: var(--gold-ink);
  font-weight: 700; -webkit-box-decoration-break: clone; box-decoration-break: clone; user-select: all; }
dialog.confirm input { margin-top: .9rem; }
dialog.confirm .actions { margin: 1.25rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; }
/* One Save per editing page (LOGIC I7): the bar stays visible at the bottom of the screen. */
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
  justify-content: flex-end; padding: .75rem 1rem; margin: 1rem 0 0; background: rgb(18 17 15 / 92%);
  border-top: 1px solid var(--gold); backdrop-filter: blur(4px); }
.savebar .muted { margin-right: auto; }
details.help { margin-block: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem; }
details.help summary { cursor: pointer; font-weight: 600; color: var(--gold-strong); }

/* -- checklist (manage overview) ---------------------------------------------------------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: .75rem; }
.steps > li { counter-increment: step; position: relative; padding: .9rem 1rem .9rem 3.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); }
.steps > li::before { content: counter(step); position: absolute; left: 1rem; top: .9rem; width: 1.6rem; height: 1.6rem;
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2);
  border: 1px solid var(--border-strong); }
.steps > li.done::before { content: "✓"; background: var(--good); color: #0b1a10; border-color: var(--good); }
.steps > li.todo { border-color: var(--gold); }
.steps h3 { margin: 0 0 .25rem; }
.steps ul { margin: .25rem 0; }

/* -- team picker ----------------------------------------------------------------------- */
.picks { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.picks li { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.picks input[type=checkbox] { margin-top: .6rem; flex: none; }
.picks label { display: grid; grid-template-columns: 1fr auto; flex: 1; font-weight: 400; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; padding: .45rem .7rem; background: var(--surface-2); }
.picks input:checked + label { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.picks .name { font-weight: 700; }
.picks .price { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-family: var(--serif); font-weight: 700;
  font-size: 1.2rem; color: var(--gold-strong); }
.picks .meta { color: var(--muted); font-size: .85rem; }
.captain { display: flex; gap: .25rem; align-items: center; white-space: nowrap; font-size: .9rem; }
.captain label { border: 0; padding: 0; background: none; font-weight: 400; display: inline; }
.budget { position: sticky; top: 0; z-index: 3; background: var(--bg); padding-block: .5rem; border-bottom: 1px solid var(--border); }
.budget meter { width: 100%; height: 1rem; }
.budget .problem { color: var(--bad); font-weight: 600; margin: .25rem 0 0; }

.pairs { list-style: none; padding: 0; display: grid; gap: .5rem; }
.pairs select { width: auto; display: inline-block; }
.note { border-top: 1px solid var(--border); padding-top: .5rem; }
.col-short { display: none; }
table.history td.when, table.history td.who { white-space: nowrap; }
table.history td.wide { overflow-wrap: anywhere; }

/* Every table shows all of its information at every width (UI guide): a narrow numeric table
   (.fit) switches to short headings on a phone; a wide one (.stack) turns each row into a card
   of label and value, its row heading on top. */
.table-wrap:has(> table.fit) { container-type: inline-size; }
@container (max-width: 34rem) {
  table.fit th, table.fit td { padding-inline: .4rem; }
  table.fit .col-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; }
  table.fit .col-short { display: inline; }
}
@media (max-width: 40rem) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody, table.stack caption { display: block; }
  table.stack td.when, table.stack td.who { white-space: normal; }
  table.stack tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .45rem .9rem;
    padding: .7rem .9rem; border-top: 1px solid var(--border); }
  table.stack th[scope=row] { grid-row: 1; grid-column: 1 / -1; border: 0; padding: 0; font-size: 1rem; }
  table.stack td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; }
  table.stack td.rank { grid-row: 1; grid-column: 1 / -1; width: auto; }
  table.stack td.rank + th[scope=row] { padding-left: 2rem; }
  table.stack td.wide { grid-column: 1 / -1; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; font-weight: 600;
    color: var(--muted); margin-bottom: .1rem; }
  table.stack td[colspan] { grid-column: 1 / -1; }
  table.stack tr.top { box-shadow: inset 3px 0 0 var(--gold); }
  table.stack tr.top > :first-child { box-shadow: none; }
}

@media (max-width: 40rem) {
  th, td { padding: .45rem .55rem; }
  nav.site-nav { order: 1; flex-basis: 100%; }  /* the tabs get a row of their own, under the logo and the avatar */
  .account-name { max-width: 8rem; }
  .brand span { display: none; }
  .t-head { grid-template-columns: 1fr; }
}
.narrow { max-width: 28rem; }

/* One accent per game (decorative: the game's name is always written next to it) */
.game-aoe1 { --game: #c9a227; }
.game-aoe2 { --game: #d39542; }
.game-aoe3 { --game: #4f8fd6; }
.game-aoe4 { --game: #c4483d; }
.game-aom { --game: #4fb39a; }
.game-line { margin: 0 0 .2rem; font-size: .9rem; font-weight: 600; color: var(--text); }
.game-mark { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .4rem; background: var(--game, var(--gold)); vertical-align: baseline; }
.t-card[class*="game-"] { border-top: 4px solid var(--game, var(--gold)); }

/* -- settings forms: stage cards, conditional and collapsed sections ----------------------- */
fieldset[hidden], .field[hidden] { display: none; }
fieldset.cards, fieldset.checks { border: 0; padding: 0; margin: .4rem 0; background: none; }
fieldset.cards > legend, fieldset.checks > legend { font-family: inherit; color: var(--text); padding: 0; margin-bottom: .4rem; }
.card-choices { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.card-choice { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; align-items: start;
  padding: .75rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
  cursor: pointer; font-weight: 400; }
.card-choice:hover { border-color: var(--gold); }
.card-choice:has(input:checked) { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: rgb(211 149 66 / 10%); }
.card-choice:has(input:focus-visible) { outline: 3px solid var(--gold-strong); outline-offset: 2px; }
.card-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.card-choice .diagram { grid-row: 1 / span 2; width: 3rem; height: 2.4rem; background: center / contain no-repeat; }
.card-choice .title { font-weight: 700; }
.card-choice .note { color: var(--muted); font-size: .88rem; }
.choice-groups .diagram { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 38' fill='%23d39542'%3E%3Ccircle cx='8' cy='8' r='4'/%3E%3Ccircle cx='24' cy='8' r='4'/%3E%3Ccircle cx='40' cy='8' r='4'/%3E%3Ccircle cx='8' cy='30' r='4'/%3E%3Ccircle cx='24' cy='30' r='4'/%3E%3Ccircle cx='40' cy='30' r='4'/%3E%3Cpath d='M8 8 40 30M8 30 40 8M24 8v22' stroke='%23d39542' stroke-width='1.2' opacity='.6'/%3E%3C/svg%3E"); }
.choice-knockout .diagram { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 38' fill='none' stroke='%23d39542' stroke-width='2.4'%3E%3Cpath d='M2 4h12v10H2M2 24h12v10H2M14 9h10v20H14M24 19h12M36 13h10v12H36'/%3E%3C/svg%3E"); }
.choice-groups-knockout .diagram { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 38'%3E%3Cg fill='%23d39542'%3E%3Ccircle cx='5' cy='6' r='3'/%3E%3Ccircle cx='15' cy='6' r='3'/%3E%3Ccircle cx='5' cy='32' r='3'/%3E%3Ccircle cx='15' cy='32' r='3'/%3E%3C/g%3E%3Cpath d='M20 6h8v26h-8M28 19h10M38 13h8v12h-8' fill='none' stroke='%23d39542' stroke-width='2.4'/%3E%3C/svg%3E"); }
fieldset.checks .check { display: inline-flex; margin: .2rem 1.25rem .2rem 0; }
details.more { margin: 1rem 0; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: .25rem 1rem .5rem; }
details.more > summary { cursor: pointer; padding: .5rem 0; font-weight: 700; color: var(--gold-strong); }
details.more[open] > summary { margin-bottom: .25rem; }
.savebar .summary { margin-right: auto; flex: 1 1 18rem; }

/* -- results entry --------------------------------------------------------------------- */
.score-cell { white-space: nowrap; }
.score-cell .dash { display: inline-block; width: 1.25rem; text-align: center; color: var(--muted); }
tr .state { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .5rem;
  border: 1px solid var(--border-strong); vertical-align: middle; }
tr.played .state { background: var(--good); border-color: var(--good); }

/* -- progress and trends ----------------------------------------------------------------- */
progress { width: 100%; height: .45rem; margin-top: .4rem; appearance: none; border: 0; border-radius: 999px;
  background: var(--surface-2); overflow: hidden; display: block; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--gold); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 999px; }
.up { color: var(--good); }
.down { color: var(--bad); }
.chip.up { border-color: rgb(127 213 154 / 45%); }
.chip.down { border-color: rgb(255 143 133 / 45%); }
.game-chip { display: inline-flex; align-items: center; font-size: .8rem; font-weight: 700; padding: .1rem .55rem;
  border-radius: 999px; border: 1px solid var(--game, var(--border-strong)); }
.card-line { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0; }

/* -- win chances: heat grid and match bars ---------------------------------------------------- */
.heat-0 { background: rgb(211 149 66 / 0%); } .heat-1 { background: rgb(211 149 66 / 4%); }
.heat-2 { background: rgb(211 149 66 / 8%); } .heat-3 { background: rgb(211 149 66 / 12%); }
.heat-4 { background: rgb(211 149 66 / 16%); } .heat-5 { background: rgb(211 149 66 / 20%); }
.heat-6 { background: rgb(211 149 66 / 25%); } .heat-7 { background: rgb(211 149 66 / 30%); }
.heat-8 { background: rgb(211 149 66 / 35%); } .heat-9 { background: rgb(211 149 66 / 40%); }
.heat-10 { background: rgb(211 149 66 / 45%); font-weight: 700; }
table.matrix { width: auto; }
table.matrix th[scope=col] { vertical-align: bottom; font-size: .82rem; padding: .4rem .3rem; }
table.matrix .vert { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 9rem;
  overflow: hidden; text-overflow: ellipsis; display: inline-block; }
table.matrix td { text-align: center; min-width: 3.4rem; padding: .4rem .3rem; }
table.matrix td.self { color: var(--border-strong); background: var(--surface-2); }
.wdl { display: inline-flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.wdl svg { width: 5.5rem; height: .5rem; border-radius: 999px; overflow: hidden; flex: none; }
.wdl .w { fill: #5fae78; } .wdl .d { fill: #6f6758; } .wdl .l { fill: #c96b62; }

/* -- the bracket: one column per round, lines drawn between the matches -------------------- */
.bracket-card { margin: 1rem 0 1.5rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); }
.bracket-card > h3 { color: var(--gold-strong); }
.bracket-wrap { overflow-x: auto; padding: .25rem .1rem .5rem; }
.bracket, .bracket ol { list-style: none; margin: 0; padding: 0; }
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(12.5rem, 1fr); gap: 0 2.25rem; min-width: min-content; }
.bracket .round { display: flex; flex-direction: column; }
.bracket h4 { font-size: var(--t-label); font-weight: 600; color: var(--muted); margin: 0 0 .5rem;
  white-space: nowrap; font-family: inherit; }
.bracket .slots { flex: 1; display: flex; flex-direction: column; }
.bracket .pair { flex: 1; display: flex; position: relative; }
.bracket .pair > ol { flex: 1; display: flex; flex-direction: column; }
.bracket .slot { flex: 1; display: flex; align-items: center; position: relative; padding: .35rem 0; }
.bracket .pair::after { content: ""; position: absolute; right: -1.125rem; top: 25%; bottom: 25%; width: 1.125rem;
  border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 6px 6px 0; }
.bracket .round:not(:first-child) .slot::before { content: ""; position: absolute; left: -1.125rem; top: 50%; width: 1.125rem;
  border-top: 1px solid var(--border-strong); }
.bracket .round:not(.champion-col) .slots.final > .slot::after { content: ""; position: absolute; right: -1.125rem; top: 50%;
  width: 1.125rem; border-top: 1px solid var(--border-strong); }
.bracket .game { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.bracket .game.played { border-color: var(--border-strong); }
.bracket .game.champion { border-color: var(--gold); background: rgb(211 149 66 / 12%); }
.bracket .side { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .35rem .6rem;
  border-left: 3px solid transparent; }
.bracket .side + .side { border-top: 1px solid var(--border); }
.bracket .side.won { font-weight: 700; border-left-color: var(--gold); }
.bracket .side.lost { color: var(--muted); }
.bracket .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bracket .pts { font-family: var(--serif); font-weight: 700; color: var(--gold-strong); }
.bracket .odds { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bracket .tag { display: block; font-size: .72rem; color: var(--muted); padding: 0 .6rem .3rem; }
.bracket .side .tag { display: inline; padding: 0; }
.bracket .game.empty, .bracket .game.bye { border-style: dashed; }
.check { flex-wrap: wrap; }
.check .check-help { flex-basis: 100%; margin: 0 0 0 1.4rem; }
/* Scrolling boxes contain their absolutely placed children (the visually hidden labels), or
   those would escape the scroll box and widen the whole page on a phone. */
.table-wrap, .bracket-wrap, .tabs { position: relative; }
fieldset { min-width: 0; }  /* browsers default to min-content, which can widen a phone page */
@media (max-width: 40rem) {  /* the sticky save bar stays small on a phone */
  .savebar { padding: .45rem .75rem; gap: .35rem .75rem; }
  .savebar > .muted, .savebar .summary { flex-basis: 100%; font-size: .78rem; line-height: 1.3; margin: 0; }
}

/* -- groups: a division at a time, Players / Fixtures tabs, fixtures by round (T14) -------- */
details.division { margin: 0 0 1.25rem; }
details.division > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline;
  gap: .25rem .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
details.division > summary::-webkit-details-marker { display: none; }
details.division > summary::before { content: "▾"; color: var(--gold); width: 1rem; display: inline-block; }
details.division:not([open]) > summary::before { content: "▸"; }
details.division > summary h2 { margin: 0; display: inline; }
.tabs.inner { margin: .5rem 0 1rem; }
.tabs.inner a { padding: .4rem .75rem; font-size: .95rem; border-bottom-width: 2px; }  /* a view inside a tab: a step smaller */
.group-block > h3 { margin-top: 1rem; }
.round-jump { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .25rem 0 .75rem; }
.round-jump .chip { text-decoration: none; min-width: 2rem; text-align: center; font-weight: 700; color: var(--text); }
.round-jump .chip.done { border-color: rgb(127 213 154 / 50%); color: var(--good); }
.round-jump .chip.next { border-color: var(--gold); background: rgb(211 149 66 / 18%); color: var(--gold-strong); }
.rounds { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.round-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  scroll-margin-top: 1rem; }
.round-card.next { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.round-card.complete caption { color: var(--muted); }
.round-card table th, .round-card table td { padding: .4rem .75rem; }
.round-card tr.maps-row td { border-top: 0; padding-top: 0; font-size: .85rem; }
.round-card .rests { margin: 0; padding: .4rem .75rem .6rem; border-top: 1px solid var(--border); font-size: .88rem; }
tr.round-row th { background: var(--surface-2); color: var(--gold-strong); font-family: var(--serif); font-size: .95rem; }
.round-card .rests.twice { color: var(--bad); border-top: 1px solid var(--border); }


/* -- one division and one view at a time (Competition, Statistics) ------------------------ */
.viewbar { position: sticky; top: 0; z-index: 4; background: var(--bg); padding: .5rem 0 0; margin-bottom: .5rem;
  border-bottom: 1px solid var(--border); }
.viewbar .subnav.pills { margin: 0 0 .25rem; }
.viewbar .tabs.inner { margin: 0; border-bottom: 0; }
.subnav.fixture-filter { margin: .5rem 0 0; }
/* The home list's heading and its filter button share a row: the heading at the start, the button,
   an icon, at the end, at every width. Its choices are a menu over the page, like the account menu,
   so opening it moves nothing */
.list-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; margin: 2.25rem 0 .75rem; }
.list-head > h2 { margin: 0; }
details.filters { position: relative; }
details.filters > summary { list-style: none; position: relative; display: grid; place-items: center; width: 2.5rem;
  height: 2.5rem; padding: 0; cursor: pointer; }
details.filters > summary::-webkit-details-marker { display: none; }
details.filters[open] > summary { background: rgb(211 149 66 / 15%); }
/* a filter is on: a gold count on the button's corner, read without opening it */
.filter-count { position: absolute; top: -.4rem; right: -.4rem; display: grid; place-items: center; min-width: 1.15rem;
  height: 1.15rem; padding: 0 .25rem; border-radius: 999px; background: var(--gold); color: var(--gold-ink);
  font-size: .72rem; font-weight: 700; box-shadow: 0 0 0 2px var(--bg); }
details.filters .menu { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 30; width: 15rem;
  max-width: calc(100vw - 2rem); padding: .35rem; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); }
details.filters[open] .menu { animation: menu-in .12s ease-out; }
details.filters .menu ul { display: grid; gap: 2px; }
details.filters .filter-name { margin: .2rem .7rem .3rem; font-size: var(--t-label); font-weight: 600; color: var(--muted); }
details.filters .menu-item .muted { margin-left: auto; font-weight: 400; }
@media (prefers-reduced-motion: reduce) { details.filters[open] .menu { animation: none; } }
.panel-title { margin: 1.25rem 0 .75rem; font-size: var(--t-3); }
.panel-title .muted { font-family: var(--sans); font-size: .9rem; font-weight: 400; }
[data-panel][hidden] { display: none; }
.grid.wide-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); align-items: start; }
.grid.wide-cards > .table-wrap { margin: 0; }

/* -- games of a finished match (T15): the map in the colour of its winner, who is named -- */
.chip.game { border-width: 1px 1px 1px 4px; }
.chip.game .by { color: var(--text); opacity: .85; font-size: .75rem; }
.chip.game.win-a { border-color: rgb(57 135 229 / 45%); border-left-color: #3987e5; background: rgb(57 135 229 / 16%); }
.chip.game.win-b { border-color: rgb(217 89 38 / 45%); border-left-color: #d95926; background: rgb(217 89 38 / 16%); }
.side-a-name::before, .side-b-name::before, .legend-games .key { content: ""; display: inline-block; width: .55rem;
  height: .55rem; border-radius: 2px; margin-right: .3rem; vertical-align: baseline; }
.side-a-name::before, .legend-games .key.side-a { background: #3987e5; }
.side-b-name::before, .legend-games .key.side-b { background: #d95926; }
.legend-games { margin-left: auto; font-size: .8rem; }
.map-picks .key { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 2px;
  margin: 0 .25rem 0 .5rem; }
.map-picks .key.side-a { background: #3987e5; }
.map-picks .key.side-b { background: #d95926; }

/* -- editing a match in the fixtures (admins): a result select and one chip per map ------- */
.edit-row td { padding-top: 0; }
.match-edit summary { cursor: pointer; font-size: .85rem; color: var(--gold-strong); width: max-content; }
.match-form { display: grid; gap: .6rem; padding: .6rem 0 .25rem; }
.match-form .field { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.match-form select { width: auto; }
.map-picks { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.map-picks legend { font-family: inherit; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: .35rem;
  padding: 0; }
.map-pick [hidden] { display: none; }
.match-form select { max-width: 100%; }
.map-pick { display: inline-flex; align-items: center; gap: .35rem; }
.chip.pick { cursor: pointer; font: inherit; font-size: .85rem; padding: .3rem .65rem; min-height: 2.25rem; color: var(--text); }
.chip.pick:not(.win-a):not(.win-b) .by { opacity: .6; }
.match-form .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 0; }
.legend-games .key { margin-left: .5rem; }

/* -- charts: bars in HTML (crisp labels; the CSP allows no inline widths, hence pw-N) ---- */
figure.chart { margin: 0 0 1.25rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); }
figure.chart figcaption { font-family: var(--serif); font-weight: 700; color: var(--gold-strong); margin-bottom: .6rem; }
figure.chart figcaption .muted { font-family: var(--sans); font-weight: 400; font-size: .85rem; }
.hbars, .stacks { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.hbars li, .stacks li { display: grid; grid-template-columns: minmax(7rem, 14rem) minmax(0, 1fr) minmax(4.5rem, auto);
  gap: .75rem; align-items: center; }
.hbars .label, .stacks .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .value, .stacks .value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbars .track { height: .9rem; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbars .fill { display: block; height: 100%; background: #3987e5; border-radius: 0 4px 4px 0; }
.stacks .stack { display: flex; height: 1.35rem; gap: 2px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.stacks .seg { display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700;
  color: #0b1626; overflow: hidden; white-space: nowrap; flex: none; }
.stacks .seg:last-child { border-radius: 0 4px 4px 0; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0 0 .6rem; padding: 0; font-size: .85rem; }
.legend .swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
/* finishing places: one hue, 1st the most prominent on this dark surface (validated ordinal ramp) */
.shade-0 { background: #cde2fb; } .shade-1 { background: #9ec5f4; } .shade-2 { background: #6da7ec; }
.shade-3 { background: #3987e5; } .shade-4 { background: #256abf; color: #eef4fc !important; }
.shade-5 { background: #184f95; color: #eef4fc !important; }
.heat-legend { display: flex; align-items: center; gap: .5rem; font-size: .85rem; margin: .25rem 0 .75rem; }
.heat-legend .ramp { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.heat-legend .ramp span { width: 1.1rem; height: .8rem; }
@media (max-width: 40rem) {
  .hbars li, .stacks li { grid-template-columns: minmax(0, 1fr) auto; }
  .hbars .track, .stacks .stack { grid-column: 1 / -1; grid-row: 2; }
  .legend-games { margin-left: 0; flex-basis: 100%; }
}
.pw-0 { width: 0%; }
.pw-1 { width: 1%; }
.pw-2 { width: 2%; }
.pw-3 { width: 3%; }
.pw-4 { width: 4%; }
.pw-5 { width: 5%; }
.pw-6 { width: 6%; }
.pw-7 { width: 7%; }
.pw-8 { width: 8%; }
.pw-9 { width: 9%; }
.pw-10 { width: 10%; }
.pw-11 { width: 11%; }
.pw-12 { width: 12%; }
.pw-13 { width: 13%; }
.pw-14 { width: 14%; }
.pw-15 { width: 15%; }
.pw-16 { width: 16%; }
.pw-17 { width: 17%; }
.pw-18 { width: 18%; }
.pw-19 { width: 19%; }
.pw-20 { width: 20%; }
.pw-21 { width: 21%; }
.pw-22 { width: 22%; }
.pw-23 { width: 23%; }
.pw-24 { width: 24%; }
.pw-25 { width: 25%; }
.pw-26 { width: 26%; }
.pw-27 { width: 27%; }
.pw-28 { width: 28%; }
.pw-29 { width: 29%; }
.pw-30 { width: 30%; }
.pw-31 { width: 31%; }
.pw-32 { width: 32%; }
.pw-33 { width: 33%; }
.pw-34 { width: 34%; }
.pw-35 { width: 35%; }
.pw-36 { width: 36%; }
.pw-37 { width: 37%; }
.pw-38 { width: 38%; }
.pw-39 { width: 39%; }
.pw-40 { width: 40%; }
.pw-41 { width: 41%; }
.pw-42 { width: 42%; }
.pw-43 { width: 43%; }
.pw-44 { width: 44%; }
.pw-45 { width: 45%; }
.pw-46 { width: 46%; }
.pw-47 { width: 47%; }
.pw-48 { width: 48%; }
.pw-49 { width: 49%; }
.pw-50 { width: 50%; }
.pw-51 { width: 51%; }
.pw-52 { width: 52%; }
.pw-53 { width: 53%; }
.pw-54 { width: 54%; }
.pw-55 { width: 55%; }
.pw-56 { width: 56%; }
.pw-57 { width: 57%; }
.pw-58 { width: 58%; }
.pw-59 { width: 59%; }
.pw-60 { width: 60%; }
.pw-61 { width: 61%; }
.pw-62 { width: 62%; }
.pw-63 { width: 63%; }
.pw-64 { width: 64%; }
.pw-65 { width: 65%; }
.pw-66 { width: 66%; }
.pw-67 { width: 67%; }
.pw-68 { width: 68%; }
.pw-69 { width: 69%; }
.pw-70 { width: 70%; }
.pw-71 { width: 71%; }
.pw-72 { width: 72%; }
.pw-73 { width: 73%; }
.pw-74 { width: 74%; }
.pw-75 { width: 75%; }
.pw-76 { width: 76%; }
.pw-77 { width: 77%; }
.pw-78 { width: 78%; }
.pw-79 { width: 79%; }
.pw-80 { width: 80%; }
.pw-81 { width: 81%; }
.pw-82 { width: 82%; }
.pw-83 { width: 83%; }
.pw-84 { width: 84%; }
.pw-85 { width: 85%; }
.pw-86 { width: 86%; }
.pw-87 { width: 87%; }
.pw-88 { width: 88%; }
.pw-89 { width: 89%; }
.pw-90 { width: 90%; }
.pw-91 { width: 91%; }
.pw-92 { width: 92%; }
.pw-93 { width: 93%; }
.pw-94 { width: 94%; }
.pw-95 { width: 95%; }
.pw-96 { width: 96%; }
.pw-97 { width: 97%; }
.pw-98 { width: 98%; }
.pw-99 { width: 99%; }
.pw-100 { width: 100%; }
@media (max-width: 40rem) { .viewbar { position: static; } }  /* phones: keep the screen for the content */

/* Players (S9): filters, sortable headings, the list a search refreshes in place */
.players-filter { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: end; margin: 1rem 0; }
table.sortable th a { color: inherit; text-decoration: none; white-space: nowrap; }
table.sortable th a:hover, table.sortable th a:focus-visible { text-decoration: underline; }
table.sortable th[aria-sort] a { color: var(--gold-strong); }
.sort-mark { display: inline-block; margin-left: .3rem; font-size: .75em; opacity: .7; }
th[aria-sort] .sort-mark { opacity: 1; }
.live-results[aria-busy="true"] { opacity: .6; }
/* The Players tab's games, on their own row under the search: a toggle button per game in its
   colour (a checkbox under its label). A chosen one is filled and its mark solid, so the state
   doesn't rest on colour alone; "All games" and the others exclude each other (app.js). */
.players-filter .field.search { flex: 1 1 100%; }
.players-filter .field.search input { max-width: 32rem; }
fieldset.game-toggles { border: 0; padding: 0; margin: .4rem 0; background: none; min-width: 0; }
fieldset.game-toggles > legend { font-family: inherit; font-weight: 600; color: var(--text); padding: 0; margin-bottom: .35rem; }
.toggles { display: flex; flex-wrap: wrap; gap: .4rem; }
.toggle { position: relative; display: inline-flex; }
.toggle > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.game-pill { display: inline-flex; align-items: center; min-height: 2.25rem; padding: .3rem .85rem; border-radius: 999px;
  border: 1px solid var(--game, var(--muted)); background: var(--surface-2); color: var(--muted); font-size: .9rem;
  font-weight: 600; white-space: nowrap; cursor: pointer; }
.game-pill.all { --game: var(--muted); }
.game-pill .count { margin-left: .3rem; font-weight: 400; opacity: .8; }
.game-pill .game-mark { background: transparent; box-shadow: inset 0 0 0 2px var(--game); }
.toggle:hover > .game-pill { color: var(--text); background: color-mix(in srgb, var(--game) 12%, var(--surface-2)); }
.toggle > input:checked + .game-pill { color: var(--text); box-shadow: inset 0 0 0 1px var(--game);
  background: color-mix(in srgb, var(--game) 28%, var(--surface-2)); }
.toggle > input:checked + .game-pill .game-mark { background: var(--game); }
.toggle > input:focus-visible + .game-pill { outline: 3px solid var(--gold-strong); outline-offset: 2px; }
@media (forced-colors: active) { .toggle > input:checked + .game-pill { outline: 2px solid Highlight; } }
/* In a key-number card the win/draw/loss bar spans the card, its numbers under it */
.stat .wdl { display: flex; flex-direction: column; align-items: stretch; gap: .3rem; margin-top: .45rem; font-size: .85rem; }
.stat .wdl svg { width: 100%; }
/* Sorting on a phone, where a stacked table has no headings to click: the same choice as fields */
.narrow-only { display: none; }
@media (max-width: 40rem) { .players-filter .narrow-only { display: block; } }
td.buttons { white-space: nowrap; } td.buttons .button + .button { margin-left: .35rem; }
/* Manage › Results and Playoff: each recorded match's way to its games and replays (T15, T18) */
td.games-cell .button { margin-right: .4rem; white-space: nowrap; }
td.games-cell .muted { font-size: .85rem; white-space: nowrap; }
.game-chip { white-space: nowrap; }  /* a game's label stays on one line */
table.sortable th .who { white-space: nowrap; } table.sortable th .who .button { margin-left: .4rem; }
/* A12: the account's profile */
.profile-head { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 1rem; }
.avatar { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; flex: none; }
.avatar.none { display: inline-grid; place-items: center; font-family: var(--serif); font-size: 1.6rem;
  color: var(--gold-strong); background: var(--surface-2); }
.chips .game-chip + .game-chip { margin-left: .25rem; }  /* S9: a person's games */
.choices-inline { display: flex; flex-wrap: wrap; gap: .35rem 1rem; min-width: 0; }  /* A13 */

/* -- a tournament's logo (I6): a framed tile of a fixed height, so every shape sits the same way;
   its top edge in the game's colour, as the tournament cards ------------------------------- */
.t-title { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.t-title-text { min-width: 0; }
.logo-tile { flex: none; display: inline-flex; align-items: center; justify-content: center;
  height: 6.25rem; min-width: 6.25rem; max-width: 15rem; padding: .6rem .8rem;
  background: radial-gradient(120% 100% at 50% 0%, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-top: 3px solid var(--game, var(--gold)); border-radius: 14px;
  box-shadow: var(--shadow); }
.logo-tile img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.logo-tile.small { height: 3.5rem; min-width: 3.5rem; max-width: 8rem; padding: .35rem .5rem;
  border-top-width: 1px; border-radius: 10px; box-shadow: none; }
.t-card .logo-tile img { width: auto; height: 100%; border: 0; object-fit: contain; }
.t-card-head { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.t-card-head h2 { min-width: 0; overflow-wrap: anywhere; }
/* a tournament's banner (I6): fills the header behind the name; a shade, darkest where the text
   is, keeps it AA-readable over any picture; the picture is cut to fit, from its middle */
.t-head.has-banner { position: relative; isolation: isolate; overflow: hidden; min-height: 9.5rem;
  padding: 1.25rem 1.5rem; margin-top: .75rem; border: 1px solid var(--border);
  border-top: 3px solid var(--game, var(--gold)); border-radius: var(--radius); align-items: end;
  box-shadow: var(--shadow); }
.t-banner { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.t-head.has-banner::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgb(18 17 15 / 92%) 0%, rgb(18 17 15 / 80%) 45%, rgb(18 17 15 / 40%) 100%),
    linear-gradient(0deg, rgb(18 17 15 / 70%) 0%, rgb(18 17 15 / 0%) 55%); }
.t-head.has-banner .game-line, .t-head.has-banner h1 { text-shadow: 0 1px 3px rgb(0 0 0 / 70%); }
.banner-field { display: grid; gap: .5rem; margin-top: .25rem; min-width: 0; }
.banner-preview { display: block; width: 100%; max-width: 40rem; height: 8rem; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.logo-now { flex: none; margin: 0; max-width: 16rem; }
.banner-now { margin: 0; }
.logo-now figcaption, .banner-now figcaption { font-size: .85rem; margin-top: .3rem; max-width: 40rem; }
.logo-tile.default { padding: 0; background: none; border: 0; box-shadow: none; min-width: 0; }  /* the badge has its own rim */
.banner-field input[type=file] { width: 100%; max-width: 40rem; padding: .35rem; color: var(--muted); }
.banner-field input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: .75rem;
  padding: .4rem 1rem; border-radius: 6px; border: 1px solid var(--gold); background: transparent;
  color: var(--gold-strong); cursor: pointer; }
.banner-field input[type=file]::file-selector-button:hover { background: rgb(211 149 66 / 15%); color: #ffd38f; }
.logo-field-row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-start; margin-top: .25rem; }
.logo-field-controls input[type=file] { width: 100%; padding: .35rem; color: var(--muted); }
.logo-field-controls input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: .75rem;
  padding: .4rem 1rem; border-radius: 6px; border: 1px solid var(--gold); background: transparent;
  color: var(--gold-strong); cursor: pointer; }
.logo-field-controls input[type=file]::file-selector-button:hover { background: rgb(211 149 66 / 15%); color: #ffd38f; }
.logo-field-controls { flex: 1 1 16rem; min-width: 0; }
.logo-field-controls small { display: block; margin-top: .3rem; }
@media (max-width: 40rem) {
  .t-head.has-banner { min-height: 0; padding: 1rem; }
  .t-head.has-banner::before { background: linear-gradient(0deg, rgb(18 17 15 / 92%) 0%, rgb(18 17 15 / 72%) 60%, rgb(18 17 15 / 55%) 100%); }
  .banner-preview { height: 5rem; }
  .t-title { flex-direction: column; align-items: flex-start; gap: .7rem; }
  .logo-tile { height: 4.75rem; min-width: 4.75rem; max-width: 12rem; padding: .45rem .6rem; }
  .logo-tile.small { height: 3rem; min-width: 3rem; max-width: 6.5rem; }
}
/* the banner stays a compact band: a smaller logo, beside the name on every width */
.t-head.has-banner .logo-tile { height: 5rem; min-width: 5rem; max-width: 12rem; }
.t-head.has-banner .logo-tile.default { min-width: 0; }
/* on a phone the banner is reframed, not squeezed: a 3:1 strip on top showing the picture as it
   was made, the logo overlapping its lower edge (as a profile picture on a cover), and the name
   and facts below at full width on the plain surface, so no text sits over the picture */
@media (max-width: 40rem) {
  .t-head.has-banner { display: block; min-height: 0; padding: 0 0 1rem; background: var(--surface); }
  .t-head.has-banner::before { display: none; }
  .t-head.has-banner .t-banner { position: static; display: block; width: 100%; height: auto;
    aspect-ratio: 3 / 1; max-height: 7.5rem; z-index: auto; }
  .t-head.has-banner .t-title { flex-direction: column; align-items: flex-start; gap: .45rem;
    padding: 0 1rem; margin-top: -1.75rem; position: relative; }
  .t-head.has-banner .logo-tile { height: 3.5rem; min-width: 3.5rem; max-width: 8rem; padding: .3rem .45rem;
    box-shadow: 0 0 0 3px var(--surface), var(--shadow); }
  .t-head.has-banner .logo-tile.default { min-width: 0; padding: 0; border-radius: 12px; }
  .t-head.has-banner .game-line, .t-head.has-banner h1 { text-shadow: none; }
  .t-head.has-banner h1 { font-size: clamp(1.2rem, 5.5vw, 1.5rem); margin: 0; overflow-wrap: anywhere; }
  .t-head.has-banner .game-line { font-size: .75rem; }
  .t-head.has-banner .facts { gap: .3rem; margin-top: .3rem; }
}
