/* 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;
  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: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  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); letter-spacing: .02em; line-height: 1.25; }
h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .25rem; color: var(--gold-strong); }
h2 { font-size: 1.3rem; margin: 1.75rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: .5rem 0; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 52rem; overflow-wrap: anywhere; }
.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 3rem; 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; }

/* -- 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: .6rem .9rem; 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: .8rem; text-transform: uppercase; letter-spacing: .08em; 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; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.stat .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .value { font-family: var(--serif); font-size: 1.35rem; color: var(--gold-strong); }
.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; opacity: .85; }
.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; }
@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; }
.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: .9rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.t-card h2 { font-size: 1.15rem; 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(--gold); }

/* -- 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); }
.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; padding: .75rem 1rem .5rem; color: var(--gold-strong); }
caption .muted { font-family: system-ui, sans-serif; font-weight: 400; font-size: .85rem; }
th, td { padding: .5rem .9rem; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
thead th { border-top: 0; font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; 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); }
button.danger { border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; color: var(--gold-strong); text-decoration: underline; font-weight: 500; }
form.inline { display: inline; }
.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: .7rem; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; 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; }
  .account { margin-left: 0; }
  .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 .15rem; font-size: .85rem; letter-spacing: .03em; text-transform: uppercase; color: var(--text); }
.game-line .muted { text-transform: none; letter-spacing: 0; }
.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; text-transform: none; letter-spacing: 0; 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: .78rem; text-transform: uppercase; letter-spacing: .06em; 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: .45rem .8rem; }
.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); text-transform: none;
  letter-spacing: 0; 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; }
.panel-title { margin: 1rem 0 .75rem; font-size: 1.2rem; }
.panel-title .muted { font-family: system-ui, sans-serif; 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: system-ui, sans-serif; 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 */
