/* PolyBusiness board. Tokens live here so the page CSS can override :root. */
:root {
  --game-primary: #2c2a28;
  --game-bg: #f7f5f0;
  --game-text: #2c2a28;
  --game-accent: #6e5340;
  --game-border: rgba(44, 42, 40, 0.2);
  --game-peach: #f0d9c8;
  --game-human: #2c2a28;
  --game-bot: #9a5340;
}

.pb,
.pb *,
.pb-modal,
.pb-modal *,
.pb-toast {
  box-sizing: border-box;
}

#game-root {
  scroll-margin-top: 80px;
  margin-top: 8px;
}

.pb {
  color: var(--game-text);
  background: var(--game-bg);
}

.pb__title {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}

.pb__lead {
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 16px;
  color: rgba(44, 42, 40, 0.8);
}

.pb__main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pb-player {
  background: var(--game-peach);
  padding: 10px 12px;
  border: 1px solid transparent;
}

.pb-player.is-active {
  border-color: var(--game-primary);
}

.pb-player__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pb-player__pawn {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.pb-player--you .pb-player__pawn {
  background: var(--game-human);
}

.pb-player--bot .pb-player__pawn {
  background: var(--game-bot);
}

.pb-player__name {
  font-family: "Playfair Display", serif;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.pb-player__cash {
  font-size: 12px;
  margin: 2px 0 0;
}

.pb-player__ownLab {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 8px 0 4px;
  color: var(--game-accent);
}

.pb-player__props {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.pb-player__empty {
  font-size: 11px;
  color: rgba(44, 42, 40, 0.65);
}

.pb-player__prop {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.pb-player__swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
}

.pb-board-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.pb-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(40px, 1fr));
  grid-template-rows: repeat(5, minmax(40px, 1fr));
  width: 100%;
  aspect-ratio: 1;
  background: var(--game-primary);
  gap: 1px;
  border: 1px solid var(--game-primary);
}

.pb-cell {
  position: relative;
  background: #fff;
  min-width: 0;
  min-height: 40px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pb-cell.is-active {
  outline: 2px solid var(--game-accent);
  outline-offset: -2px;
  z-index: 1;
}

.pb-cell__bar {
  height: 6px;
  flex: 0 0 6px;
}

.pb-cell__name {
  display: block;
  font-size: 10px;
  line-height: 1.15;
  padding: 3px 3px 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.pb-cell__price {
  display: block;
  font-size: 9px;
  padding: 1px 3px 2px;
  color: rgba(44, 42, 40, 0.7);
}

.pb-cell--corner {
  background: var(--game-peach);
  justify-content: center;
}

.pb-cell--corner .pb-cell__name {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 4px 2px;
}

.pb-cell--owned-human::after,
.pb-cell--owned-bot::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid #fff;
}

.pb-cell--owned-human::after {
  background: var(--game-human);
}

.pb-cell--owned-bot::after {
  background: var(--game-bot);
}

.pb-cell--brown .pb-cell__bar {
  background: #8b4513;
}
.pb-cell--lightblue .pb-cell__bar {
  background: #87ceeb;
}
.pb-cell--pink .pb-cell__bar {
  background: #ff69b4;
}
.pb-cell--orange .pb-cell__bar {
  background: #ff8c00;
}
.pb-cell--red .pb-cell__bar {
  background: #e23b3b;
}
.pb-cell--yellow .pb-cell__bar {
  background: #f4d03f;
}
.pb-cell--green .pb-cell__bar {
  background: #2e8b57;
}
.pb-cell--darkblue .pb-cell__bar {
  background: #1d3557;
}

.pb-board__center {
  grid-column: 2 / 5;
  grid-row: 2 / 5;
  background: var(--game-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  min-width: 0;
}

.pb-board__brand {
  font-family: "Playfair Display", serif;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  text-align: center;
  letter-spacing: 0.04em;
}

.pb-dice {
  display: flex;
  gap: 8px;
}

.pb-die {
  width: 32px;
  height: 32px;
  background: #fff;
  border: 1px solid var(--game-primary);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 3px;
  transform-origin: center;
}

.pb-die.is-rolling {
  animation: pb-die-roll 0.55s ease-out;
}

.pb-die i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  justify-self: center;
  align-self: center;
}

.pb-die[data-face="1"] i:nth-child(5),
.pb-die[data-face="2"] i:nth-child(1),
.pb-die[data-face="2"] i:nth-child(9),
.pb-die[data-face="3"] i:nth-child(1),
.pb-die[data-face="3"] i:nth-child(5),
.pb-die[data-face="3"] i:nth-child(9),
.pb-die[data-face="4"] i:nth-child(1),
.pb-die[data-face="4"] i:nth-child(3),
.pb-die[data-face="4"] i:nth-child(7),
.pb-die[data-face="4"] i:nth-child(9),
.pb-die[data-face="5"] i:nth-child(1),
.pb-die[data-face="5"] i:nth-child(3),
.pb-die[data-face="5"] i:nth-child(5),
.pb-die[data-face="5"] i:nth-child(7),
.pb-die[data-face="5"] i:nth-child(9),
.pb-die[data-face="6"] i:nth-child(1),
.pb-die[data-face="6"] i:nth-child(3),
.pb-die[data-face="6"] i:nth-child(4),
.pb-die[data-face="6"] i:nth-child(6),
.pb-die[data-face="6"] i:nth-child(7),
.pb-die[data-face="6"] i:nth-child(9) {
  background: var(--game-primary);
}

@keyframes pb-die-roll {
  0% {
    transform: rotate(0deg) scale(1);
  }
  35% {
    transform: rotate(180deg) scale(1.08);
  }
  70% {
    transform: rotate(300deg) scale(0.96);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.pb-tokens {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.pb-token {
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  will-change: transform;
  opacity: 0;
}

.pb-token.is-ready {
  opacity: 1;
}

.pb-token--human {
  background: var(--game-human);
}

.pb-token--bot {
  background: var(--game-bot);
}

.pb-token.is-moving {
  transition: transform 0.3s linear;
}

.pb-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pb-turn {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pb-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pb-actions__jail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pb-btn {
  min-height: 44px;
  padding: 12px 16px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 2px;
  font-family: Lato, sans-serif;
  touch-action: manipulation;
  transition:
    background-color 0.3s,
    color 0.3s;
}

.pb-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.pb-btn--primary {
  background: var(--game-primary);
  color: var(--game-bg);
  border: 1px solid var(--game-primary);
}

.pb-btn--primary:hover:not(:disabled),
.pb-btn--primary:focus-visible:not(:disabled) {
  background: transparent;
  color: var(--game-primary);
}

.pb-btn--ghost {
  background: transparent;
  color: var(--game-primary);
  border: 1px solid var(--game-primary);
}

.pb-btn--ghost:hover:not(:disabled),
.pb-btn--ghost:focus-visible:not(:disabled) {
  background: var(--game-primary);
  color: var(--game-bg);
}

.pb-log {
  list-style: none;
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--game-border);
  background: #fff;
  min-height: 92px;
}

.pb-log li {
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 0;
  border-bottom: 1px solid rgba(44, 42, 40, 0.08);
  color: rgba(44, 42, 40, 0.88);
}

.pb-log li:first-child {
  font-weight: 700;
}

.pb-log li:last-child {
  border-bottom: 0;
}

.pb-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(44, 42, 40, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
}

.pb-modal[hidden] {
  display: none;
}

.pb-modal__box {
  background: var(--game-bg);
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 28px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--game-primary);
}

.pb-modal__title {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.pb-modal__text {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.pb-modal__acts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pb-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  z-index: 45;
  background: var(--game-primary);
  color: var(--game-bg);
  padding: 10px 16px;
  font-size: 13px;
  max-width: calc(100% - 32px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
}

.pb-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 379px) {
  .pb-cell__name {
    font-size: 9px;
  }
  .pb-cell--corner .pb-cell__name {
    font-size: 8px;
  }
  .pb-board__brand {
    font-size: 12px;
  }
  .pb-die {
    width: 26px;
    height: 26px;
  }
}

@media (min-width: 768px) {
  .pb__title {
    font-size: 26px;
  }

  .pb__main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "board board"
      "you bot"
      "controls controls";
    gap: 14px 16px;
    align-items: start;
  }

  .pb-board-wrap {
    grid-area: board;
  }

  .pb-player--you {
    grid-area: you;
  }

  .pb-player--bot {
    grid-area: bot;
  }

  .pb-controls {
    grid-area: controls;
  }

  .pb-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .pb-actions__jail {
    flex-direction: row;
    flex: 1 1 auto;
  }

  .pb-btn {
    flex: 1 1 180px;
  }

  .pb-cell__name {
    font-size: 11px;
    padding: 4px 4px 0;
  }

  .pb-cell--corner .pb-cell__name {
    font-size: 10px;
  }

  .pb-board__brand {
    font-size: 18px;
  }

  .pb-die {
    width: 36px;
    height: 36px;
  }

  .pb-modal {
    align-items: center;
    padding: 32px;
  }
}

@media (min-width: 1024px) {
  .pb__main {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "board you"
      "board bot"
      "board controls";
    gap: 14px 24px;
  }

  .pb-board-wrap {
    max-width: none;
  }

  .pb-actions,
  .pb-actions__jail {
    flex-direction: column;
  }

  .pb-btn {
    flex: 0 0 auto;
    width: 100%;
  }

  .pb-cell__bar {
    height: 8px;
    flex-basis: 8px;
  }

  .pb-log {
    margin-top: 20px;
  }
}
