:root {
  --ranks-top: 0px;
  --ranks-right: -15px;
  --ranks-left: -8px;
  --files-top: -15px;
  --files-bottom: -16px;
  --files-left: 0px;
  --ranks-top-shogi: -25px;
  --files: 8;
  --ranks: 8;
  --editorLength: 6;
  --pocketLength: 5;
  --pocketMargin: 10px;
  --movelist-max-height: 8rem;
}
.mini .pocket {
    width: 100%;
    justify-content: center;
}
.mini .pocket square {
    flex: 0 0 calc(100% / max(var(--files), var(--pocketLength)));
}
.mini .pocket.top {
    border-radius: 3px 3px 0px 0px;
    position: absolute;
    top: calc(-100% / var(--ranks));
}
.mini .pocket.bottom {
    border-radius: 3px 3px 0px 0px;
    position: absolute;
    bottom: calc(-100% / var(--ranks));
}
.mini .pocket piece::after {
    padding: 1px 0.1em;
}
#extension_choice {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  background: rgba(250, 250, 250, 0.7);
  text-align: center;
  z-index: 5;
}
#extension_choice square {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  cursor: pointer;
  border-radius: 50%;
  background-color: #b0b0b0;
  box-shadow: inset 0 0 25px 3px #808080;
  box-sizing: border-box;
  transition: 0.2s;
}
.cg-640 #extension_choice square {
  width: 10%;
}
.cg-576 #extension_choice square {
  height: 11.11%;
  width: 11.11%;
}
.cg-540 #extension_choice square {
  height: 11.11%;
  width: 11.11%;
}
.cg-448-516  #extension_choice square {
  width: 14.2857%;
  height: 14.2857%;
}
.cg-640-640 #extension_choice square {
  height: 10%;
  width: 10%;
}
.cg-260-360 #extension_choice square {
  width: 20%;
  height: 16.66%;
}
.cg-260 #extension_choice square {
  height: 20%;
  width: 20%;
}
.cg-156 #extension_choice square {
  height: 25%;
  width: 33.33%;
}
#extension_choice piece {
  pointer-events: auto;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: 0.2s;
  transform: scale(0.8);
}
#extension_choice square:hover {
  box-shadow: inset 0 0 48px 8px #d85000;
  border-radius: 0%;
  transform: none;
}

.cg-wrap.pocket {
  display: inline;
}

.pocket {
  width: calc(var(--pocketLength) * (var(--cg-width) / var(--files)));
  height: calc(var(--cg-height) / var(--ranks));
  border-radius: 3px;
  box-shadow: 0 2px 3px rgba(0,0,0,0.3) inset;
  background: #888;
  white-space: nowrap;
  display: flex;
  --fs: calc(var(--cg-height) / var(--ranks));
  font-size: var(--fs);
  padding-bottom: 1px;
}
.pocket.top {
  margin-bottom: var(--pocketMargin);
}
.pocket.top.editor {
  margin-bottom: 18px;
  flex-wrap: wrap-reverse;
}
.pocket.bottom {
  margin-top: var(--pocketMargin);
}
.pocket.bottom.editor {
  margin-top: 18px;
}
.pocket .editor{
  width: calc(var(--editorLength) * (var(--cg-width) / var(--files)));
}

.pocket square, .pocket nosquare {
  flex: 0 0 calc(100% / var(--pocketLength));
  position: relative !important;
  pointer-events: none;
}

.pocket piece {
  height: 100% !important;
  width: 100% !important;
  background-position: center;
  pointer-events: auto;
}

.pocket square.selected-square{
  background-color: #14551e80 !important;
}

.pocket.usable square:first-child:hover {
  border-radius: 3px 0 0 3px;
}
.pocket.usable square {
  cursor: pointer;
}
.pocket.usable square:hover {
  background-color: #999;
  transition: background-color 0.13s;
}
.pocket.usable square.premove {
  background-color: #555;
}
.pocket.usable square.premove:hover {
  background-color: #666;
}
.pocket square.last-move {
  will-change: transform;
  background-color: rgba(155, 199, 0, 0.41);
}
.pocket piece[data-nb='0'] {
  cursor: auto;
  opacity: 0.1;
}
.pocket piece::after {
  content: attr(data-nb);
  bottom: 0;
  right: 0;
  position: absolute;
  line-height: 0.9em;
  padding: 2px 0.2em;
  font-weight: bold;
  border-radius: 2px;
  font-size: 0.3em;
}
.mini .pocket piece::after {
  font-size: 0.4em;
}
.shogi3x4 .mini .pocket piece::after, .shogi5x5 .mini .pocket piece::after, .shogi5x6 .mini .pocket piece::after {
  font-size: 0.3em;
}
.pocket piece[data-nb='0']::after {
  content: none;
}
/* board editor pieces are unlimited */
.pocket piece[data-nb='-1']::after {
  content: none;
}
.pocket piece::after {
  color: #fff !important;
  text-shadow: 0 1px 0 #000 !important;
  background: #d85000 !important;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.15) inset !important;
}

.campmate .cg-512 cg-board::before, .racingkings .cg-512 cg-board::before {
  width: 100%;
  height: 12.5%;
  top: 0%;
  left: 0%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 70%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

.campmate .cg-512 cg-board::after {
  width: 100%;
  height: 12.5%;
  top: 87.5%;
  left: 0%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 70%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

.campmate .cg-540 cg-board::before {
  width: 100%;
  height: 11%;
  top: 0%;
  left: 0%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 70%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

.campmate .cg-540 cg-board::after {
  width: 100%;
  height: 11%;
  top: 89%;
  left: 0%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 70%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

.kingofthehill .cg-512 cg-board::before {
  width: 25%;
  height: 25%;
  box-shadow: 0 0 10px rgba(0,0,0,.7);
  background: rgba(230,230,230,.2);
  content: "";
  position: absolute;
  top: 37.5%;
  left: 37.5%;
  z-index: 1;
  pointer-events: none;
}

.shocking .cg-512 cg-board::before {
  width: 25%;
  height: 100%;
  top: 0%;
  left: 37.5%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 70%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

.melonvariant .cg-512 cg-board::before {
  width: 50%;
  height: 25%;
  top: 0%;
  left: 25%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 80%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

.melonvariant .cg-512 cg-board::after {
  width: 50%;
  height: 25%;
  top: 75%;
  left: 25%;
  background: rgba(230, 230, 230, 0.2);
  box-shadow: 0 0 10px rgb(0 0 0 / 80%);
  content: '';
  z-index: 1;
  position: absolute;
  pointer-events: none;
}

/* Alice chess pieces on the other board */
.alice piece.mirror {
  opacity: 0.2;
  background-color: LightCyan;
  border: 1px solid blue;
}
/* Fog of War fog pieces */
.standard piece.promoted._-piece {
  background-image: url('data:image/svg+xml;base64,PHN2ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0Ny41IDQ3LjUiIHZpZXdCb3g9IjAgMCA0Ny41IDQ3LjUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMzhoMzh2LTM4aC0zOHoiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNhKSIgdHJhbnNmb3JtPSJtYXRyaXgoMS4yNSAwIDAgLTEuMjUgMCA0Ny41KSI+PHBhdGggZD0ibTAgMGE0IDQgMCAwIDAgLTQtNGgtMjhhNCA0IDAgMCAwIC00IDR2MjhhNCA0IDAgMCAwIDQgNGgyOGE0IDQgMCAwIDAgNC00eiIgZmlsbD0iI2E5YTlhOSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMzcgNSkiLz48L2c+PC9zdmc+');
  opacity: 0.7;
}
/* Manchu banner */
.xiangqi piece.m-piece, .manchu piece.m-piece {
  background-color: gold;
  border-radius: 50%;
}
/* Xiangfu king */
.xiangfu piece.pg-piece {
  background-color: gold;
  border-radius: 50%;
}
