/* Monopoly phase 2: in-game state and transaction feedback. */

.cell-meta {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  z-index: 2;
  overflow: hidden;
  color: rgba(52, 36, 23, 0.82);
  font: 800 clamp(7px, 0.82vw, 10px)/1.15 Arial, sans-serif;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.box[data-place-type="goodEvent"]::after {
  background: linear-gradient(90deg, #d39a34, #f3ce67);
}

.box[data-place-type="badEvent"]::after {
  background: linear-gradient(90deg, #985149, #d16b5c);
}

.box[data-place-type="surprise"]::after {
  background: linear-gradient(90deg, #72528e, #a878bd);
}

.box[data-place-type="airport"]::after {
  background: linear-gradient(90deg, #377e90, #67b4be);
}

.box[data-place-type="jail"]::after {
  background: linear-gradient(90deg, #4f5660, #7d8792);
}

.box[data-place-type="casino"]::after {
  background: linear-gradient(90deg, #9a612c, #d69e48);
}

.box[data-place-type="trip"]::after {
  background: linear-gradient(90deg, #3d8275, #75b697);
}

.box.active-place {
  z-index: 6;
  border-color: #fff1ba;
  box-shadow:
    0 0 0 3px rgba(244, 201, 107, 0.9),
    0 0 22px rgba(255, 219, 127, 0.88),
    inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  filter: brightness(1.08);
}

.box.moving-place {
  animation: placeStep 0.72s ease-out;
}

@keyframes placeStep {
  0% { transform: scale(0.9); filter: brightness(1); }
  45% { transform: scale(1.08); filter: brightness(1.24); }
  100% { transform: scale(1); filter: brightness(1.08); }
}

.box.owned {
  border-color: var(--owner-color);
  box-shadow:
    inset 0 0 0 3px var(--owner-color),
    0 3px 7px rgba(43, 20, 8, 0.28);
}

.box.owned::before {
  position: absolute;
  top: 30px;
  right: 3px;
  z-index: 4;
  width: 9px;
  height: 9px;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--owner-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.map.is-moving .box:not(.active-place) {
  filter: saturate(0.82) brightness(0.94);
}

.player-chip {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto auto;
  column-gap: 6px;
  min-width: 142px;
  padding: 6px 10px;
}

.player-chip .chip-dot {
  grid-row: 1 / 3;
  align-self: center;
}

.player-chip .player-name {
  color: rgba(255, 248, 233, 0.82);
  font-size: 11px;
  font-weight: 800;
}

.player-chip b {
  justify-self: end;
  color: #fff8e9;
  font: 800 11px/1.2 Arial, sans-serif;
}

.player-chip small {
  grid-column: 2 / 4;
  overflow: hidden;
  color: rgba(255, 248, 233, 0.52);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-chip.current small,
.player-chip.current .player-name {
  color: rgba(255, 248, 233, 0.82);
}


/* Keep player tokens centered between the place title and the bottom price. */
.box .chr {
  top: calc(50% + 5px);
  bottom: auto;
  width: clamp(19px, 2.7vw, 28px);
  height: clamp(19px, 2.7vw, 28px);
  transform: translate(-50%, -50%);
}

.box[data-token-count="2"] .chr,
.box[data-token-count="3"] .chr,
.box[data-token-count="4"] .chr {
  width: clamp(17px, 2.3vw, 24px);
  height: clamp(17px, 2.3vw, 24px);
  font-size: clamp(7px, 0.8vw, 10px);
}

@keyframes tokenBounce {
  0% { transform: translate(-50%, -50%) scale(0.5); }
  55% { transform: translate(-50%, -50%) scale(1.18); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* The content owns the space between the fixed header and action bar. */
.dialog p {
  top: 53px;
  bottom: 52px;
  justify-content: center;
  min-height: 0;
  padding: 12px 28px;
  transform: none;
}

.dialog p {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dialog-place {
  color: #fff8e9;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.dialog-cost {
  color: rgba(255, 248, 233, 0.68);
  font-size: 13px;
}

.dialog-cost b {
  margin-left: 5px;
  color: #f4c96b;
  font: 900 18px/1 Arial, sans-serif;
}

.dialog p small {
  max-width: 330px;
  color: rgba(255, 248, 233, 0.5);
  font-size: 10px;
  line-height: 1.5;
}

.dialog .btn[aria-disabled="true"] {
  color: rgba(255, 248, 233, 0.32) !important;
  background: rgba(255, 255, 255, 0.045) !important;
  cursor: not-allowed;
}

.infobox {
  top: auto;
  right: 24px;
  bottom: 24px;
  left: auto;
  transform: none;
}

@media (max-width: 1100px) {
  .infobox {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 760px) {

  .box .chr {
    top: calc(50% + 2px);
    bottom: auto;
    width: clamp(13px, 4.4vw, 20px);
    height: clamp(13px, 4.4vw, 20px);
    font-size: 6px;
  }

  .dialog p {
    top: 53px;
    bottom: 52px;
    padding: 10px 18px;
  }

  .cell-meta {
    right: 1px;
    bottom: 1px;
    left: 1px;
    font-size: clamp(5px, 1.55vw, 8px);
  }

  .box.owned::before {
    top: 20px;
    right: 1px;
    width: 6px;
    height: 6px;
    border-width: 1px;
  }

  .box.active-place {
    box-shadow:
      0 0 0 2px rgba(244, 201, 107, 0.9),
      0 0 13px rgba(255, 219, 127, 0.72),
      inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  }

  .player-chip {
    min-width: 132px;
  }

  .dialog-place {
    font-size: 20px;
  }

  .infobox {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .box.moving-place {
    animation: none;
  }
}
