/* The tournament maker: form and board. Works on the dark website and in the admin (light or
   dark) by borrowing each one's colours, with its own as a fallback. */
.t-form, .t-board {
  --t-card: var(--card, var(--surface, #fff));
  --t-line: var(--line, var(--border, #d9dde5));
  --t-text: var(--text, #1c2230);
  --t-muted: var(--muted, #687082);
  --t-accent: var(--green, var(--success, #198754));
  --t-soft: color-mix(in srgb, var(--t-accent) 14%, transparent);
  color: var(--t-text);
}
.t-form { display: grid; gap: 18px; }
.t-field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.t-field label, .t-field legend { font-weight: 600; padding: 0; }
.t-field small, .t-help, .t-count, .t-note { color: var(--t-muted); font-size: .92rem; font-weight: 400; }
.t-form input:not([type=radio]):not([type=checkbox]), .t-form textarea, .t-form select {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--t-line); background: var(--t-card); color: var(--t-text); font: inherit;
}
.t-form textarea { resize: vertical; min-height: 9em; }
.t-choices { display: grid; gap: 8px; }
.t-choice { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--t-line); border-radius: 10px; background: var(--t-card); cursor: pointer; font-weight: 600; }
.t-choice:has(input:checked) { border-color: var(--t-accent); background: var(--t-soft); }
.t-help { margin: 4px 0 0; }
.t-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.t-check input, .t-choice input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--t-accent); }
.t-error { margin: 0; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, #e5484d 16%, transparent); border: 1px solid #e5484d; }
.t-form .hp { position: absolute; left: -9999px; }

.t-board { display: grid; gap: 22px; }
.t-champion { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: 14px; border: 2px solid var(--t-accent); background: var(--t-soft); }
.t-champion > span { font-size: 2.4rem; line-height: 1; }
.t-champion small { display: block; color: var(--t-muted); }
.t-champion strong { font-size: 1.5rem; }
.t-progress { margin: 0; color: var(--t-muted); display: grid; gap: 6px; }
.t-bar { display: block; height: 8px; border-radius: 99px; background: var(--t-line); overflow: hidden; }
.t-bar span { display: block; height: 100%; background: var(--t-accent); }
.t-group, .t-ko { display: grid; gap: 12px; }
.t-board h3 { margin: 0; font-size: 1.3rem; }
.t-board h4 { margin: 0 0 8px; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--t-muted); }
.t-note { margin: 0; }
.t-table { overflow-x: auto; border: 1px solid var(--t-line); border-radius: 12px; background: var(--t-card); }
.t-table table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.t-table th, .t-table td { padding: 9px 8px; text-align: center; border-bottom: 1px solid var(--t-line); white-space: nowrap; }
.t-table tr:last-child td { border-bottom: 0; }
.t-table th { color: var(--t-muted); font-weight: 600; font-size: .82rem; }
.t-table .t-name { text-align: left; font-weight: 600; white-space: normal; }
.t-table th:nth-child(2) { text-align: left; }
.t-table .t-points { font-weight: 700; }
.t-table tr.through td:first-child { box-shadow: inset 4px 0 0 var(--t-accent); }
.t-matches { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.t-match { position: relative; border: 1px solid var(--t-line); border-radius: 12px; background: var(--t-card); overflow: hidden; }
.t-match.next { border-color: var(--t-accent); box-shadow: 0 0 0 2px var(--t-soft); }
.t-next { display: block; padding: 4px 12px; background: var(--t-accent); color: #06210a; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.t-side { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; min-height: 50px; }
.t-side + .t-side { border-top: 1px solid var(--t-line); }
.t-side .t-name { font-weight: 600; overflow-wrap: anywhere; }
.t-side.open .t-name { color: var(--t-muted); font-weight: 400; font-style: italic; }
.t-side.won { background: var(--t-soft); }
.t-side.won .t-name::after { content: " ✓"; color: var(--t-accent); }
.t-side input { width: 64px; flex: none; padding: 8px 6px; text-align: center; font: inherit; font-weight: 700; font-size: 1.1rem; border-radius: 8px; border: 1px solid var(--t-line); background: transparent; color: var(--t-text); }
.t-score { min-width: 32px; text-align: center; font-weight: 700; font-size: 1.1rem; }
.t-match.bye .t-score { font-weight: 400; font-size: .9rem; color: var(--t-muted); }
.t-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); align-items: end; }
.t-row[hidden], .t-field[hidden] { display: none; }
.t-side .t-name { flex: 1; min-width: 0; }
.t-side select { flex: none; width: auto; min-width: 84px; padding: 8px 6px; font: inherit; font-weight: 700; border-radius: 8px; border: 1px solid var(--t-line); background: var(--t-card); color: var(--t-text); }
.t-time { width: 96px; min-width: 96px; padding: 7px 6px; text-align: center; font: inherit; border-radius: 8px; border: 1px solid var(--t-line); background: transparent; color: var(--t-text); }
.t-bracket { display: grid; gap: 18px; }
@media (min-width: 900px) {
  .t-bracket { grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); align-items: center; }
  .t-bracket .t-matches { grid-template-columns: 1fr; }
}
@media print {
  .t-side input { border: 0; }
  .t-next { display: none; }
}
.t-time::placeholder { opacity: .35; }
