@import url('../global.css');

:root {
  --title-color: var(--color-monopoly);
}

/* ── Board grid ─────────────────────────────────────────────────── */

.mp-board {
  --mp-felt: #14481f;
  --mp-border: #b8892e;
  --mp-outline: #6e5218;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  background: var(--mp-felt);
  border: 3px solid var(--mp-border);
  outline: 1px solid var(--mp-outline);
  outline-offset: -4px;
  border-radius: 4px;
  padding: 2px;
  box-sizing: border-box;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.mp-board[data-visual-theme='arcade'] {
  --mp-felt: #2a0f28;
  --mp-border: #ff4fd8;
  --mp-outline: #a8309a;
}

.mp-board[data-visual-theme='midnight'] {
  --mp-felt: #0e1f2e;
  --mp-border: #38bdf8;
  --mp-outline: #1f6f96;
}

.mp-board[data-visual-theme='daylight'] {
  --mp-felt: #2c1f42;
  --mp-border: #7c3aed;
  --mp-outline: #5423a8;
}

.mp-board[data-visual-theme='amber'] {
  --mp-felt: #2e1c04;
  --mp-border: #fbbf24;
  --mp-outline: #a87a12;
}

/* ── Squares ────────────────────────────────────────────────────── */

.mp-sq {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.35) 0%, transparent 40%), #f0e8d0;
  border-radius: 2px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  font-size: clamp(5px, 1.1vw, 11px);
  cursor: default;
  box-shadow: inset 0 0 0 1px rgba(107, 66, 38, 0.25);
}

.mp-sq--go {
  background: #ffe0e0;
}
.mp-sq--jail {
  background: #e8e8e8;
}
.mp-sq--freeparking {
  background: #e8ffe8;
}
.mp-sq--gotojail {
  background: #ffe8e8;
}
.mp-sq--chance {
  background: #fff3cd;
}
.mp-sq--tax {
  background: #f0d0ff;
}
.mp-sq--safe {
  background: #e8f4e8;
}

/* Property colour band */
.mp-prop-band {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 28%;
}

.mp-sq-label {
  display: block;
  text-align: center;
  line-height: 1.1;
  font-size: inherit;
  padding: 1px;
  color: #222;
  word-break: break-word;
  z-index: 1;
  margin-top: 30%;
}

.mp-sq--go .mp-sq-label,
.mp-sq--jail .mp-sq-label,
.mp-sq--freeparking .mp-sq-label,
.mp-sq--gotojail .mp-sq-label,
.mp-sq--chance .mp-sq-label,
.mp-sq--tax .mp-sq-label,
.mp-sq--safe .mp-sq-label {
  margin-top: 0;
}

.mp-sq-price {
  display: block;
  font-size: 0.85em;
  color: #555;
  z-index: 1;
}

.mp-sq-houses {
  display: block;
  font-size: 0.9em;
  color: #1a5c2a;
  font-weight: 700;
  z-index: 1;
}

/* Owned indicator via box-shadow */
.mp-sq.is-owned {
  box-shadow: inset 0 0 0 2px var(--owner-color, transparent);
}

/* Tokens on squares */
.mp-sq-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  justify-content: center;
  z-index: 2;
}

.mp-token {
  display: inline-block;
  font-size: 0.9em;
  line-height: 1;
  transition: transform 0.2s;
}

.mp-token.is-active {
  transform: scale(1.3);
}

/* ── Inner panel (rows 2-7, cols 2-7) ──────────────────────────── */

.mp-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 3px, transparent 3px 6px), #14481f;
  border-radius: 2px;
  padding: 4px;
  gap: 4px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

/* Dice area */
.mp-dice-area {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Players row */
.mp-players {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}

.mp-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 3px 5px;
  font-size: clamp(8px, 1.2vw, 12px);
  color: #ccc;
  border: 2px solid transparent;
  min-width: 40px;
  transition: border-color 0.2s;
}

.mp-player.is-active {
  border-color: var(--seat-color);
  color: #fff;
}

.mp-player.is-bankrupt {
  opacity: 0.4;
}

.mp-player-token {
  font-size: 1.3em;
  color: var(--seat-color);
}

.mp-player-name {
  font-size: 0.9em;
  white-space: nowrap;
}

.mp-player-money {
  font-weight: 700;
  font-size: 0.9em;
  color: #ffe47a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* Pot */
.mp-pot {
  font-size: clamp(8px, 1vw, 10px);
  color: #a0e0a0;
  text-align: center;
  flex-shrink: 0;
}

/* Actions */
.mp-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
  max-height: 40%;
  overflow-y: auto;
}

.mp-action-info {
  font-size: clamp(8px, 1vw, 11px);
  color: #d4f0d4;
  text-align: center;
  margin: 0;
}

.mp-action-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: clamp(8px, 1.1vw, 11px);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.mp-action-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.mp-action-btn--primary {
  background: var(--color-monopoly, #16a34a);
  font-weight: 700;
}

.mp-action-btn--primary:hover {
  background: #15803d;
}

.mp-action-btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
}

/* Log */
.mp-log {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mp-log-entry {
  font-size: clamp(7px, 0.9vw, 10px);
  color: #a8d5a8;
  margin: 0;
  padding: 1px 2px;
  border-radius: 2px;
}

.mp-log-entry.is-latest {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
