/* Decision Tournament (#024). 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 current matchup is the page: two large options, then progress and the quiet actions. The bracket is secondary,
   below the matchup on wide screens and behind "View bracket" on phones and tablets. */

/* ---------- setup ---------- */
.dt-options { min-height: 196px; font-size: 17px; line-height: 1.55; }
.dt-status { margin: -2px 0 0; min-height: 1.4em; font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }
.dt-status.is-problem { color: var(--graphite); font-weight: 600; }
.dt-byes { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--slate); }
.dt-locked__more summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.dt-locked__more summary::-webkit-details-marker { display: none; }
.dt-locked__more summary::after { content: ""; width: 7px; height: 7px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 160ms ease; }
.dt-locked__more[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.dt-locked__more summary:focus-visible { outline: 2px solid var(--graphite); outline-offset: 3px; border-radius: 4px; }
.dt-locked__note { margin: 4px 0 12px; font-size: 14px; line-height: 1.45; color: var(--slate); }
.dt-locked__list { margin: 0 0 6px; padding-left: 1.6em; display: grid; gap: 4px; font-size: 15px; line-height: 1.35; max-height: 320px; overflow: auto; overflow-wrap: anywhere; }
.dt-locked__list li::marker { color: var(--steel); font-variant-numeric: tabular-nums; }
#dt-new { margin-top: 12px; }
#dt-new.is-armed { box-shadow: inset 0 0 0 1.5px var(--graphite); font-weight: 600; }

/* ---------- the matchup ---------- */
.dt-stage { outline: none; }
.dt-empty { margin: 0; padding: 36px 0 20px; font-size: 15px; color: var(--steel); }
.dt-q { margin: 0 0 16px; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; outline: none; }
.dt-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 12px; }
.dt-opt { position: relative; display: flex; align-items: center; justify-content: center; min-height: 132px; padding: 22px 20px; border: 0; border-radius: var(--r-card, 14px); background: var(--white); box-shadow: inset 0 0 0 1.5px var(--silver); color: var(--ink, var(--graphite)); font: inherit; font-size: 21px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; text-align: center; cursor: pointer; transition: box-shadow 140ms ease, transform 140ms var(--ease-out); -webkit-tap-highlight-color: transparent; }
.dt-opt__t { min-width: 0; overflow-wrap: anywhere; }
.dt-opt__k { position: absolute; top: 9px; left: 11px; font-size: 12px; font-weight: 600; color: var(--steel); font-variant-numeric: tabular-nums; }
@media (hover: hover) { .dt-opt:hover { box-shadow: inset 0 0 0 2px var(--graphite); } }
.dt-opt:active { transform: scale(0.985); box-shadow: inset 0 0 0 2px var(--graphite); }
.dt-opt:focus-visible { outline: 3px solid var(--graphite); outline-offset: 3px; }
.dt-or { align-self: center; justify-self: center; font-size: 14px; font-weight: 500; color: var(--steel); }

.dt-progress { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.dt-progress p { margin: 0; flex: none; font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }
.dt-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--mist, var(--silver)); overflow: hidden; }
.dt-bar span { display: block; height: 100%; background: var(--graphite); transition: width 240ms var(--ease-out); }
.dt-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dt-keys { margin: 12px 0 0; font-size: 13px; color: var(--steel); }
@media (hover: none) { .dt-keys { display: none; } }

/* ---------- the result ---------- */
.dt-winner { margin: 0; font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; outline: none; }
.dt-made { margin: 8px 0 0; font-size: 15px; color: var(--slate); font-variant-numeric: tabular-nums; }
.dt-path { margin: 10px 0 0; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.dt-changed { margin: 10px 0 0; font-size: 14px; line-height: 1.45; color: var(--slate); }
.dt-gut { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--silver); }
.dt-gut__q { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.dt-gut__hint { margin: -4px 0 12px; font-size: 14px; color: var(--slate); }
.dt-gut__btns, .dt-gut__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.dt-gut__opts .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }

/* ---------- the bracket ---------- */
/* A traditional two-sided knockout (iPhone review, 24 Oct 2026): first-round matchups enter from the far left and
   the far right, winners move inward, and the sides meet at the Final in the centre with the pick beneath it.
   Every column is the bracket's full height and spreads its matchups evenly (space-around), so a matchup always sits
   exactly level with the middle of the two that feed it. Each group (.dt-kb__g) holds those two feeders; its ::after
   draws the bracket line joining their middles (25% and 75% of the group) to the next matchup's ::before.
   --cw column width · --gx gap between columns (the lines live in it) · --sh one slot's height. */
.dt-bracket { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--silver); }
.dt-bracket__h { margin: 0 0 12px; color: var(--slate); }
.dt-tree { overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.dt-kb { --cw: 150px; --gx: 28px; --sh: 28px; --lw: 1px; --line: var(--steel); --row: calc(2 * var(--sh) + 18px); --pad: 36px;
  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; }
.dt-kb--s4 { --cw: 176px; }
.dt-kb--s16 { --cw: 132px; --gx: 24px; }
.dt-kb--s32 { --cw: 112px; --gx: 18px; --sh: 26px; --row: calc(2 * var(--sh) + 12px); }
.dt-kb__side { display: flex; gap: var(--gx); }
.dt-kb__side--r { flex-direction: row-reverse; }
.dt-kb__col { width: var(--cw); display: flex; flex-direction: column; }
.dt-kb__g { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.dt-kb__g::after { content: ""; position: absolute; top: 25%; bottom: 25%; width: calc(var(--gx) / 2); border: var(--lw) solid var(--line); }
.dt-kb__g--one::after { top: 50%; bottom: auto; height: 0; width: var(--gx); border-width: var(--lw) 0 0; }
.dt-kb__side--l .dt-kb__g::after { right: calc(var(--gx) / -2); border-left: 0; }
.dt-kb__side--r .dt-kb__g::after { left: calc(var(--gx) / -2); border-right: 0; }
.dt-kb__side--l .dt-kb__g--one::after { right: calc(var(--gx) * -1); }
.dt-kb__side--r .dt-kb__g--one::after { left: calc(var(--gx) * -1); }
.dt-kb__side .dt-kb__col:not(.dt-kb__col--first) .dt-m::before { content: ""; position: absolute; top: 50%; width: calc(var(--gx) / 2); border-top: var(--lw) solid var(--line); }
.dt-kb__side--l .dt-kb__col:not(.dt-kb__col--first) .dt-m::before { left: calc(var(--gx) / -2); }
.dt-kb__side--r .dt-kb__col:not(.dt-kb__col--first) .dt-m::before { right: calc(var(--gx) / -2); }
.dt-kb__mid { width: calc(var(--cw) + 16px); display: flex; align-items: center; }
.dt-kb__fin { position: relative; width: 100%; }
.dt-kb__flabel { position: absolute; bottom: calc(100% + 6px); 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); }
.dt-kb__champ { position: absolute; top: calc(100% + 12px); left: 0; right: 0; display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; text-align: center; box-shadow: inset 0 0 0 1px var(--silver); }
.dt-kb__champ.is-decided { box-shadow: inset 0 0 0 2px var(--graphite); background: var(--white); }
.dt-kb__clabel { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); }
.dt-kb__cname { font-size: 15px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.dt-kb__cname.dt-slot--later { font-size: 13px; font-weight: 400; }
.dt-kb__cnote { font-size: 11px; line-height: 1.3; color: var(--slate); }

.dt-m { position: relative; display: grid; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--silver); background: var(--white); }
.dt-kb__fin .dt-m { box-shadow: inset 0 0 0 1.5px var(--steel); }
.dt-m.is-now, .dt-kb__fin .dt-m.is-now { box-shadow: inset 0 0 0 2px var(--graphite); }
.dt-m.is-skipped { box-shadow: none; outline: 1.5px dashed var(--steel); outline-offset: -1.5px; }
.dt-m.is-free { box-shadow: none; background: transparent; }
.dt-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; }
.dt-slot + .dt-slot { border-top: 1px solid var(--silver); }
.dt-m.is-free .dt-slot + .dt-slot { border-top-color: transparent; }
.dt-slot--won { font-weight: 600; }
.dt-slot--lost { color: var(--steel); text-decoration: line-through; text-decoration-color: var(--silver); }
.dt-slot--later, .dt-slot--free { color: var(--steel); font-style: italic; }
.dt-kb__side--r .dt-slot { text-align: right; }

/* ---------- the paper (Print and Download PDF only) ----------
   A4 landscape, the whole bracket on one page: the same two-sided layout as the screen, sized in mm for paper.
   Matchups still to be decided are empty boxes to fill in by hand; very long names are shortened by the page
   (decision.js, PAPER_CHARS) to two lines of their box. */
.dt-paper { display: none; }

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

@media (max-width: 560px) {
  /* Phones: the two options stack, each a full-width target, with "or" between them. */
  .dt-pair { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .dt-opt { min-height: 96px; font-size: 19px; padding: 20px 18px; }
  .dt-q { font-size: 20px; margin-bottom: 12px; }
  .dt-winner { font-size: 28px; }
  .dt-acts .btn { flex: 1 1 auto; min-height: 44px; }
  .dt-send__btns, .dt-send__btns .btn { width: 100%; justify-content: center; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .dt-opt, .dt-bar span { transition: none; } }
@page { size: A4 landscape; }
@page :first { size: A4 landscape; }
@media print {
  .dt-paper { display: block; }
  .dt-paper .paper__sub { margin-top: 1.5mm; }
  .dt-pkb { margin-top: 5mm; }
  .dt-paper .dt-kb { --gx: 7mm; --sh: 12mm; --fs: 10pt; --lw: 0.9pt; --line: var(--steel);
    width: 100%; height: 132mm; min-height: 0; margin: 0; padding: 9mm 0 0; break-inside: avoid; }
  .dt-paper .dt-kb--s4 { --gx: 9mm; --sh: 14mm; --fs: 12pt; width: 200mm; height: 100mm; margin: 0 auto; }
  .dt-paper .dt-kb--s8 { --gx: 8mm; --sh: 13mm; --fs: 10.5pt; }
  .dt-paper .dt-kb--s16 { --gx: 6mm; --sh: 10mm; --fs: 8.5pt; }
  .dt-paper .dt-kb--s32 { --gx: 4.5mm; --sh: 6.8mm; --fs: 7pt; }
  .dt-paper .dt-kb__side { flex: var(--sc) 1 0; min-width: 0; }
  .dt-paper .dt-kb__col { flex: 1 1 0; width: auto; min-width: 0; }
  .dt-paper .dt-kb__mid { flex: 1.15 1 0; width: auto; min-width: 0; }
  .dt-paper .dt-m { border-radius: 1.6mm; box-shadow: none; border: 0.75pt solid var(--steel); background: transparent; }
  .dt-paper .dt-m.is-free { border-color: transparent; }
  .dt-paper .dt-kb__fin .dt-m { border-width: 1.2pt; border-color: var(--graphite); }
  .dt-paper .dt-slot { display: flex; align-items: center; height: var(--sh); padding: 0 1.6mm; font-size: var(--fs); line-height: 1.12; white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
  .dt-paper .dt-slot + .dt-slot { border-top: 0.5pt solid var(--silver); }
  .dt-paper .dt-kb__side--r .dt-slot { justify-content: flex-end; text-align: right; }
  .dt-paper .dt-slot--free { font-size: calc(var(--fs) * 0.85); }
  .dt-paper .dt-slot--lost { text-decoration-color: var(--steel); }
  .dt-paper .dt-kb__flabel { bottom: calc(100% + 2mm); font-size: 9pt; }
  .dt-paper .dt-kb__champ { top: calc(100% + 4mm); padding: 2.5mm 2mm; border-radius: 2mm; box-shadow: none; border: 1.5pt solid var(--graphite); background: transparent; }
  .dt-paper .dt-kb__clabel { font-size: 7.5pt; }
  .dt-paper .dt-kb__cname { font-size: 14pt; min-height: 7mm; }
  .dt-paper .dt-kb--s32 .dt-kb__cname { font-size: 11pt; }
  .dt-paper .dt-kb__cnote { font-size: 7pt; }
}
