
.koPatchOverlay{position:fixed;inset:0;z-index:10000;background:rgba(8,25,38,.58);display:grid;place-items:center;padding:18px;backdrop-filter:blur(5px)}
.koPatchModal{width:min(1050px,96vw);max-height:92vh;overflow:auto;background:#fff;border-radius:24px;box-shadow:0 28px 80px rgba(0,0,0,.3);border:1px solid #dfe7e3}
.koPatchTop{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 20px;background:linear-gradient(135deg,#102f45,#0b6653);color:#fff;border-radius:24px 24px 0 0}
.koPatchTop small{opacity:.75;font-weight:800}.koPatchTop h2{margin:3px 0 0;font-size:24px}
.koPatchClose{width:40px;height:40px;border:1px solid rgba(255,255,255,.25);border-radius:14px;background:rgba(255,255,255,.12);color:#fff;font-size:27px;cursor:pointer}
.koPatchBody{padding:20px}
.koPatchStats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px}.koPatchStats>div{background:#f5f8f7;border:1px solid #dfe7e3;border-radius:14px;padding:11px}.koPatchStats small{display:block;color:#68768a;font-size:10px;font-weight:900;text-transform:uppercase}.koPatchStats b{display:block;margin-top:3px;font-size:20px;color:#10233a}
.koPatchInfo{display:grid;gap:4px;padding:12px 14px;border-radius:14px;background:#f3f0fb;border:1px solid #ded5f4;color:#4c3a75;margin-bottom:18px}.koPatchInfo span{font-size:13px;line-height:1.45}
.koPatchBody h3{margin:18px 0 10px;color:#10233a}
.koPatchSeeds{display:grid;gap:7px}.koPatchSeedRow{display:grid;grid-template-columns:34px minmax(0,1fr) auto 160px;gap:9px;align-items:center;padding:9px 10px;border:1px solid #e1e8e4;border-radius:13px}.koPatchSeedRow .rank{width:30px;height:30px;display:grid;place-items:center;border-radius:9px;background:#edf2f6;font-weight:900;color:#516173}.koPatchSeedRow .player{min-width:0}.koPatchSeedRow .player b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#10233a}.koPatchSeedRow .player small{display:block;color:#758190;margin-top:2px}.koPatchSeedRow .bye{padding:4px 8px;border-radius:999px;background:#e9f7ef;border:1px solid #bde3ca;color:#0b6b50;font-size:10px;font-weight:900}.koPatchSeedRow select{width:100%;padding:9px;border:1px solid #ccd9d2;border-radius:10px;background:#fff}
.koPatchPairs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.koPatchPair{padding:11px;border:1px solid #dfe7e3;border-radius:14px;background:linear-gradient(180deg,#fff,#f7faf8)}.koPatchPair .head{display:flex;justify-content:space-between;color:#7b8794;font-size:10px;font-weight:900;text-transform:uppercase;margin-bottom:8px}.koPatchPair .head b{color:#0b6b50}.koPatchPair .side{display:flex;align-items:center;gap:8px}.koPatchPair .side span{min-width:60px;padding:3px 7px;border-radius:999px;background:#edf2f6;color:#596978;text-align:center;font-size:10px;font-weight:900}.koPatchPair .side b{color:#10233a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.koPatchPair .isBye{opacity:.62}.koPatchPair .vs{margin:4px 0 4px 68px;font-size:9px;color:#98a2ad;font-weight:900}
.koPatchFooter{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:18px;padding-top:15px;border-top:1px solid #e4ebe7}.koPatchFooter p{margin:0;color:#68768a;font-size:12px;line-height:1.4;max-width:650px}.koPatchCreate{border:0;border-radius:13px;padding:12px 16px;background:#0b6b50;color:#fff;font-weight:900;cursor:pointer;white-space:nowrap}.koPatchCreate:disabled{opacity:.6;cursor:wait}
@media(max-width:720px){.koPatchOverlay{padding:8px}.koPatchModal{width:100%;max-height:96vh;border-radius:19px}.koPatchTop{padding:14px 15px;border-radius:19px 19px 0 0}.koPatchTop h2{font-size:20px}.koPatchBody{padding:13px}.koPatchStats{grid-template-columns:repeat(2,1fr)}.koPatchSeedRow{grid-template-columns:30px minmax(0,1fr) auto}.koPatchSeedRow select{grid-column:2/-1}.koPatchPairs{grid-template-columns:1fr}.koPatchFooter{display:grid}.koPatchCreate{width:100%}}

/* v40.4 – transparente KO-Logik */
.koPatchLogicInfo{display:grid;gap:7px}
.koPatchLogicInfo span{display:block;line-height:1.45}
.koPatchLogicInfo strong{color:#3f2d6e}
.koPatchByeExplanation{display:flex;align-items:center;gap:12px;margin:12px 0 18px;padding:12px 14px;border:1px solid #e7cf73;border-radius:15px;background:linear-gradient(135deg,#fff9df,#fffdf4)}
.koPatchByeExplanation>span{flex:0 0 auto;padding:6px 9px;border-radius:999px;background:#f4c84f;color:#4b3900;font-size:11px;font-weight:950;text-transform:uppercase;letter-spacing:.04em}
.koPatchByeExplanation>div{min-width:0;display:grid;gap:3px}
.koPatchByeExplanation b{color:#2e3d32}
.koPatchByeExplanation small{color:#6f6c56;font-size:11px;line-height:1.35}
.koPatchMessages{display:grid;gap:5px;margin:10px 0;padding:10px 12px;border-radius:13px;font-size:11.5px;font-weight:750;line-height:1.4}
.koPatchMessages.error{border:1px solid #e8b7b7;background:#fff0f0;color:#942f2f}
.koPatchMessages.warning{border:1px solid #ead395;background:#fff8e8;color:#765812}
.koPatchPairReason{margin-top:8px;padding-top:7px;border-top:1px solid #e6ece8;color:#69776f;font-size:10px;font-weight:750}
.koPatchPair.sameGroupWarning{border-color:#df9a9a;background:#fff7f7}
.koPatchPair.sameGroupWarning .koPatchPairReason{color:#9a3232;font-weight:900}
.koPatchCreate:disabled{opacity:.48;cursor:not-allowed;box-shadow:none}

@media(max-width:700px){
  .koPatchByeExplanation{align-items:flex-start;padding:10px 11px}
  .koPatchByeExplanation>span{font-size:9.5px}
  .koPatchByeExplanation small{font-size:10px}
  .koPatchLogicInfo span{font-size:11px}
}

/* v40.5 – Setzliste nur Baumposition + kompletter scrollbarer Turnierbaum */
.koTreeHint{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  column-gap:9px;
  row-gap:2px;
  align-items:center;
  margin:8px 0 10px;
  padding:10px 12px;
  border:1px solid #cfe2d8;
  border-radius:13px;
  background:#f3f9f6;
  color:#275548;
}
.koTreeHint>span{
  grid-row:1/3;
  width:31px;
  height:31px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:#0b6b50;
  color:#fff;
  font-size:17px;
  font-weight:950;
}
.koTreeHint b{font-size:12px}
.koTreeHint small{color:#6b7a73;font-size:10.5px;line-height:1.35}

.koTreeScroller{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  padding:2px 2px 13px;
  scroll-snap-type:x proximity;
  overscroll-behavior-x:contain;
  scrollbar-width:thin;
  scrollbar-color:#9db8ac #edf3f0;
}
.koTreeScroller::-webkit-scrollbar{height:8px}
.koTreeScroller::-webkit-scrollbar-track{background:#edf3f0;border-radius:999px}
.koTreeScroller::-webkit-scrollbar-thumb{background:#9db8ac;border-radius:999px}

.koTreeBoard{
  min-width:max-content;
  display:flex;
  align-items:stretch;
  gap:18px;
}
.koTreeRound{
  width:245px;
  flex:0 0 245px;
  display:flex;
  flex-direction:column;
  scroll-snap-align:start;
}
.koTreeRoundTitle{
  height:39px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
  padding:0 9px;
  border-radius:11px;
  background:#102f45;
  color:#fff;
}
.koTreeRoundTitle b{font-size:12px}
.koTreeRoundTitle span{font-size:9.5px;opacity:.72}

.koTreeGames{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:space-around;
  gap:10px;
  min-height:155px;
}
.koTreeGames-8{min-height:790px}
.koTreeGames-4{min-height:790px}
.koTreeGames-2{min-height:790px}
.koTreeGames-1{min-height:790px}

.koTreeGame{
  position:relative;
  min-height:84px;
  padding:9px 10px 8px;
  border:1px solid #dce6e1;
  border-radius:13px;
  background:#fff;
  box-shadow:0 5px 14px rgba(16,47,69,.055);
}
.koTreeGame::after{
  content:"";
  position:absolute;
  top:50%;
  right:-19px;
  width:18px;
  height:1px;
  background:#bfd0c8;
}
.koTreeRound:last-child .koTreeGame::after{display:none}
.koTreeGame.future{
  background:linear-gradient(145deg,#f7faf8,#fff);
}
.koTreeGameHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:6px;
  color:#65736d;
  font-size:9.5px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.koTreeGameHead em{
  padding:3px 6px;
  border-radius:999px;
  background:#fff3c7;
  color:#785a00;
  font-style:normal;
  font-size:8.5px;
}
.koTreePlayer,
.koTreeSource{
  min-height:28px;
  display:flex;
  align-items:center;
  gap:6px;
  padding:5px 7px;
  border-radius:8px;
  background:#f1f5f3;
  color:#183b31;
  font-size:10.5px;
}
.koTreePlayer+.koTreePlayer,
.koTreeSource+.koTreeSource{margin-top:4px}
.koTreePlayer b{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.koTreePlayer.bye{opacity:.58}
.koTreeSource{
  color:#53645c;
  font-weight:800;
}
.koTreeSeed{
  flex:0 0 auto;
  min-width:25px;
  padding:3px 5px;
  border-radius:999px;
  background:#6a4bb0;
  color:#fff;
  text-align:center;
  font-size:8.5px;
  font-weight:950;
}
.koTreeGame>small{
  display:block;
  margin-top:6px;
  color:#7b8882;
  font-size:8.8px;
  font-weight:750;
}

@media(max-width:700px){
  .koTreeRound{width:215px;flex-basis:215px}
  .koTreeBoard{gap:14px}
  .koTreeGames-8,
  .koTreeGames-4,
  .koTreeGames-2,
  .koTreeGames-1{min-height:720px}
  .koTreeGame{min-height:78px;padding:8px}
  .koTreeGame::after{right:-15px;width:14px}
  .koTreeHint{padding:9px 10px}
  .koTreeHint small{font-size:9.5px}
}
