#dialog:has(.tournament-board){position:fixed;inset:0;width:100vw;max-width:100vw;height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;margin:0;padding:16px;border:0;border-radius:0;overflow:auto}
#dialog[open]:has(.tournament-board){display:flex;flex-direction:column}
#dialog:has(.tournament-board) .dialog-head{margin-bottom:12px;flex-shrink:0}
#dialog>.tournament-board{display:flex;flex-direction:column;flex:1;min-height:0}
#dialog>.tournament-board>*{flex-shrink:0}
#dialog:has(.tournament-board) .tb-viewport{flex:1;min-height:180px;height:auto}
#dialog:has(.tournament-board) .tb-detail{max-height:20vh;overflow:auto}
#dialog:fullscreen,#dialog.tb-expanded{width:100vw;max-width:100vw;height:100vh;max-height:100vh;border-radius:0}
.tournament-board{--tb-winner:#aedace;--tb-loser:#d7ba77;--tb-final:#efd093;min-width:0}
.tb-toolbar,.tb-selects,.tb-tools{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.tb-toolbar{justify-content:space-between;gap:18px;margin-bottom:13px}
.tb-selects label{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.tb-selects select{padding:8px 28px 8px 10px;min-height:34px;border:1px solid var(--line);border-radius:6px;background:white;color:var(--ink)}
.tb-format{font-size:11px;color:var(--green);padding:7px 10px;background:#eff4e7;border-radius:4px}
.tb-tools{gap:6px}.tb-tools .btn{min-height:34px}.tb-zoom{min-width:47px;text-align:center;font-size:12px;font-variant-numeric:tabular-nums}
.tb-caption{display:flex;justify-content:space-between;gap:15px;color:var(--muted);font-size:11px;margin-bottom:12px;line-height:1.6}
.tb-viewport{height:clamp(340px,58vh,720px);overflow:auto;background:#084b54;border:1px solid #164e50;border-radius:10px;cursor:grab;padding:12px;overscroll-behavior:contain;touch-action:pan-x pan-y;scrollbar-color:#618a78 #123d35;scrollbar-width:thin}
#dialog:fullscreen .tb-viewport,#dialog.tb-expanded .tb-viewport{height:calc(100vh - 275px)}
.tb-viewport.dragging{cursor:grabbing;user-select:none}.tb-size{position:relative;margin:auto;min-width:1px;min-height:1px}.tb-canvas{position:absolute;left:0;top:0;transform-origin:top left}
.tb-lines{position:absolute;left:0;top:0;overflow:visible;pointer-events:none}.tb-edge{fill:none;stroke:var(--tb-winner);stroke-width:1.25;vector-effect:non-scaling-stroke;opacity:.82}.tb-edge.loser{stroke:var(--tb-loser)}.tb-edge.final{stroke:var(--tb-final)}.tb-edge.planned{stroke-dasharray:5 5;opacity:.6}
.tb-label{position:absolute;color:#d5e6c3;font-size:15px;font-weight:600;white-space:nowrap;letter-spacing:.7px}.tb-label.loser{color:#b1d6d8}.tb-label.final{color:#f0d28f}
.tb-match{position:absolute;display:flex;flex-direction:column;justify-content:center;text-align:left;padding:7px 9px;border:1px solid #bdcfa1;border-left:4px solid var(--tb-winner);border-radius:5px;background:#fffef8;color:#173f35;box-shadow:0 2px 4px #031d2520;overflow:hidden;cursor:pointer}
.tb-match.loser{border-color:#8abcb9;border-left-color:var(--tb-loser)}.tb-match.final{border-color:#d8bc70;border-left-color:var(--tb-final);background:#fffbef}
.tb-match:hover,.tb-match.selected{outline:3px solid #fff;outline-offset:2px;filter:none;z-index:2}.tb-match:focus-visible{outline:3px solid #d8ed9e;outline-offset:3px;z-index:2}
.tb-match.planned{background:#28534c;border:1px dashed #87a297;color:#d4e2d6;box-shadow:none}.tb-match.planned .tb-match-head small{color:#b1c6ba;background:#ffffff0b}.tb-match.planned .tb-player+.tb-player{border-color:#ffffff15}
.tb-match-head{display:flex;justify-content:space-between;align-items:center;gap:4px;font-size:10px;line-height:16px;margin-bottom:4px;white-space:nowrap}.tb-match-head b{font-weight:600;overflow:hidden;text-overflow:ellipsis}.tb-match-head small{font-size:8px;color:#658063;background:#eff3e8;border-radius:3px;padding:0 3px}
.tb-player{display:flex;justify-content:space-between;align-items:center;gap:7px;min-height:19px;font-size:12px;line-height:19px}.tb-player>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tb-player strong{font-size:13px;min-width:13px;text-align:right}.tb-player+.tb-player{border-top:1px solid #e7eddf}
.tb-champion{position:absolute;display:flex;align-items:center;justify-content:center;gap:11px;flex-direction:column;border:1px solid #e1bf78;background:#fff8e8;border-radius:5px;color:#755723}.tb-champion small{font-size:12px;letter-spacing:5px}.tb-champion strong{font-size:18px;font-weight:600}
.tb-entrant{position:absolute;background:#fffef8;border:1px solid #c7d6ba;display:flex;align-items:center;justify-content:center;gap:3px;flex-direction:column;overflow:hidden;color:#143d33;border-radius:2px;box-sizing:border-box}.tb-entrant small{font-size:8px;color:#718065}.tb-entrant span{font-size:12px;line-height:1.25;writing-mode:vertical-rl;letter-spacing:2px;white-space:nowrap}
.tb-legend{display:flex;flex-wrap:wrap;gap:18px;font-size:11px;color:var(--muted);padding:13px 2px 8px}.tb-legend>span{display:flex;gap:6px;align-items:center}.tb-key{width:13px;height:8px;display:inline-block;border-radius:2px;background:var(--tb-winner)}.tb-key.loser{background:var(--tb-loser)}.tb-key.final{background:var(--tb-final)}.tb-key.planned{background:none;border:1px dashed #87998b}
.tb-note{font-size:11px;color:var(--muted);line-height:1.8;margin:0 2px 12px}.tb-detail{display:flex;gap:25px;align-items:center;flex-wrap:wrap;background:#f3f6ef;border:1px solid var(--line);border-radius:7px;padding:15px 18px;min-height:58px;font-size:12px;color:var(--muted)}.tb-detail div{display:flex;gap:5px;flex-direction:column}.tb-detail small{font-size:10px;color:var(--muted)}.tb-detail b{font-size:13px;color:var(--green);font-weight:600}.tb-detail b span{font-variant-numeric:tabular-nums;padding:0 8px}.tb-detail p{width:100%;font-size:11px;line-height:1.6}
.tb-state,.tb-empty{padding:90px 20px;text-align:center;font-size:13px;color:var(--muted)}.tb-empty{color:#e2ebdc;cursor:default}.tb-empty b{font-size:18px;font-weight:500}.tb-empty p{margin-top:15px;color:#aec8b8;font-size:12px}.tb-error{padding:16px 18px;line-height:1.8;color:#975034;background:#fff1e8;border-radius:8px;margin-bottom:12px}.tb-error button{margin-left:12px}
.event-bracket-shortcut{display:flex;gap:10px;align-items:center;margin:0 0 18px}.event-bracket-shortcut .metric-def{margin:0}
@media(max-width:760px){#dialog:has(.tournament-board){padding:16px}.tb-toolbar{gap:12px}.tb-selects{gap:10px}.tb-selects label{font-size:11px}.tb-selects select{max-width:165px}.tb-caption{flex-direction:column;gap:4px}.tb-tools{width:100%}.tb-tools .btn{padding:6px 9px}.tb-viewport{height:52vh}.tb-detail{gap:15px}.tb-legend{gap:10px}.tb-format{display:none}}

.tb-match.opening{padding:0;border-left-width:1px;border-radius:3px;justify-content:flex-start}
.tb-opening-pair{display:flex;flex:1;min-height:0;width:100%}.tb-opening-pair>span{display:flex;flex:1;align-items:center;justify-content:space-around;flex-direction:column}.tb-opening-pair>span+span{border-left:1px solid #b8cbb8}.tb-opening-pair small{font-size:9px;color:#718065}.tb-opening-pair em{font-style:normal;font-size:13px;writing-mode:vertical-rl;letter-spacing:2px;max-height:62px;overflow:hidden}.tb-opening-pair strong{font-size:12px}.tb-opening-status{text-align:center;width:100%;font-size:8px;border-top:1px solid #d5dec9;line-height:15px;color:#658063}
.tb-drop{position:absolute;display:flex;flex-direction:column;justify-content:center;padding:3px 8px;box-sizing:border-box;border:1px solid #b79860;border-radius:3px;background:#15565a;color:#f1d59f;overflow:hidden}.tb-drop small{font-size:9px;white-space:nowrap}.tb-drop span{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.poster-board .tb-match.poster-result{padding:3px;border:1px solid #dcebe2;border-radius:9px;background:#f2faf5;color:#174d43;align-items:center;justify-content:center;box-shadow:none;overflow:visible}.poster-name{font-size:14px;font-weight:500;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}.poster-board .tb-match.planned{background:#e8f3ec;color:#58786a;border-style:solid}.poster-board .tb-edge{stroke:#f1f8ed;stroke-width:2.4;opacity:1}.poster-board .tb-edge.planned{stroke-dasharray:none;opacity:.85}.poster-board .tb-entrant{border-radius:9px;background:#f2faf5;border:0}.poster-board .tb-entrant span{font-size:17px;letter-spacing:3px}.poster-board .tb-drop.poster-drop{overflow:visible;padding:3px;align-items:center;background:#f2faf5;color:#174d43;border:0;border-radius:9px}.poster-drop small{position:absolute;top:-23px;color:#fff86a;font-size:17px;font-weight:700}.poster-drop span{font-size:14px}.tb-label.match-number{color:#fff86a;font-size:17px;font-weight:700;width:36px;text-align:center}.tb-label.poster-section{font-size:36px;color:#f5eb36;font-weight:800}.tb-label.poster-title{font-size:28px;color:#f5eb36;font-weight:800}

.tb-viewport:has(.poster-board){background:linear-gradient(135deg,#086b61,#075249)}.tb-label.poster-champion{color:#fff34c;font-size:21px;font-weight:800}
