:root {
  --user-color: #e0559f;
  --claude-color: #4f8fe0;
  --bg: #f4f1ea;
  --panel: #ffffff;
  --border: #d8d2c4;
  --text: #2b2b2b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 2px solid var(--border);
}

.player-card { text-align: center; min-width: 140px; }
.player-card .name { font-weight: bold; font-size: 14px; }
.player-card.user .name { color: var(--user-color); }
.player-card.claude .name { color: var(--claude-color); }
.player-card .balance { font-size: 22px; font-weight: bold; }

.hint {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  padding: 8px 16px;
  background: #fff7d6;
  border-radius: 8px;
  margin: 0 16px;
}

main {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
}

#board-wrap {
  position: relative;
  flex: 1;
}

#board {
  display: grid;
  grid-template-columns: repeat(9, minmax(70px, 1fr));
  grid-template-rows: repeat(8, 70px);
  gap: 2px;
  background: var(--border);
  border: 2px solid var(--border);
}

.cell {
  background: var(--panel);
  padding: 4px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.cell .cell-name { font-weight: bold; }
.cell .cell-icon { font-size: 18px; text-align: center; }
.cell .cell-stars { font-size: 10px; color: #c9970a; }

.cell.owner-user { box-shadow: inset 0 0 0 3px var(--user-color); }
.cell.owner-claude { box-shadow: inset 0 0 0 3px var(--claude-color); }

.cell.type-start { background: #e8f9e8; }
.cell.type-jail { background: #eee; }
.cell.type-go_to_jail { background: #f9dede; }
.cell.type-chance { background: #fff3d6; }
.cell.type-tax { background: #f9dede; }
.cell.type-welfare { background: #e0f7ff; }
.cell.type-shop { background: #f3e6ff; }
.cell.type-truth,
.cell.type-task { background: #ffe6f0; }
.cell.type-invest { background: #e6ffe6; }

#pieces { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

.piece {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  transition: left 0.3s ease, top 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: bold;
}
.piece.user { background: var(--user-color); }
.piece.claude { background: var(--claude-color); }

#sidebar {
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#dice-area { text-align: center; }
#dice { font-size: 40px; }
#roll-btn {
  font-size: 16px;
  padding: 8px 20px;
  background: var(--user-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
#roll-btn:hover { opacity: 0.9; }

#action-panel { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#action-panel button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 6px;
  cursor: pointer;
}
#action-panel button:hover { background: #eee; }

#item-bag-wrap h4 { margin: 0 0 6px; font-size: 13px; color: #777; }
#item-bag { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.bag-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; background: #faf6ec; border-radius: 4px; }
.bag-row button { font-size: 11px; padding: 2px 8px; border: 1px solid var(--border); background: #fff; border-radius: 4px; cursor: pointer; }
.bag-empty { font-size: 12px; color: #999; }

#pool { text-align: center; font-size: 14px; color: #555; }

#log {
  flex: 1;
  max-height: 260px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
#log .entry { color: #444; }
#log .entry .turn { color: #999; margin-right: 4px; }

#modal-mask {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal-mask.hidden { display: none; }

#modal-box {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  min-width: 280px;
  text-align: center;
}
#modal-box h3 { margin-top: 0; }
#modal-box button {
  margin: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: var(--user-color);
  color: #fff;
  cursor: pointer;
}
#modal-box button.secondary { background: #999; }
