* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f2f4f8;
  color: #222;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #1f2937;
  color: #fff;
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar .sub { font-size: 13px; color: #9ca3af; font-weight: normal; }
.status-wrap { display: flex; align-items: center; gap: 10px; }
.status { font-size: 13px; color: #d1d5db; }

.panel { max-width: 1200px; margin: 18px auto; padding: 0 16px; }
.panel h2 { margin: 8px 0 14px; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card-title { font-weight: 600; margin-bottom: 8px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  background: #e5e7eb;
  color: #111;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: #2563eb; color: #fff; }
.btn.success { background: #16a34a; color: #fff; }
.btn.warn { background: #f59e0b; color: #fff; }
.btn.danger { background: #ef4444; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- 大厅 ---- */
.joinbox { display: flex; gap: 8px; margin-bottom: 14px; }
.joinbox input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
}
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.seat {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  min-height: 70px;
  background: #fff;
}
.seat.filled { border-color: #cbd5e1; }
.seat .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.seat .seat-name { font-size: 14px; font-weight: 600; display: inline-block; vertical-align: middle; }
.seat .seat-tag { font-size: 11px; color: #6b7280; margin-top: 6px; }
.seat.empty { color: #9ca3af; display: flex; align-items: center; justify-content: center; }
.seat .rm-ai { display: block; margin: 8px auto 0; font-size: 12px; }
.lobby-actions { display: flex; gap: 10px; }
.hint { color: #6b7280; font-size: 13px; }

/* ---- 游戏控制条 ---- */
.game-controls { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }

/* ---- 游戏布局 ---- */
.game-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
@media (max-width: 900px) { .game-grid { grid-template-columns: 1fr; } }

/* ---- 棋盘 ---- */
.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.cell {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 5px 3px 4px;
  min-height: 64px;
  font-size: 11px;
  overflow: hidden;
}
.cell .idx { position: absolute; top: 2px; left: 4px; color: #cbd5e1; font-size: 9px; }
.cell .cname { font-weight: 600; font-size: 11px; line-height: 1.15; margin-top: 8px; }
.cell .price { color: #6b7280; font-size: 10px; }
.cell .ownerbar { height: 4px; margin-top: 3px; border-radius: 2px; }
.cell .tokens { position: absolute; bottom: 3px; left: 3px; display: flex; flex-wrap: wrap; gap: 2px; }
.tok {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  font-size: 8px; color: #fff; text-align: center; line-height: 12px;
}
.cell.special { background: #fafafa; color: #4b5563; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.cell.special .cname { margin-top: 0; font-size: 12px; }
.cell.house::after {
  content: '🏠'; position: absolute; top: 2px; right: 3px; font-size: 10px;
}
.cell.hotel::after {
  content: '🏨'; position: absolute; top: 2px; right: 3px; font-size: 11px;
}
.cell.mortgaged { opacity: .55; }

/* 颜色组顶部色条 */
.cell .stripe { position: absolute; top: 0; left: 0; right: 0; height: 5px; }

/* ---- 骰子 / 玩家 ---- */
.dice { font-size: 28px; font-weight: 700; text-align: center; padding: 8px 0; }
.turn-info { text-align: center; color: #374151; font-size: 13px; }

.player-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 6px; border-bottom: 1px solid #f3f4f6;
}
.player-row:last-child { border-bottom: none; }
.player-row.current { background: #f0f7ff; border-radius: 6px; }
.player-row .pdot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.player-row .pname { font-weight: 600; min-width: 72px; }
.player-row .pmoney { color: #15803d; font-weight: 600; margin-left: auto; }
.player-row.bankrupt { opacity: .45; text-decoration: line-through; }
.player-row .pstate { font-size: 11px; color: #6b7280; }
.props { font-size: 11px; color: #6b7280; margin-top: 2px; flex-basis: 100%; }
.props .chip {
  display: inline-block; margin: 1px 2px 1px 0; padding: 0 5px; border-radius: 4px;
  background: #eef2ff; color: #374151; font-size: 10px;
}
.chip .hs { color: #d97706; }

/* ---- 操作区 ---- */
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.action-hint { color: #6b7280; font-size: 14px; }
.manage-list { display: flex; flex-wrap: wrap; gap: 8px; }
.manage-item {
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px; min-width: 150px;
}
.manage-item .mname { font-weight: 600; font-size: 13px; }
.manage-item .mstate { font-size: 11px; color: #6b7280; margin: 3px 0 6px; }
.manage-item .mbtns { display: flex; flex-wrap: wrap; gap: 4px; }
.manage-item .mbtns .btn { padding: 4px 8px; font-size: 12px; }

/* ---- 日志 ---- */
#log { max-height: 220px; overflow-y: auto; font-size: 13px; }
.log-line { padding: 2px 0; border-bottom: 1px solid #f3f4f6; color: #374151; }

/* ---- toast ---- */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #ef4444; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 99; display: none;
}
