/* Board canvas — tiles, zones, pawns (inside #idPlayArea01) */

#idPlayBoardBackground {
  position: absolute;
  top: 0;
  left: 0;
  background: #d4897a;
  border: 4px solid #a85f52;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  z-index: 0;
}

.clsPrivateAreaPlayers {
  position: absolute;
  z-index: 1;
  background: rgba(107, 77, 138, 0.12);
  border: 2px dashed #6b4d8a;
  border-radius: 6px;
  box-sizing: border-box;
  pointer-events: none;
}

.clsPrivateAreaPlayers::after {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #4a3560;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  content: attr(data-label);
}

.clsPrivateAreaPlayers[data-player="1"] {
  background: rgba(90, 61, 122, 0.14);
}

.clsHomeLabel {
  position: absolute;
  z-index: 4;
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 700;
  color: #3d2a52;
  background: rgba(255, 248, 220, 0.92);
  border: 1px solid #6b4d8a;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}

.clsHomeLabel[data-player="1"] { border-color: rgba(216, 60, 110, 0.95); } /* pink  */
.clsHomeLabel[data-player="2"] { border-color: rgba(48, 110, 220, 0.95); } /* blue  */
.clsHomeLabel[data-player="3"] { border-color: rgba(220, 50, 50, 0.95);  } /* red   */
.clsHomeLabel[data-player="4"] { border-color: rgba(56, 170, 80, 0.95);  } /* green */

.clsPrivateAreaPlayers[data-player="2"] {
  background: rgba(61, 90, 122, 0.14);
}

.clsPrivateAreaPlayers[data-player="3"] {
  background: rgba(61, 122, 90, 0.12);
}

.clsPrivateAreaPlayers[data-player="4"] {
  background: rgba(122, 90, 61, 0.12);
}

.clsFixedTile,
.clsGameTile {
  position: absolute;
  z-index: 2;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  image-rendering: auto;
}

.clsFixedTile {
  transform-origin: center center;
}

.clsGameTile {
  transition: transform 0.15s ease;
  cursor: pointer;
  /* isolation creates a stacking context so the ::before overlay below
     blends only with this tile's own background (the tile imagery), not
     with neighboring tiles or the board background. */
  isolation: isolate;
}

/* Treasure name on hover — fixed and movable maze tiles */
.clsFixedTile.clsTile--treasure,
.clsGameTile.clsTile--treasure {
  cursor: help;
}

.clsFixedTile.clsTile--treasure::after,
.clsGameTile.clsTile--treasure::after {
  content: attr(data-treasure-name);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  max-width: 92%;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: rgba(28, 18, 42, 0.92);
  color: #fff8ef;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.clsFixedTile.clsTile--treasure:hover::after,
.clsGameTile.clsTile--treasure:hover::after {
  opacity: 1;
}

.clsFixedTile.clsTile--treasure:hover,
.clsGameTile.clsTile--treasure:hover {
  z-index: 10;
}

/*
 * 4-player tile color tinting.
 *
 * The printed tile imagery has only two base colors (Pink for sets 1+2,
 * Blue for sets 3+4) so for a 4-player game we need a way to differentiate
 * 4 distinct colors. Rather than chase the CSS hue-rotate matrix (which
 * gives unpredictable results across different base hues), we paint a
 * solid color overlay on top of each tile with mix-blend-mode: color.
 * That keeps the luminance of the original tile imagery (so the path
 * lines still read) but replaces the hue+saturation with the exact RGB
 * we specify here:
 *
 *   P1 (set 1): no overlay — original pink imagery
 *   P2 (set 2): blue
 *   P3 (set 3): red
 *   P4 (set 4): green
 *
 * In a 2-player game P1 owns sets 1+2 (all pink) and P2 owns sets 3+4
 * (all blue), so no overlays are applied — the bank stays a single color
 * per player.
 */
.clsGameTile[data-game-type="4"][data-set="2"]::before,
.clsGameTile[data-game-type="4"][data-set="3"]::before,
.clsGameTile[data-game-type="4"][data-set="4"]::before,
.setup-tile-pick__img[data-game-type="4"][data-set="2"]::before,
.setup-tile-pick__img[data-game-type="4"][data-set="3"]::before,
.setup-tile-pick__img[data-game-type="4"][data-set="4"]::before {
  content: "";
  position: absolute;
  inset: 0;
  mix-blend-mode: color;
  pointer-events: none;
  z-index: 1;
}
.clsGameTile[data-game-type="4"][data-set="2"]::before,
.setup-tile-pick__img[data-game-type="4"][data-set="2"]::before {
  background: rgb(48, 110, 220); /* blue  — P2 */
}
.clsGameTile[data-game-type="4"][data-set="3"]::before,
.setup-tile-pick__img[data-game-type="4"][data-set="3"]::before {
  background: rgb(220, 50, 50);  /* red   — P3 */
}
.clsGameTile[data-game-type="4"][data-set="4"]::before,
.setup-tile-pick__img[data-game-type="4"][data-set="4"]::before {
  background: rgb(56, 170, 80);  /* green — P4 */
}

/* Subtle colored outline so tile ownership is obvious even at a glance.
 * P1 = pink, P2 = blue, P3 = red, P4 = green. */
.clsGameTile[data-game-type="4"][data-player="1"] {
  box-shadow: 0 0 0 2px rgba(216, 60, 110, 0.9), 0 1px 3px rgba(0, 0, 0, 0.2);
}
.clsGameTile[data-game-type="4"][data-player="2"] {
  box-shadow: 0 0 0 2px rgba(48, 110, 220, 0.9), 0 1px 3px rgba(0, 0, 0, 0.2);
}
.clsGameTile[data-game-type="4"][data-player="3"] {
  box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.9),  0 1px 3px rgba(0, 0, 0, 0.2);
}
.clsGameTile[data-game-type="4"][data-player="4"] {
  box-shadow: 0 0 0 2px rgba(56, 170, 80, 0.9),  0 1px 3px rgba(0, 0, 0, 0.2);
}

.clsControlZone {
  position: absolute;
  z-index: 5;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  pointer-events: none;
}

.clsDice {
  background: rgba(100, 100, 255, 0.92);
  border: 4px solid lightgreen;
  font-weight: 800;
  color: #fff;
  opacity: 0.35;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.clsDice--show {
  opacity: 1;
}

.clsDice--rolling {
  animation: dice-shake 0.12s ease-in-out infinite;
}

.clsDice__face {
  font-size: clamp(1rem, 4vw, 1.75rem);
  line-height: 1;
}

@keyframes dice-shake {
  0%,
  100% {
    transform: rotate(-4deg) scale(1);
  }
  50% {
    transform: rotate(4deg) scale(1.06);
  }
}

.clsPawn {
  position: absolute;
  z-index: 5;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

.clsPawn[data-player="1"] { border-color: rgba(216, 60, 110, 0.95); } /* pink  */
.clsPawn[data-player="2"] { border-color: rgba(48, 110, 220, 0.95); } /* blue  */
.clsPawn[data-player="3"] { border-color: rgba(220, 50, 50, 0.95);  } /* red   */
.clsPawn[data-player="4"] { border-color: rgba(56, 170, 80, 0.95);  } /* green */

.clsPawn--inactive {
  opacity: 0.35;
}
