.cg-wrap {
    box-sizing: content-box;
    position: relative;
    display: block;
}

/* 8x8 */
.cg-wrap.cg-512 {
    padding-bottom: 100%;
}
.cg-wrap.cg-512.mini {
  width: 256px;
}
/* 10x8 */
.cg-wrap.cg-640 {
    padding-bottom: calc(512 * 100% / 640);
}
.cg-wrap.cg-640.mini {
  width: 320px;
}

/* 9x9 */
.cg-wrap.cg-576 {
    padding-bottom: calc(1200 * 100% / 1100);
}
.cg-wrap.cg-576.mini {
  width: 304px;
}
/* 7x7 shogi */
.cg-wrap.cg-448-516 {
    padding-bottom: calc(420 * 100% / 364);
}
.cg-wrap.cg-448-516.mini {
  width: 224px;
}
/* 5x6 */
.cg-wrap.cg-260-360 {
    padding-bottom: calc(540 * 100% / 390);
}
.cg-wrap.cg-260-360.mini {
  width: 192px;
}
/* 5x5 */
.cg-wrap.cg-260 {
    padding-bottom: calc(450 * 100% / 390);
}
.cg-wrap.cg-260.mini {
  width: 192px;
}
/* 3x4 */
.cg-wrap.cg-156 {
    padding-bottom: calc(480 * 100% / 312);
}
.cg-wrap.cg-156.mini {
  width: 132px;
}

/* 7x7 */
.cg-wrap.cg-448 {
    padding-bottom: 100%;
}
.cg-wrap.cg-448.mini {
  width: 224px;
}
/* 9x10 */
.cg-wrap.cg-576-640, .cg-wrap.cg-borderlands {
    padding-bottom: calc(640 * 100% / 576);
}
.cg-wrap.cg-576-640.mini, .cg-wrap.cg-borderlands.mini {
  width: 288px;
}
/* 9x10 Janggi */
.cg-wrap.cg-janggi {
    padding-bottom: 100%;
}
.cg-wrap.cg-janggi.mini {
    width: 320px;
}
/* 10x10 */
.cg-wrap.cg-640-640 {
    padding-bottom: 100%;
}
.cg-wrap.cg-640-640.mini {
  width: 320px;
}
/* 9x9 chak */
.cg-wrap.cg-540 {
    padding-bottom: 100%;
}
.cg-wrap.cg-540.mini {
  width: 270px;
}

/* tooltip board in seek table */
.cg-wrap.minitooltip {
  width: 200px;
}

cg-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: block;
    top: 0;
    right: 0;
}

cg-board {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  line-height: 0;
  background-size: cover;
  cursor: pointer;
}
cg-board square {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  pointer-events: none;
}
.cg-640 cg-board square{
  width: 10%;
  height: 12.5%;
}
.cg-576 cg-board square{
  width: 11.11%;
  height: 11.11%;
}
/* 7x7 shogi */
.cg-448-516 cg-board square{
  width: 14.2857%;
  height: 14.2857%;
}
.cg-260-360 cg-board square{
  width: 20%;
  height: 16.66%;
}
.cg-260 cg-board square{
  width: 20%;
  height: 20%;
}
.cg-156 cg-board square{
  width: 33.33%;
  height: 25%;
}
.cg-448 cg-board square{
  width: 14.28%;
  height: 14.28%;
}
.cg-576-640 cg-board square, .cg-borderlands cg-board square{
  width: 11.11%;
  height: 10%;
}
.cg-janggi cg-board square{
  width: 11.11%;
  height: 10%;
}
.cg-640-640 cg-board square{
  width: 10%;
  height: 10%;
}
/* 9x9 chak */
.cg-540 cg-board square{
  width: 11.11%;
  height: 11.11%;
}

cg-board square.move-dest {
  background: radial-gradient(rgba(20, 85, 30, 0.5) 22%, #208530 0, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 0);
  pointer-events: auto;
}
cg-board square.premove-dest {
  background: radial-gradient(rgba(20, 30, 85, 0.5) 22%, #203085 0, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 0);
}
cg-board square.oc.move-dest {
  background: radial-gradient(transparent 0%, transparent 80%, rgba(20, 85, 0, 0.3) 80%);
}
cg-board square.oc.premove-dest {
  background: radial-gradient(transparent 0%, transparent 80%, rgba(20, 30, 85, 0.2) 80%);
}
cg-board square.move-dest:hover {
  background: rgba(20, 85, 30, 0.3);
}
cg-board square.premove-dest:hover {
  background: rgba(20, 30, 85, 0.2);
}
cg-board square.last-move {
  will-change: transform;
  background-color: rgba(155, 199, 0, 0.41);
}
cg-board square.selected {
  background-color: rgba(20, 85, 30, 0.5);
}
cg-board square.check {
  background: radial-gradient(ellipse at center, rgba(255, 0, 0, 1) 0%, rgba(231, 0, 0, 1) 25%, rgba(169, 0, 0, 0) 89%, rgba(158, 0, 0, 0) 100%);
}
cg-board square.current-premove {
  background-color: rgba(20, 30, 85, 0.5);
}
.cg-wrap piece {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  background-size: cover;
  z-index: 2;
  will-change: transform;
  pointer-events: none;
}
.shogi .cg-wrap piece, .kyoto .cg-wrap piece, .dobutsu .cg-wrap piece, .tori .cg-wrap piece, .cannonshogi .cg-wrap piece, .janggi .cg-wrap piece {
  background-position: center;
}
.cg-wrap.cg-640 piece {
  width: 10%;
  height: 12.5%;
}
.cg-wrap.cg-576 piece {
  width: 11.11%;
  height: 11.11%;
}
/* 7x7 shogi */
.cg-wrap.cg-448-516 piece{
  width: 14.2857%;
  height: 14.2857%;
}
.cg-wrap.cg-260-360 piece {
  width: 20%;
  height: 16.66%;
}
.cg-wrap.cg-260 piece {
  width: 20%;
  height: 20%;
}
.cg-wrap.cg-156 piece {
  width: 33.33%;
  height: 25%;
}
.cg-wrap.cg-448 piece {
  width: 14.28%;
  height: 14.28%;
}
.cg-wrap.cg-576-640 piece, .cg-wrap.cg-borderlands piece{
  width: 11.11%;
  height: 10%;
}
.cg-wrap.cg-janggi piece{
  width: 11.11%;
  height: 10%;
}
.cg-wrap.cg-640-640 piece{
  width: 10%;
  height: 10%;
}
.cg-wrap.cg-540 piece{
  width: 11.11%;
  height: 11.11%;
}

cg-board piece.dragging {
  cursor: move;
  z-index: 9;
}

piece.anim {
  z-index: 8;
}

piece.fading {
  z-index: 1;
  opacity: 0.5;
}

.cg-wrap piece.ghost {
  opacity: 0.3;
}

.cg-wrap piece svg {
  overflow: hidden;
  position: relative;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.6;
}

.cg-wrap cg-auto-pieces,
.cg-wrap .cg-shapes,
.cg-wrap .cg-custom-svgs {
  overflow: hidden;
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cg-wrap cg-auto-pieces {
  z-index: 2;
}

.cg-wrap cg-auto-pieces piece {
  opacity: 0.3;
}

.cg-wrap .cg-shapes {
  overflow: hidden;
  opacity: 0.6;
  z-index: 2;
}

.cg-wrap .cg-custom-svgs {
  /* over piece.anim = 8, but under piece.dragging = 10 */
  z-index: 9;
}

.cg-wrap .cg-custom-svgs svg {
  overflow: visible;
}

.cg-wrap coords {
  position: absolute;
  display: flex;
  pointer-events: none;
  opacity: 0.8;
  font-size: 0.85em;
  font-weight: bold;
}
/* hide coords */
@media (max-width: 799px) and (orientation: portrait) {
    .cg-wrap coords {
        display: none;
    }
}
.cg-wrap coords.side {
  right: var(--ranks-right);
  top: var(--ranks-top);
  height: 100%;
  width: 12px;
}
.cg-wrap coords.side.forward, .cg-wrap coords.side.backward.black {
  flex-flow: column-reverse;
}
.cg-wrap coords.side.backward, .cg-wrap coords.side.forward.black {
  flex-flow: column;
}
.cg-wrap coords.bottom {
  bottom: var(--files-bottom);
  left: var(--files-left);
  width: 100%;
  height: 16px;
  text-align: center;
}
.cg-wrap coords.top {
  top: var(--files-top);
  left: var(--files-left);
  width: 100%;
  height: 16px;
  text-align: center;
}
.cg-wrap coords.bottom.forward, .cg-wrap coords.bottom.backward.black, .cg-wrap coords.top.forward, .cg-wrap coords.top.backward.black {
  flex-flow: row;
}
.cg-wrap coords.bottom.backward, .cg-wrap coords.bottom.forward.black, .cg-wrap coords.top.backward, .cg-wrap coords.top.forward.black {
  flex-flow: row-reverse;
}
.cg-wrap coords coord {
  flex: 1 1 auto;
}
@media (min-width: 800px) and (min-height: 500px) {
    .cg-wrap coords.side coord {
      transform: translateY(39%);
    }
}
