* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: #1c3a2a;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #123122;
  color: #f5e9c8;
  flex-wrap: wrap;
  gap: 8px;
}
header h1 { font-size: 20px; letter-spacing: 2px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
#config-badge { font-size: 12px; opacity: .8; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  transition: transform .1s, box-shadow .1s, opacity .1s;
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.25); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: #e8b23a; color: #4a3200; font-weight: 700; }
button.big { font-size: 17px; padding: 12px 32px; }
button.ghost { background: rgba(255,255,255,.14); color: inherit; border: 1px solid rgba(255,255,255,.3); }
.modal button.ghost { color: #555; border-color: #bbb; }

main {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 棋盘 ===== */
#board-wrap { flex: 0 1 auto; }
#board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: min(78vh, 720px);
  max-width: 94vw;
  aspect-ratio: 1;
  background: #cde3cf;
  border: 4px solid #0e2a1c;
  border-radius: 6px;
}

.cell {
  position: relative;
  border: 1px solid #9db8a0;
  background: #f6f3e7;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  padding: 1px;
}
.cell .cbar { width: 100%; height: 9px; flex: 0 0 9px; }
.cell .cname {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1.15;
  padding: 1px 2px;
  word-break: break-all;
}
.cell .cprice { font-size: 9px; color: #777; padding-bottom: 1px; }
.cell.corner { background: #efe6c8; }
.cell.corner .cname { font-size: 11px; }
.cell.card-cell { background: #fdf0f5; }
.cell.tax-cell { background: #fdeaea; }

.cbadges { position: absolute; top: 10px; right: 2px; display: flex; gap: 2px; align-items: center; }
.owner-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.5); }
.mort-badge { font-size: 9px; background: #555; color: #fff; border-radius: 3px; padding: 0 3px; }
.bld-badge { font-size: 9px; }

.tokens {
  position: absolute;
  left: 2px; right: 2px; bottom: 2px;
  display: flex;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.token {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}

/* 中央操作区 */
#center {
  grid-area: 2 / 2 / 9 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at 50% 40%, #e9f5e9, #c8e0ca);
  padding: 12px;
  text-align: center;
}
#turn-info { font-size: 18px; font-weight: 700; color: #1c3a2a; }
#dice-area { font-size: 54px; line-height: 1; letter-spacing: 8px; color: #222; text-shadow: 0 2px 4px rgba(0,0,0,.2); }
.die.rolling { animation: shake .12s infinite; display: inline-block; }
@keyframes shake { 0%{transform:rotate(-12deg)} 50%{transform:rotate(10deg) translateY(-3px)} 100%{transform:rotate(-6deg)} }
#round-info { font-size: 13px; color: #3c5c46; }
#actions { display: flex; flex-direction: column; gap: 8px; align-items: center; min-height: 40px; }
#actions .prompt { font-size: 14px; color: #444; }
#actions .btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#tools { min-height: 30px; }
#tools button { background: #2c5d42; color: #eaf5ec; font-size: 13px; }

/* ===== 侧边栏 ===== */
#sidebar {
  width: 320px;
  max-width: 94vw;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#players { display: flex; flex-direction: column; gap: 8px; }
.pcard {
  background: #f6f3e7;
  border-radius: 10px;
  padding: 8px 12px;
  border-left: 8px solid #999;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: box-shadow .2s;
}
.pcard.active { box-shadow: 0 0 0 3px #e8b23a, 0 4px 10px rgba(0,0,0,.3); }
.pcard.bankrupt { opacity: .45; filter: grayscale(.8); }
.pcard .prow { display: flex; justify-content: space-between; align-items: center; }
.pcard .pname { font-weight: 700; font-size: 14px; }
.pcard .pmoney { font-weight: 700; color: #1c6b3a; font-variant-numeric: tabular-nums; }
.pcard .pmeta { font-size: 11px; color: #777; }
.ptag { font-size: 10px; border-radius: 4px; padding: 1px 5px; margin-left: 5px; }
.ptag.ai { background: #dfe6ee; color: #345; }
.ptag.human { background: #e8b23a; color: #4a3200; }
.ptag.jail { background: #444; color: #fff; }

#log {
  background: rgba(0,0,0,.35);
  color: #e8f0e8;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.6;
  height: 300px;
  overflow-y: auto;
}
#log div { border-bottom: 1px dashed rgba(255,255,255,.08); padding: 1px 0; }
#rules {
  background: rgba(255,255,255,.1);
  color: #dfe9df;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
}
#rules ul { padding-left: 18px; margin-top: 6px; }
#rules li { margin-bottom: 4px; }

/* ===== 弹窗 ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.overlay.hidden { display: none; }
.hidden { display: none !important; }
.modal {
  background: #fdfbf3;
  border-radius: 14px;
  padding: 24px 28px;
  width: 440px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  color: #333;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal.wide { width: 560px; }
.modal h2 { color: #1c3a2a; }
.muted { color: #888; font-size: 13px; }
.card-modal { text-align: center; }
.card-modal h2 { color: #8a2f5c; }
#card-text { font-size: 18px; font-weight: 700; line-height: 1.6; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }

.setup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f0ead6;
  border-radius: 10px;
  margin-bottom: 8px;
}
.setup-row .sdot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); flex: 0 0 auto; }
.setup-row input {
  flex: 1;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}
.setup-row select { font-size: 14px; padding: 6px; border-radius: 6px; border: 1px solid #ccc; font-family: inherit; }

#auction-info { font-size: 15px; font-weight: 700; }
#auction-status { font-size: 13px; color: #555; background: #f0ead6; border-radius: 8px; padding: 8px 10px; min-height: 40px; }
#auction-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.mort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px dashed #ddd;
  font-size: 13px;
}
.mort-row .mname { flex: 1; font-weight: 600; }
.mort-row .mval { color: #777; font-size: 12px; }
.mort-row button { padding: 4px 10px; font-size: 12px; }
.mort-row .gbar { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }

@media (max-width: 1100px) {
  main { flex-direction: column; align-items: center; }
  #sidebar { width: min(720px, 94vw); }
  #log { height: 180px; }
}

/* ===== 3D 版 ===== */
a.ghost.nav-link {
  display: inline-block;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: inherit;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.14);
}
a.ghost.nav-link:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.25); }

#gl-wrap {
  position: relative;
  flex: 1 1 auto;
  max-width: 1080px;
  min-width: min(700px, 94vw);
  height: min(80vh, 760px);
  border: 4px solid #0e2a1c;
  border-radius: 6px;
  overflow: hidden;
  background: #1c3a2a;
}
#gl { position: absolute; inset: 0; cursor: grab; }
#gl:active { cursor: grabbing; }
#gl canvas { display: block; }

#hud {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(10, 30, 20, .78);
  padding: 10px 20px;
  border-radius: 14px;
  backdrop-filter: blur(5px);
  color: #eaf5ec;
  min-width: 320px;
  max-width: 92%;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
#hud #turn-info { color: #f5e9c8; font-size: 16px; font-weight: 700; }
#hud #round-info { color: #a9cbb3; font-size: 12px; }
#hud #actions .prompt { color: #d8e8dc; font-size: 13px; }
#hud #actions .btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#hud #tools button { background: rgba(232,178,58,.9); color: #4a3200; font-size: 13px; font-weight: 700; }

.view-hint {
  position: absolute;
  top: 10px;
  left: 10px;
  color: rgba(255,255,255,.6);
  font-size: 11px;
  background: rgba(10,30,20,.55);
  padding: 4px 10px;
  border-radius: 8px;
  pointer-events: none;
}
#camera-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
#camera-tools button {
  background: rgba(10,30,20,.72);
  color: #eaf5ec;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.25);
  padding: 6px 12px;
}
