#kpm-axis{
  background:#fffaf0;
  border:1px solid #dfbc7a;
  border-radius:18px;
  padding:18px 18px 14px;
  margin:18px 0;
  color:#52391d;
  box-shadow:0 8px 24px rgba(117,68,13,.06);
}
.kpm-head{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:8px}
.kpm-title-wrap h2{margin:0!important;border:0!important;padding:0!important;background:none!important;font-size:2rem;line-height:1.15;color:#163765}
.kpm-copy{
  background:#fff;
  border:1px solid #d3a35b;
  border-radius:12px;
  padding:9px 16px;
  color:#9a6522;
  cursor:pointer;
  font-weight:800;
  min-width:140px;
}
.kpm-copy:disabled{opacity:.55;cursor:default}
.kpm-status{
  margin-top:12px;
  padding:12px 14px;
  border-radius:12px;
  background:#fff;
  border:1px solid #eedebf;
  color:#70563a;
  font-size:1.05rem;
  line-height:1.7;
}
.kpm-results{margin-top:10px}
.kpm-table-wrap{overflow-x:auto;margin-top:10px}
#kpm-axis table{min-width:1180px;width:100%;border-collapse:collapse;background:#fff;border-radius:14px;overflow:hidden}
#kpm-axis thead th{background:#efe5d0;color:#724313;padding:12px 10px;border:1px solid #e2d3b7;white-space:nowrap;text-align:left;font-weight:900}
#kpm-axis tbody td{padding:13px 10px;border:1px solid #e7dbc4;white-space:nowrap;text-align:left;background:#fff;vertical-align:middle}
#kpm-axis tbody tr.kpm-row-final td{background:#fffdf7}
#kpm-axis tbody tr:hover td{background:#fffcf3}
.kpm-grade-cell{display:flex;align-items:center;gap:8px;min-width:92px}
.kpm-grade{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:34px;padding:0 12px;border:1px solid;border-radius:10px;font-weight:900;font-size:1.1rem}
.kpm-score{font-size:.88rem;color:#77614d}
.kpm-S{color:#8b5600;background:#fff2bb}.kpm-A{color:#1d6080;background:#eef8ff}.kpm-B{color:#3e6849;background:#eef6ed}.kpm-C{color:#666;background:#f4f4f4}
.kpm-time{font-weight:900;color:#6b3d0c;margin-right:8px}
.kpm-state{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 8px;border-radius:999px;border:1px solid;font-size:.86rem;font-weight:900}
.kpm-final{background:#fff2cf;border-color:#d5a03d;color:#9a5a09}
.kpm-live{background:#eef7ff;border-color:#7cb1e8;color:#1d6080}
.kpm-name{font-weight:900;color:#17304f;white-space:normal;min-width:180px}
.kpm-ev{font-weight:900;color:#a24e00}
.kpm-race-note{font-size:.82rem;color:#756b5f;margin:4px 0}
#kpm-axis a{color:#0e5ea8;text-decoration:none;font-weight:800}
#kpm-axis a:hover{text-decoration:underline}
#keiba-all-local.kpm-ready .battle-admin,#keiba-all-local.kpm-ready .keiba-battle-panel{display:none!important}

/* compact rounded model selector; remains immediately above the race probability tabs */
#keiba-all-local .race-card .kpm-race-switch{
 display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px;
 padding:8px 12px 10px;margin:0;background:#fff;border:0;
}
#keiba-all-local .race-card .kpm-race-switch .kpm-switch-button{
 appearance:none;font-family:inherit;font-size:12px!important;line-height:1.4!important;
 font-weight:650!important;letter-spacing:0!important;border:1px solid #cbd9ec!important;
 border-radius:999px!important;background:#fff!important;color:#3b5776!important;
 padding:5px 11px!important;min-height:30px!important;min-width:0!important;
 width:auto!important;height:auto!important;box-shadow:none!important;cursor:pointer;
}
#keiba-all-local .race-card .kpm-race-switch .kpm-switch-button[aria-pressed="true"]{
 background:#e6f0ff!important;color:#1559bb!important;border-color:#5c98ef!important;
 box-shadow:inset 0 0 0 1px #5c98ef!important;
}
#keiba-all-local .race-card .kpm-race-switch .kpm-switch-button:disabled{opacity:.4;cursor:not-allowed}
#keiba-all-local .race-card .kpm-race-switch .kpm-switch-button:focus-visible{outline:2px solid #2475dd;outline-offset:2px}
#keiba-all-local .kpm-race-note{display:none!important}
/* keep the ticket toggle alongside the simulation control */
#keiba-all-local .race-card .katc-v3-open.kpm-buy-relocated{
 display:inline-flex!important;min-height:52px!important;border-radius:12px!important;
 border:1px solid #a9c9ff!important;background:#edf5ff!important;color:#1464d2!important;
 padding:10px 18px!important;font-size:16px!important;font-weight:850!important;
 vertical-align:middle;white-space:nowrap;
}
/* the hole panel contains only a horse number/name and one graded signal */
#keiba-all-local .race-card .katc-v3-horse-panel .katc-v3-head,
#keiba-all-local .race-card .katc-v3-horse-panel .katc-v3-label,
#keiba-all-local .race-card .katc-v3-horse-panel .katc-v3-meta,
#keiba-all-local .race-card .katc-v3-horse-panel .katc-v3-note{display:none!important}
#keiba-all-local .race-card .katc-v3-horse-panel{background:#fffaf0!important;padding:10px 12px!important;border-radius:13px!important}
#keiba-all-local .race-card .katc-v3-horse-result{
 display:flex;align-items:center;flex-wrap:wrap;justify-content:space-between;gap:8px;
 padding:12px 14px!important;border-radius:11px!important;
}
#keiba-all-local .race-card .katc-v3-horse-result .katc-v3-main{
 font-size:17px!important;color:#163765!important;font-weight:900!important;
}
#keiba-all-local .race-card .kpm-hole-grade{
 display:inline-flex;align-items:center;justify-content:center;min-width:76px;
 padding:5px 11px;border:1px solid;border-radius:999px;font-size:13px;
 line-height:1.4;font-weight:900;white-space:nowrap;
}
#keiba-all-local .race-card .kpm-hole-S{color:#855300;border-color:#ddb65b;background:#fff1b8}
#keiba-all-local .race-card .kpm-hole-A{color:#146b46;border-color:#a9d9bd;background:#e7f7ee}
#keiba-all-local .race-card .kpm-hole-B{color:#1559bb;border-color:#bad5ff;background:#eaf3ff}
#keiba-all-local .race-card .kpm-hole-C{color:#815515;border-color:#ead09b;background:#fff5e0}
#keiba-all-local .race-card .kpm-hole-D{color:#68717a;border-color:#d0d6db;background:#f2f4f6}
@media(max-width:860px){.kpm-title-wrap h2{font-size:1.65rem}}
@media(max-width:650px){
  #kpm-axis{padding:14px 14px 12px}
  .kpm-head{align-items:flex-start}
  .kpm-title-wrap h2{font-size:1.45rem}
  .kpm-copy{min-width:auto;padding:8px 12px}
  .kpm-status{font-size:.9rem}
  #kpm-axis table{min-width:980px}
  #kpm-axis thead th,#kpm-axis tbody td{padding:10px 8px}
  .kpm-grade{min-width:34px;height:30px;font-size:1rem;padding:0 10px}
  .kpm-state{min-width:24px;height:24px;padding:0 6px;font-size:.78rem}
  .kpm-name{min-width:130px}
  #keiba-all-local .race-card .kpm-race-switch{padding:7px 8px 8px;gap:5px}
  #keiba-all-local .race-card .kpm-race-switch .kpm-switch-button{font-size:11px!important;padding:4px 7px!important}
  #keiba-all-local .race-card .katc-v3-open.kpm-buy-relocated{min-height:42px!important;padding:7px 11px!important;font-size:12px!important}
}

/* v4: ticket / hole controls inline, opened panels immediately BELOW the action row. */
#keiba-all-local .race-card .katc-v3-race.kpm-ticket-below-toolbar{
  display:block!important;
  clear:both;
  width:auto;
  margin:0 12px 12px!important;
  padding:0!important;
}
#keiba-all-local .race-card .katc-v3-race.kpm-ticket-below-toolbar > .katc-v3-actions:empty{
  display:none!important;
}
#keiba-all-local .race-card .katc-v3-race.kpm-ticket-below-toolbar > .katc-v3-menu{
  margin-top:7px;
}
#keiba-all-local .race-card .katc-v3-open.kpm-hole-relocated{
  display:inline-flex!important;
  align-items:center;
  min-height:52px!important;
  border-radius:12px!important;
  padding:10px 18px!important;
  font-size:16px!important;
  font-weight:850!important;
  vertical-align:middle;
  white-space:nowrap;
}
@media(max-width:650px){
 #keiba-all-local .race-card .katc-v3-open.kpm-hole-relocated{
   min-height:42px!important;
   padding:7px 11px!important;
   font-size:12px!important;
 }
}


/* v5: prevent header/body text overlap in the EV axis candidate table */
#kpm-axis .kpm-table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}
#kpm-axis .kpm-candidate-table{
  table-layout:fixed;
  min-width:1500px;
  width:1500px;
}
#kpm-axis .kpm-candidate-table th,
#kpm-axis .kpm-candidate-table td{
  box-sizing:border-box;
  overflow:hidden;
  text-overflow:ellipsis;
}
#kpm-axis .kpm-candidate-table td{
  line-height:1.35;
}
#kpm-axis .kpm-candidate-table th:nth-child(1),
#kpm-axis .kpm-candidate-table td:nth-child(1){width:135px;}
#kpm-axis .kpm-candidate-table th:nth-child(2),
#kpm-axis .kpm-candidate-table td:nth-child(2){width:135px;}
#kpm-axis .kpm-candidate-table th:nth-child(3),
#kpm-axis .kpm-candidate-table td:nth-child(3){width:120px;}
#kpm-axis .kpm-candidate-table th:nth-child(4),
#kpm-axis .kpm-candidate-table td:nth-child(4){width:95px;}
#kpm-axis .kpm-candidate-table th:nth-child(5),
#kpm-axis .kpm-candidate-table td:nth-child(5){width:95px;}
#kpm-axis .kpm-candidate-table th:nth-child(6),
#kpm-axis .kpm-candidate-table td:nth-child(6){width:240px;}
#kpm-axis .kpm-candidate-table th:nth-child(7),
#kpm-axis .kpm-candidate-table td:nth-child(7),
#kpm-axis .kpm-candidate-table th:nth-child(8),
#kpm-axis .kpm-candidate-table td:nth-child(8),
#kpm-axis .kpm-candidate-table th:nth-child(9),
#kpm-axis .kpm-candidate-table td:nth-child(9),
#kpm-axis .kpm-candidate-table th:nth-child(10),
#kpm-axis .kpm-candidate-table td:nth-child(10),
#kpm-axis .kpm-candidate-table th:nth-child(11),
#kpm-axis .kpm-candidate-table td:nth-child(11),
#kpm-axis .kpm-candidate-table th:nth-child(12),
#kpm-axis .kpm-candidate-table td:nth-child(12){width:135px;}
#kpm-axis .kpm-candidate-table th:nth-child(13),
#kpm-axis .kpm-candidate-table td:nth-child(13){width:90px;}
#kpm-axis .kpm-candidate-table td:nth-child(2),
#kpm-axis .kpm-candidate-table td:nth-child(3),
#kpm-axis .kpm-candidate-table td:nth-child(4),
#kpm-axis .kpm-candidate-table td:nth-child(5),
#kpm-axis .kpm-candidate-table td:nth-child(7),
#kpm-axis .kpm-candidate-table td:nth-child(8),
#kpm-axis .kpm-candidate-table td:nth-child(9),
#kpm-axis .kpm-candidate-table td:nth-child(10),
#kpm-axis .kpm-candidate-table td:nth-child(11),
#kpm-axis .kpm-candidate-table td:nth-child(12),
#kpm-axis .kpm-candidate-table td:nth-child(13){
  font-variant-numeric:tabular-nums;
}
#kpm-axis .kpm-candidate-table td:nth-child(6){
  white-space:normal;
  word-break:break-word;
}
#kpm-axis .kpm-candidate-table td:nth-child(7),
#kpm-axis .kpm-candidate-table td:nth-child(8),
#kpm-axis .kpm-candidate-table td:nth-child(9),
#kpm-axis .kpm-candidate-table td:nth-child(10),
#kpm-axis .kpm-candidate-table td:nth-child(11),
#kpm-axis .kpm-candidate-table td:nth-child(12){
  text-align:center;
}
#kpm-axis .kpm-candidate-table .kpm-grade-cell{
  min-width:0;
  flex-wrap:nowrap;
}
#kpm-axis .kpm-candidate-table .kpm-name{
  display:block;
  min-width:0;
  max-width:none;
}
@media(max-width:650px){
  #kpm-axis .kpm-candidate-table{min-width:1320px;width:1320px;}
  #kpm-axis .kpm-candidate-table th:nth-child(6),
  #kpm-axis .kpm-candidate-table td:nth-child(6){width:210px;}
}
