/* Tournament / Fixture Generator (#027). Only this tool's own pieces; everything else is the shared tool frame.
   Colours come from the site's variables only (tests/catalogue.test.mjs checks there are no hex values here).
   The names are the content: plain cards and lists, no colour coding. */

/* ---------- set-up ---------- */
.fx-list { min-height: 150px; font-size: 17px; line-height: 1.55; }
.fx-status { margin: -2px 0 0; min-height: 1.4em; font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }
.fx-status.is-problem { color: var(--graphite); font-weight: 600; }
.fx-status:empty { min-height: 0; }
.fx-format__opts { display: grid; gap: 8px; }
.fx-sub { margin-top: 12px; }
.fx-sub .fx-chips { margin: 12px 0 0; }
.fx-shape { margin-top: 12px; line-height: 1.45; }
.fx-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fx-row__l { font-size: 15px; font-weight: 600; }
.fx-step { flex: none; width: max-content; }
.fx-kind { margin-top: 12px; }
.fx-seeding { margin-top: 12px; }
.fx-seeds { display: grid; gap: 8px; margin-bottom: 10px; }
.fx-seeds:empty { display: none; }
.fx-seed { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.fx-seed__l { font-size: 14px; font-weight: 600; white-space: nowrap; }
.fx-seed__s { min-width: 0; }
.fx-row--top { margin-top: 14px; }
.fx-row .fx-step { margin-left: auto; }
/* Make fixtures sits at the end of the set-up, after every setting (iPhone review, 24 Oct 2026). */
.fx-go { margin-top: 22px; }
.fx-go .field__warn { margin-top: 10px; }

.fx-time { max-width: 180px; font-variant-numeric: tabular-nums; }
.fx-tgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 16px; margin-bottom: 14px; }
.fx-tgrid .field__label, .fx-long .field__label { display: block; margin-bottom: 6px; }
.fx-longs { display: grid; gap: 10px; margin-bottom: 8px; }
.fx-longs:empty { display: none; }
.fx-long { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 14px; padding: 10px 12px 12px; border-radius: var(--r-card); background: var(--white); box-shadow: inset 0 0 0 1px var(--silver); }
.fx-long .field { margin: 0; }
.fx-long__x { margin-left: auto; }

/* What to include in the printout (shared chooser, styled here). */
.pdf-sections { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.pdf-sections legend { padding: 0; margin-bottom: 8px; color: var(--slate); }
.fx-stale { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-card); background: var(--white); box-shadow: inset 0 0 0 1.5px var(--graphite); font-size: 15px; font-weight: 600; }
.fx-paper.is-stale .fx-result { opacity: .45; }

/* ---------- the result ---------- */
.fx-empty { margin: 0; padding: 36px 0 20px; font-size: 15px; color: var(--steel); }
.fx-summary { margin: 4px 0 18px; }
.fx-sum { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; }
.fx-note { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--slate); }
.fx-views { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: var(--r-btn); background: var(--mist); }
.fx-view { min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-btn); background: transparent; color: var(--slate); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.fx-view[aria-pressed="true"] { background: var(--white); color: var(--graphite); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.fx-view:focus-visible { outline: 3px solid var(--graphite); outline-offset: 2px; }
.fx-view[hidden] { display: none; }
.fx-sec { display: none; }
.fx-sec.is-view { display: block; }
.fx-sec__h { display: none; }
.fx-paper-only { display: none; }

/* Groups, then the schedule round by round: one row per area, and who's resting. */
.fx-glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; margin-bottom: 20px; }
.fx-g { min-width: 0; padding: 10px 12px; border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--silver); background: var(--white); break-inside: avoid; }
.fx-g h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--slate); }
.fx-g ul { list-style: none; margin: 0; padding: 0; font-size: 15px; line-height: 1.45; }
.fx-g li { overflow-wrap: anywhere; }
.fx-rounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.fx-round { min-width: 0; padding: 12px 14px; border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--silver); background: var(--white); break-inside: avoid; }
.fx-round__h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 2px solid var(--graphite); font-size: 16px; font-weight: 600; }
.fx-round__l { list-style: none; margin: 0; padding: 0; }
.fx-round__l li { display: grid; grid-template-columns: minmax(64px, auto) minmax(0, 1fr); gap: 2px 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--mist); font-size: 15px; line-height: 1.35; }
.fx-round__l li:last-child { border-bottom: 0; }
.fx-area { font-size: 13px; font-weight: 600; color: var(--slate); overflow-wrap: anywhere; }
.fx-fix { min-width: 0; overflow-wrap: anywhere; }
.fx-tag { display: block; font-size: 12.5px; color: var(--steel); }
.fx-rest { margin: 6px 0 0; padding-top: 6px; border-top: 1px dashed var(--silver); font-size: 13.5px; line-height: 1.4; color: var(--slate); overflow-wrap: anywhere; }
.fx-rest span { font-weight: 600; }
.fx-t { font-size: 13px; font-weight: 400; color: var(--steel); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Cards: one team's (or one pitch's) day, in order. */
.fx-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px 28px; }
.fx-card { min-width: 0; break-inside: avoid; }
.fx-card__h { margin: 0 0 8px; padding-bottom: 7px; border-bottom: 2px solid var(--graphite); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.fx-card__l { list-style: none; margin: 0; padding: 0; }
.fx-card__l li { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--mist); font-size: 15px; line-height: 1.35; }
.fx-card__l li > .fx-r { grid-column: 1; grid-row: 1; }
.fx-card__l li > .fx-t { grid-column: 2; grid-row: 1; }
.fx-card__l li > .fx-a { grid-column: 1 / 3; grid-row: 2; font-size: 12.5px; color: var(--steel); overflow-wrap: anywhere; }
.fx-card__l li > .fx-w { grid-column: 3; grid-row: 1 / span 2; }
.fx-card__l li.fx-if { display: block; padding: 10px 0 0; border-bottom: 0; }
.fx-ifl { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--slate); }
.fx-r { font-size: 13px; font-weight: 600; color: var(--slate); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fx-w { min-width: 0; overflow-wrap: anywhere; }

/* ---------- the bracket ----------
   The traditional two-sided knockout approved for #024 (its own copy: tools never depend on each other). First
   matches enter from the far left and far right, winners move inward, and the sides meet at the Final in the centre.
   Each column is the bracket's full height and spreads its matches evenly, so a match sits level with the middle of
   the two that feed it; each group's ::after draws the line joining them. A match's number, time and pitch sit just
   above its box, so the lines join the boxes themselves. A bye is a ghost box: that entrant starts in round 2. */
.fx-tree { overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.fx-tree-print { display: none; }
.fx-kb { --cw: 156px; --gx: 26px; --sh: 28px; --lw: 1px; --line: var(--steel); --row: calc(2 * var(--sh) + 34px); --pad: 40px;
  display: flex; align-items: stretch; gap: var(--gx); width: max-content; min-height: calc(var(--rows) * var(--row) + 2 * var(--pad)); margin: 0 auto; padding: var(--pad) 2px; }
.fx-kb--s2, .fx-kb--s4 { --cw: 180px; }
.fx-kb--s32, .fx-kb--s64 { --cw: 128px; --gx: 18px; --sh: 26px; --row: calc(2 * var(--sh) + 28px); }
.fx-kb__side { display: flex; gap: var(--gx); }
.fx-kb__side--r { flex-direction: row-reverse; }
.fx-kb__col { width: var(--cw); display: flex; flex-direction: column; }
.fx-kb__g { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.fx-kb__g::after { content: ""; position: absolute; top: 25%; bottom: 25%; width: calc(var(--gx) / 2); border: var(--lw) solid var(--line); }
.fx-kb__g--one::after { top: 50%; bottom: auto; height: 0; width: var(--gx); border-width: var(--lw) 0 0; }
.fx-kb__side--l .fx-kb__g::after { right: calc(var(--gx) / -2); border-left: 0; }
.fx-kb__side--r .fx-kb__g::after { left: calc(var(--gx) / -2); border-right: 0; }
.fx-kb__side--l .fx-kb__g--one::after { right: calc(var(--gx) * -1); }
.fx-kb__side--r .fx-kb__g--one::after { left: calc(var(--gx) * -1); }
.fx-kb__side .fx-kb__col:not(.fx-kb__col--first) .fx-m::before { content: ""; position: absolute; top: 50%; width: calc(var(--gx) / 2); border-top: var(--lw) solid var(--line); }
.fx-kb__side--l .fx-kb__col:not(.fx-kb__col--first) .fx-m::before { left: calc(var(--gx) / -2); }
.fx-kb__side--r .fx-kb__col:not(.fx-kb__col--first) .fx-m::before { right: calc(var(--gx) / -2); }
.fx-kb__mid { width: calc(var(--cw) + 16px); display: flex; align-items: center; }
.fx-kb__fin { position: relative; width: 100%; }
.fx-kb__flabel { position: absolute; bottom: calc(100% + 24px); left: 0; right: 0; margin: 0; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); }
.fx-kb__champ { position: absolute; top: calc(100% + 12px); left: 0; right: 0; padding: 8px 10px; border-radius: 10px; text-align: center; box-shadow: inset 0 0 0 1px var(--silver); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); }

.fx-m { position: relative; display: grid; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--silver); background: var(--white); }
.fx-kb__fin .fx-m { box-shadow: inset 0 0 0 1.5px var(--steel); }
.fx-m.is-free { box-shadow: none; background: transparent; }
.fx-mh { position: absolute; bottom: calc(100% + 3px); left: 2px; right: 2px; font-size: 11px; line-height: 1.2; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.fx-kb__side--r .fx-mh { text-align: right; }
.fx-kb__fin .fx-mh { text-align: center; }
.fx-slot { display: block; height: var(--sh, 28px); padding: 0 9px; font-size: 13px; line-height: var(--sh, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-slot + .fx-slot { border-top: 1px solid var(--silver); }
.fx-m.is-free .fx-slot + .fx-slot { border-top-color: transparent; }
.fx-slot--free { color: var(--steel); font-style: italic; }
.fx-kb__side--r .fx-slot { text-align: right; }

.fx-send { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.fx-send h2 { margin: 0; color: var(--slate); }
.fx-send__btns { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 560px) {
  .fx-views { display: flex; }
  .fx-view { flex: 1 1 0; padding: 0 6px; }
  .fx-cards, .fx-rounds { grid-template-columns: minmax(0, 1fr); }
  .fx-glist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-seed { grid-template-columns: minmax(0, 1fr) auto; }
  .fx-seed__l { grid-column: 1 / -1; }
  .fx-send__btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .fx-send__btns .btn { width: 100%; justify-content: center; min-height: 44px; white-space: nowrap; }
  .fx-send__btns #fx-copy { grid-column: 1 / -1; }
}

/* ---------- paper: the sections chosen, each from a new page ---------- */
@media print {
  .fx-summary { margin: 2mm 0 5mm; }
  .fx-paper-only { display: block; }
  .fx-sum { font-size: 11pt; }
  .fx-note { font-size: 8.5pt; margin-top: 1mm; }
  .fx-paper.is-stale .fx-result { opacity: 1; }
  /* Space after each section: the PDF maker starts a forced page a little above the next section, which must not
     fall inside a list before it. */
  .fx-sec { display: block; padding-bottom: 8mm; }
  .fx-sec[data-pdf-out] { display: none; }
  .fx-sec:not(.is-first) { break-before: page; }
  .fx-sec__h { display: block; margin: 0 0 4mm; font-size: 13pt; font-weight: 600; }
  .fx-glist { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3mm 4mm; margin-bottom: 5mm; }
  .fx-g { padding: 2mm 2.5mm; box-shadow: none; border: 0.75pt solid var(--silver); }
  .fx-g h4 { font-size: 7.5pt; }
  .fx-g ul { font-size: 9pt; line-height: 1.3; }
  .fx-rounds { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4mm 5mm; }
  .fx-land .fx-rounds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fx-round { padding: 2mm 2.5mm; box-shadow: none; border: 0.75pt solid var(--silver); }
  .fx-round__h { font-size: 10pt; padding-bottom: 1.2mm; margin-bottom: 1mm; border-bottom-width: 1.2pt; }
  .fx-round__l li { padding: 1mm 0; font-size: 9pt; border-bottom: 0.5pt solid var(--mist); grid-template-columns: minmax(14mm, auto) minmax(0, 1fr); gap: 0.5mm 2.5mm; }
  .fx-area { font-size: 7.5pt; }
  .fx-tag { font-size: 7pt; }
  .fx-rest { font-size: 8pt; margin-top: 1mm; padding-top: 1mm; border-top: 0.5pt dashed var(--silver); }
  .fx-t { font-size: 8pt; }
  .fx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6mm 8mm; }
  .fx-land .fx-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fx-card__h { font-size: 11.5pt; padding-bottom: 1.5mm; border-bottom-width: 1.5pt; margin-bottom: 1.5mm; }
  .fx-card__l li { padding: 1.2mm 0; font-size: 9pt; border-bottom: 0.5pt solid var(--mist); }
  .fx-card__l li > .fx-a { font-size: 7.5pt; }
  .fx-card__l li.fx-if { padding-top: 2mm; }
  .fx-ifl { font-size: 7pt; }
  .fx-r { font-size: 8pt; }

  /* The bracket on paper: A4 landscape, one page up to 32; 64 as two halves, a page each. */
  .fx-tree { display: none; }
  .fx-tree-print { display: block; }
  .fx-pb--next { break-before: page; padding-top: 2mm; }
  .fx-pb__h { margin: 0 0 2mm; font-size: 10pt; font-weight: 600; color: var(--slate); }
  .fx-tree-print .fx-kb { --gx: 7mm; --sh: 10mm; --fs: 9.5pt; --mh: 7pt; --lw: 0.9pt; --line: var(--steel);
    width: 100%; height: 138mm; min-height: 0; margin: 0; padding: 10mm 0 0; break-inside: avoid; }
  .fx-tree-print .fx-kb--s2, .fx-tree-print .fx-kb--s4 { --gx: 9mm; --sh: 13mm; --fs: 12pt; --mh: 8pt; width: 210mm; height: 100mm; margin: 0 auto; }
  .fx-tree-print .fx-kb--s8 { --sh: 11.5mm; --fs: 10.5pt; }
  .fx-tree-print .fx-kb--s16 { --gx: 6mm; --sh: 8mm; --fs: 8.5pt; --mh: 6.5pt; }
  /* 32 (iPhone reviews): a landscape page of its own that's useful in its own right. A compact header (title ·
     Knockout bracket, the set-up line, the operational notes: about 15 mm) replaces the section heading, and when
     the bracket is printed first it replaces the usual title block too, so no page only introduces it. A4 landscape
     less the margins leaves 186 mm; the bracket takes 142 of it: eight first-round matches a side at about 17 mm
     each (two 6.4 mm name rows, room for a long name on two lines, and the match line above). Names 8 pt, match
     lines 6.3 pt. */
  .fx-tree-print .fx-kb--s32 { --gx: 4mm; --sh: 6.2mm; --fs: 8pt; --mh: 6.3pt; height: 130mm; padding-top: 6mm; }
  .fx-sec--b32 .fx-sec__h { display: none; }
  .fx-paper.fx-b32-lead > .paper__title, .fx-paper.fx-b32-lead > .paper__sub, .fx-paper.fx-b32-lead .fx-summary { display: none; }
  .fx-pb__id { margin: 0 0 1mm; }
  .fx-pb__t { margin: 0; font-size: 14pt; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
  .fx-pb__t span { font-weight: 500; color: var(--slate); }
  .fx-pb__s { margin: 0.8mm 0 0; font-size: 9pt; color: var(--slate); }
  .fx-pb__n { margin: 0.6mm 0 0; font-size: 8pt; color: var(--slate); }
  .fx-tree-print .fx-kb--half { --gx: 6mm; --sh: 2.9mm; --fs: 6pt; --mh: 5pt; height: 150mm; padding-top: 4mm; }
  /* Sharing the first page with the title, a bracket up to 32 is made shorter to fit beneath it; the heading and the
     bracket always stay together (if the summary runs long, both move to the next page). */
  .fx-sec[data-view="bracket"]:not(.fx-sec--big) { break-inside: avoid; }
  .fx-sec.is-first:not(.fx-sec--big):not(.fx-sec--b32) .fx-tree-print .fx-kb { height: 88mm; padding-top: 8mm; }
  .fx-sec.is-first:not(.fx-sec--big):not(.fx-sec--b32) .fx-tree-print .fx-kb--s2, .fx-sec.is-first .fx-tree-print .fx-kb--s4 { height: 80mm; }
  .fx-sec.is-first:not(.fx-sec--big):not(.fx-sec--b32) .fx-tree-print .fx-kb--s8 { --sh: 9mm; }
  .fx-sec.is-first:not(.fx-sec--big):not(.fx-sec--b32) .fx-tree-print .fx-kb--s16 { --sh: 6.2mm; --fs: 7.8pt; }
  /* 32 and 64 (two halves) need full pages, so the bracket never shares its first page with the title. */
  .fx-sec--big.is-first { break-before: page; }
  #fx-bracket-list { display: none; }
  .fx-tree-print .fx-kb__side { flex: var(--sc) 1 0; min-width: 0; }
  .fx-tree-print .fx-kb__col { flex: 1 1 0; width: auto; min-width: 0; }
  .fx-tree-print .fx-kb__mid { flex: 1.15 1 0; width: auto; min-width: 0; }
  .fx-tree-print .fx-m { border-radius: 1.4mm; box-shadow: none; border: 0.75pt solid var(--steel); background: transparent; }
  .fx-tree-print .fx-m.is-free { border-color: transparent; }
  .fx-tree-print .fx-kb__fin .fx-m { border-width: 1.2pt; border-color: var(--graphite); }
  .fx-tree-print .fx-mh { bottom: calc(100% + 0.6mm); font-size: var(--mh); }
  /* A name too long for its box takes two lines rather than being cut short. */
  .fx-tree-print .fx-slot { display: flex; align-items: center; height: var(--sh); padding: 0 1.4mm; font-size: var(--fs); line-height: 1.05; white-space: normal; overflow: hidden; overflow-wrap: anywhere; }
  .fx-tree-print .fx-slot + .fx-slot { border-top: 0.5pt solid var(--silver); }
  .fx-tree-print .fx-kb__side--r .fx-slot { justify-content: flex-end; text-align: right; }
  .fx-tree-print .fx-slot--free { font-size: calc(var(--fs) * 0.85); }
  .fx-tree-print .fx-kb__flabel { bottom: calc(100% + 4mm); font-size: 9pt; }
  .fx-tree-print .fx-kb__champ { top: calc(100% + 4mm); padding: 2.5mm 2mm 8mm; border-radius: 2mm; box-shadow: none; border: 1.5pt solid var(--graphite); font-size: 7.5pt; }
}
