/* ===== CSS 变量 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  image-rendering: pixelated;
}

:root {
  /* === 16 色像素调色板（NES 风格）=== */
  /* 全局基底 */
  --sky: #F6E7C8;          /* 1 · 天空底 */
  --black: #181818;        /* 2 · 描边/文字 */
  --white: #FAFAFA;        /* 3 · 文字/骰子面 */
  --gray: #C8C8C8;         /* 4 · 肠胃卡格/中性 */
  --gray-dk: #555555;      /* 5 · trap 陷阱 */
  --under: #3A2A1E;        /* 6 · HUD 暗夜底 */

  /* 6 个区域主色 — NES 调色板（与 board-map.js REGIONS 同步） */
  --region-grassland: #5ABD34; /* 7 · 草原 · NES 草绿 */
  --region-pipe:      #00A800; /* 8 · 水管 · 管道深绿 */
  --region-lava:      #D82800; /* 9 · 熔岩 · 火红 */
  --region-desert:    #F0BC3C; /* 10 · 沙漠 · 沙黄 */
  --region-ice:       #3CBCFC; /* 11 · 冰雪 · 冰蓝 */
  --region-castle:    #7C7C7C; /* 12 · 城堡 · 石灰 */

  /* 4 个事件强色 — NES 16 色 */
  --red: #E40058;          /* 13 · NES 红屁屁侠红 */
  --gold: #FCD800;         /* 14 · 卷黄 */
  --brick: #FC7460;        /* 15 · 砖橙 */
  --red-dk: #A40000;       /* 16 · 暗红 */

  /* === 派生色（不计入 16 色，用 rgba/混色生成）=== */
  --sky-lt: #FFF4DC;
  --brick-dk: #8B3304;
  --brick-lt: #FC9838;
  --green: #7ED97A;
  --green-dk: #3F9B3F;
  --green-lt: #D6F4D2;
  --blue: #5FA8FF;
  --skin: #FFDAB9;
  --pink: #F090A0;
  --orange: #FC9838;
  --brown: #8D5B2C;
  --brown-lt: #C9A06B;
  --under-lt: #5C4522;
}

body {
  font-family: 'Courier New','PingFang SC','Microsoft YaHei',monospace;
  background: var(--sky);
  color: var(--black);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ===== 开始画面 ===== */
.start-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-lt) 60%, var(--green-lt) 60%, var(--green) 65%, var(--brown) 65%, var(--brown-lt) 100%);
  position: relative;
}

.cloud {
  position: absolute;
  background: var(--white);
  border: 3px solid var(--sky-lt);
  border-radius: 8px;
}

.cloud::before {
  content: '';
  position: absolute;
  width: 60%;
  height: 120%;
  background: var(--white);
  border: 3px solid var(--sky-lt);
  border-radius: 8px;
  top: -60%;
  left: 10%;
}

.cloud::after {
  content: '';
  position: absolute;
  width: 50%;
  height: 100%;
  background: var(--white);
  border: 3px solid var(--sky-lt);
  border-radius: 8px;
  top: -40%;
  right: 10%;
}

.game-title {
  font-size: clamp(16px, 3vw, 32px);
  color: var(--gold);
  text-shadow: 4px 4px 0 var(--red), -1px -1px 0 var(--black), 1px -1px 0 var(--black), -1px 1px 0 var(--black), 1px 1px 0 var(--black);
  margin-bottom: 8px;
  text-align: center;
  line-height: 1.6;
  animation: bounce 1s ease-in-out infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}

.game-subtitle {
  font-size: clamp(7px, 1.2vw, 12px);
  color: var(--white);
  text-shadow: 2px 2px 0 var(--black);
  margin-bottom: 20px;
}

.boss-preview {
  background: rgba(0,0,0,.7);
  border: 3px solid var(--red);
  padding: 10px 20px;
  margin-bottom: 16px;
  text-align: center;
  font-size: clamp(6px, 1vw, 9px);
  line-height: 1.8;
  max-width: 500px;
  color: var(--white);
}

.boss-preview-title {
  color: var(--red);
  margin-bottom: 4px;
  font-size: clamp(8px, 1.2vw, 11px);
}

/* ===== 角色选择 ===== */
.character-select {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
  max-width: 700px;
}

.char-card {
  width: 90px;
  height: 110px;
  background: var(--under);
  border: 4px solid var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}

.char-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}

.char-card.disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

.char-pixel {
  width: 48px;
  height: 32px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-name {
  font-size: 6px;
  text-align: center;
  line-height: 1.4;
}

.char-hp {
  font-size: 5px;
  color: var(--green);
  margin-top: 2px;
}

/* ===== 按钮 ===== */
.pixel-btn {
  font-family: 'Courier New','PingFang SC','Microsoft YaHei',monospace;
  font-size: clamp(8px, 1.2vw, 14px);
  padding: 10px 24px;
  border: none;
  cursor: pointer;
  color: var(--white);
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
  transition: transform .1s;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}

.pixel-btn:hover { transform: scale(1.05); }
.pixel-btn:active { transform: scale(.95); }
.pixel-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.pixel-btn-red    { background: var(--red); }
.pixel-btn-green  { background: var(--green); }
.pixel-btn-blue   { background: var(--blue); }
.pixel-btn-yellow { background: var(--orange); }

/* ===== 人数选择 ===== */
.player-count-select {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.count-btn {
  font-family: 'Courier New','PingFang SC','Microsoft YaHei',monospace;
  font-size: 12px;
  width: 44px;
  height: 44px;
  background: var(--under);
  border: 3px solid var(--white);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.count-btn:hover { border-color: var(--gold); color: var(--gold); }
.count-btn.active { background: var(--red); border-color: var(--gold); color: var(--white); }

.current-player-label {
  font-size: 9px;
  color: var(--gold);
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
}

.confirmed-players {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0;
  min-height: 30px;
}

.confirmed-player {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--under);
  border: 2px solid;
  padding: 3px 8px;
  font-size: 7px;
  color: var(--white);
}

/* ===== 游戏面板 ===== */
/* 游戏画面：NES 风格天空硬色阶（2 层，非渐变） */
.game-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  /* NES 天空：上 70% 天蓝，下 30% 浅蓝，硬色阶分界 — 像素风没有 smooth 渐变 */
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky) 68%, var(--sky-lt) 68%, var(--sky-lt) 100%);
  position: relative;
}

.mp-effect-toast-wrap {
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 1200;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.mp-effect-banner {
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  background: rgba(24, 24, 24, 0.92);
  border: 3px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.35);
  color: var(--gold);
  font-size: 8px;
  line-height: 1.6;
  text-align: center;
  text-shadow: 2px 2px 0 var(--black);
  animation: mp-toast-in 0.3s ease-out;
}

@keyframes mp-toast-in {
  from { transform: translateY(-12px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.tile-trap {
  position: absolute;
  right: 2px;
  bottom: 2px;
  font-size: 10px;
  line-height: 1;
  z-index: 4;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.8));
  pointer-events: none;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  background: var(--red);
  border-bottom: 4px solid var(--red-dk);
  font-size: 8px;
  min-height: 40px;
  color: var(--white);
}

.game-header-left { display: flex; gap: 12px; align-items: center; }
.game-header-right { display: flex; gap: 16px; align-items: center; }

.help-btn {
  font-family: 'Courier New','PingFang SC','Microsoft YaHei',monospace;
  font-size: 8px;
  padding: 4px 10px;
  background: var(--gold);
  color: var(--black);
  border: none;
  cursor: pointer;
  clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px));
}

.help-btn:hover { transform: scale(1.05); }

.round-info { color: var(--gold); font-size: 7px; }
.turn-indicator { display: flex; align-items: center; gap: 6px; }

/* ===== 棋盘 ===== */
.game-body { flex: 1; display: flex; overflow: hidden; }

.board-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

/* ====== 节点地图（新版 SVG 棋盘）====== */
.board-container-map {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  gap: 0;
  background: var(--sky);
}

.board-map-svg-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  /* NES 天空：硬色阶（68% 处分界） */
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky) 68%, var(--sky-lt) 68%, var(--sky-lt) 100%);
  position: relative;
  min-width: 0;
}

.board-map-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  image-rendering: pixelated;
}

.map-node {
  cursor: pointer;
}

/* 不用 transform: scale 避免 hover 闪烁；改用 filter 实现高亮反馈 */
.map-node:hover .node-bg {
  filter: brightness(1.15) drop-shadow(0 0 3px #FBD000);
  stroke: #FBD000;
  stroke-width: 0.06;
}

.map-node-corner .node-bg {
  stroke: #FBD000 !important;
}

.node-label,
.node-icon,
.node-houses,
.node-owner,
.node-tokens {
  pointer-events: none;
}

/* ===== 玩家 token 像素风悬浮动画 =====
 * .mp-token-float 是角色容器（在 SVG g 上）
 * 用 transform: translate(0, -2px) ↔ translate(0, 2px) 做 1.2s 循环
 * 注：因为父 g 已 translate(0, -0.45)，这里只做相对微动
 * 当前回合玩家的 .map-node 不存在（token 跨 node 显示），所以在 token 本体加 animation */
.mp-token-float {
  animation: mpTokenFloat 1.2s ease-in-out infinite alternate;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes mpTokenFloat {
  0%   { transform: translateY(-0.02px); }
  100% { transform: translateY(0.05px); }
}

/* 角色弹跳（移动中触发）— squash & stretch
 * 由 walkAnim 在 React 端切换 .mp-token-bounce class
 * SVG transform 用 px 单位会被忽略，所以用 scale */
.mp-token-bounce {
  animation: mpTokenBounce 0.3s ease-in-out;
}

@keyframes mpTokenBounce {
  0%   { transform: scaleY(1) scaleX(1); }
  30%  { transform: scaleY(1.2) scaleX(0.85); }   /* 跃起：拉长 */
  70%  { transform: scaleY(0.85) scaleX(1.15); }  /* 落地：压扁 */
  100% { transform: scaleY(1) scaleX(1); }
}

/* 走路三阶段：起跳 → 空中 → 落地
 * 给 .mp-token-group 加变形，让弹跳更有"重量感"
 * SVG g 用 transform: scale 需要 transform-origin: center + transform-box: fill-box */
.mp-token-bounce-up,
.mp-token-bounce-air,
.mp-token-bounce-land {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition: transform 0.08s ease-out;
}

.mp-token-bounce-up .mp-token-float {
  /* 起跳：身体拉长（脚蹬地） */
  animation: walkHopUp 0.08s ease-out forwards;
}

.mp-token-bounce-air .mp-token-float {
  /* 空中：恢复正常比例 */
  animation: walkHopAir 0.12s linear forwards;
}

.mp-token-bounce-land .mp-token-float {
  /* 落地：身体压扁（缓冲） */
  animation: walkHopLand 0.05s ease-in forwards;
}

@keyframes walkHopUp {
  0%   { transform: translateY(-0.02px) scale(1, 1); }
  100% { transform: translateY(0px) scale(0.92, 1.12); }   /* 拉长 */
}

@keyframes walkHopAir {
  0%   { transform: translateY(0px) scale(0.92, 1.12); }
  50%  { transform: translateY(0px) scale(1.05, 0.95); }   /* 空中微扁 */
  100% { transform: translateY(0px) scale(1, 1); }
}

@keyframes walkHopLand {
  0%   { transform: translateY(0px) scale(1, 1); }
  100% { transform: translateY(0px) scale(1.18, 0.82); }   /* 压扁缓冲 */
}

/* HUD 面板（紧贴棋盘右侧，独立窄柱）：
   左侧=当前玩家/骰子/操作按钮，右侧=我的地产列表（一左一右） */
.board-hud-panel {
  width: clamp(300px, 26vw, 360px);
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 12px;
  background: var(--under);
  border-left: 4px solid var(--brick);
  padding: 12px 10px;
  overflow-y: auto;
}

.board-center-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 140px;
  min-width: 0;
}

.board-hud-panel .board-myprops {
  flex: 1;
  min-width: 150px;
  margin-top: 0;
}

.board-center-map .center-avatar {
  margin-bottom: 4px;
}

.board-center-map .center-name {
  font-size: clamp(11px, 1.4vw, 14px);
  color: var(--white);
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
  text-align: center;
}

.board-center-map .center-dice {
  display: flex;
  gap: 10px;
  margin: 8px 0;
  justify-content: center;
}

.board-center-map .pixel-dice {
  width: clamp(48px, 5vw, 64px);
  height: clamp(48px, 5vw, 64px);
  border-width: 3px;
  padding: 3px;
}

.board-center-map .center-msg {
  font-size: clamp(9px, 0.95vw, 11px);
  color: var(--white);
  text-align: center;
  padding: 6px 4px;
  line-height: 1.5;
  background: rgba(0,0,0,.3);
  border-radius: 4px;
  width: 100%;
}

.board-center-map .roll-btn {
  margin-top: 6px;
  font-size: clamp(11px, 1.2vw, 13px);
  padding: 10px 18px;
  width: 100%;
  min-height: 44px;
}

/* HUD 面板内的当前玩家地产列表（替代原 sidebar 地产 section） */
.board-myprops {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px dashed rgba(255, 255, 255, 0.18);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-myprops-title {
  font-size: 11px;
  font-family: 'Courier New','PingFang SC','Microsoft YaHei',monospace;
  color: var(--gold);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.board-myprops-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.board-myprops-empty {
  text-align: center;
  color: #888;
  font-size: 10px;
  padding: 8px 0;
}

.board-myprops-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.board-myprops-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-myprops-sell {
  font-size: 9px;
  padding: 3px 6px;
  min-height: 24px;
  flex-shrink: 0;
}

/* ====== 旧版 board-comb 兼容样式（保留以防回退）====== */
.board-container-comb {
  position: relative;
}

.board.board-comb {
  gap: 2px;
}

.board-comb .tile {
  font-size: clamp(5px, 0.72vw, 8px);
  min-height: 0;
  min-width: 0;
}

.board-comb .tile-name {
  font-size: clamp(4px, 0.65vw, 7px);
  line-height: 1.15;
  max-height: 2.4em;
  overflow: hidden;
}

.board-void {
  background: transparent;
  border: none;
  min-height: 0;
  pointer-events: none;
}

.board-hud-inset {
  z-index: 6;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-width: 0;
  min-height: 0;
  pointer-events: none;
  padding: 2px;
}

.board-hud-inset .board-center-snake {
  pointer-events: auto;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 5px 7px;
  grid-column: auto;
  grid-row: auto;
  border: 4px solid var(--red);
  background: rgba(229, 37, 33, 0.92);
  box-shadow: inset 0 0 0 2px var(--black), 0 0 0 2px var(--brick-dk);
}

.board-hud-inset .center-name,
.board-center-snake .center-name {
  font-size: clamp(7px, 0.9vw, 10px);
  margin-bottom: 1px;
}

.board-hud-inset .center-dice,
.board-center-snake .center-dice {
  gap: 6px;
  margin: 3px 0;
  flex-shrink: 0;
}

.board-hud-inset .pixel-dice,
.board-center-snake .pixel-dice {
  width: clamp(24px, 3vw, 34px);
  height: clamp(24px, 3vw, 34px);
  border-width: 2px;
  padding: 2px;
}

.board-hud-inset .center-msg,
.board-center-snake .center-msg {
  font-size: clamp(5px, 0.72vw, 8px);
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  word-break: break-word;
  color: var(--white);
}

.board-hud-inset .roll-btn,
.board-center-snake .roll-btn {
  font-size: clamp(5px, 0.75vw, 8px);
  padding: 3px 6px;
  margin-top: 3px;
  white-space: nowrap;
}

.board {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  grid-template-rows: repeat(12, 1fr);
  gap: 2px;
  width: min(96vw, calc(82vh * 18 / 12));
  aspect-ratio: 18/12;
  background: var(--sky);
  border: 6px solid var(--black);
  padding: 6px;
  box-shadow: 0 0 0 3px var(--brick-dk), 0 4px 24px rgba(0,0,0,.25);
}

.board-comb .tile {
  border-color: var(--black);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.2), inset -1px -1px 0 rgba(0,0,0,.25);
}

/* ===== 格子 ===== */
.tile {
  position: relative;
  border: 2px solid var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: clamp(5px, .7vw, 8px);
  text-align: center;
  padding: 2px 1px;
  position: relative;
  overflow: visible;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.25), inset -2px -2px 0 rgba(0,0,0,.2);
}

.tile:hover { filter: brightness(1.1); transform: translateY(-1px); }
.tile:active { filter: brightness(.9); transform: translateY(0); }

.tile-pixel-icon { margin-bottom: 1px; line-height: 0; }
.tile-name { line-height: 1.2; word-break: break-all; }
.tile-price { margin-top: 1px; font-weight: bold; }
.tile-toll { margin-top: 1px; font-size: 5px; font-weight: bold; color: var(--gold); }

.tile-corner {
  border-color: var(--gold) !important;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.3), inset -2px -2px 0 rgba(0,0,0,.2), 0 0 0 1px var(--gold);
}

.tile.active-tile {
  box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(251,208,0,.5);
  z-index: 2;
}

/* 格子上角色 */
.tile-char-wrap {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  z-index: 5;
}

.tile-char {
  border: 2px solid var(--white);
  background: var(--black);
  border-radius: 0;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.5);
}

.tile-char.hop { animation: hop .3s ease; }

@keyframes hop {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-10px) scale(1.15); }
  100% { transform: translateY(0) scale(1); }
}

/* 房屋 */
.tile-houses { position: absolute; bottom: 2px; right: 2px; display: flex; gap: 1px; }
.tile-house { width: 5px; height: 5px; background: var(--green); border: 1px solid var(--white); }
.tile-hotel { width: 8px; height: 5px; background: var(--red); border: 1px solid var(--white); font-size: 3px; color: var(--white); display: flex; align-items: center; justify-content: center; }
.tile-owner { position: absolute; bottom: 2px; left: 2px; width: 6px; height: 6px; border: 1px solid var(--white); }

/* ===== 棋盘中央 ===== */
.board-center {
  grid-column: 2/11;
  grid-row: 2/7;
  background: rgba(26,26,46,.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--brick);
  box-shadow: inset 0 0 40px rgba(0,0,0,.4), 0 0 0 1px var(--brick-dk);
}

.brick-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: .06;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 14px, var(--brick) 14px, var(--brick) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 22px, var(--brick) 22px, var(--brick) 24px);
  pointer-events: none;
}

.brick-question {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid var(--gold);
  background: var(--brick);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--gold);
  font-weight: bold;
  animation: questionBounce 2s ease-in-out infinite alternate;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.2), inset -1px -1px 0 rgba(0,0,0,.2);
}

@keyframes questionBounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-3px); }
}

.pipe-deco {
  position: absolute;
  width: 16px;
  height: 24px;
  background: var(--green);
  border: 2px solid var(--green-dk);
  border-radius: 4px 4px 0 0;
}

.pipe-deco::after {
  content: '';
  position: absolute;
  top: -5px;
  left: -3px;
  right: -3px;
  height: 8px;
  background: var(--green);
  border: 2px solid var(--green-dk);
  border-radius: 2px;
}

/* 中央头像与骰子 */
.center-avatar { margin-bottom: 4px; animation: avatarFloat 2s ease-in-out infinite alternate; }

@keyframes avatarFloat {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-4px) scale(1.03); }
}

.center-name {
  font-size: clamp(8px, 1.4vw, 16px);
  margin-bottom: 4px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
  color: var(--white);
}

.center-dice { display: flex; gap: 14px; margin: 6px 0; }

.pixel-dice {
  width: clamp(34px, 4.5vw, 54px);
  height: clamp(34px, 4.5vw, 54px);
  background: var(--white);
  border: 3px solid var(--black);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 3px;
  gap: 1px;
  transition: transform .1s;
  box-shadow: 2px 2px 0 rgba(0,0,0,.15);
}

.pixel-dice.rolling { animation: shake .1s infinite; }

@keyframes shake {
  0%   { transform: rotate(0) scale(1); }
  25%  { transform: rotate(5deg) scale(1.05); }
  50%  { transform: rotate(-5deg) scale(.95); }
  75%  { transform: rotate(3deg) scale(1.02); }
  100% { transform: rotate(0) scale(1); }
}

.dice-dot { width: 100%; height: 100%; }
.dice-dot.filled { background: var(--black); }

.center-msg {
  font-size: clamp(6px, .9vw, 10px);
  color: var(--white);
  text-align: center;
  padding: 4px;
  max-width: 90%;
  line-height: 1.5;
}

.roll-btn {
  margin-top: 6px;
  font-size: clamp(8px, 1.1vw, 12px);
  padding: 8px 22px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251,208,0,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(251,208,0,0); }
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: clamp(260px, 28vw, 360px);
  background: var(--under);
  border-left: 4px solid var(--brick);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-size: 11px;
  color: var(--white);
}

.sidebar-section {
  padding: 10px 14px;
  border-bottom: 2px solid rgba(200, 76, 9, 0.4);
}

.sidebar-title {
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(200, 76, 9, 0.5);
  letter-spacing: 0.5px;
}

/* 玩家卡片 */
.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-left: 4px solid transparent;
  border-radius: 4px;
  transition: background 0.2s;
}

.player-card.is-active {
  background: rgba(251, 208, 0, 0.15);
  box-shadow: 0 0 0 1px rgba(251, 208, 0, 0.3);
}

.player-card.bankrupt-player {
  opacity: 0.55;
  background: rgba(255, 100, 100, 0.06);
}

.player-card.bankrupt-player .player-rank-badge {
  background: #888 !important;
}

.player-rank-badge {
  font-family: 'Courier New','PingFang SC','Microsoft YaHei',monospace;
  line-height: 1;
}

.player-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}

.player-card.is-active {
  background: #1F2937;
  border-left-color: var(--gold);
  animation: cardGlow 1.5s ease-in-out infinite alternate;
}

@keyframes cardGlow {
  from { box-shadow: 0 0 0 0 rgba(251,208,0,0); }
  to   { box-shadow: 0 0 12px 2px rgba(251,208,0,.25); }
}

.player-card.bankrupt { opacity: .4; text-decoration: line-through; }

.player-avatar-box {
  width: 44px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all .3s;
}

.player-card.is-active .player-avatar-box {
  border-color: var(--gold);
  animation: avatarPulse 1s ease-in-out infinite alternate;
  box-shadow: 0 0 8px rgba(251, 208, 0, 0.3);
}

@keyframes avatarPulse {
  from { transform: scale(1); border-color: var(--gold); }
  to   { transform: scale(1.08); border-color: var(--white); }
}

.player-detail { flex: 1; line-height: 1.6; }
.player-money { color: var(--gold); font-size: 8px; }

.hp-bar-bg {
  width: 100px;
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 3px;
  border-radius: 0;
}

.hp-bar-fill { height: 100%; transition: width .3s; }

.hp-text { font-size: 7px; color: var(--gray); margin-top: 2px; }

/* 资产列表 */
.property-list { max-height: 120px; overflow-y: auto; }

.property-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  border-bottom: 1px solid rgba(200, 76, 9, 0.3);
  cursor: pointer;
  font-size: 8px;
  transition: background .2s;
}

.property-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.property-color-dot {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

/* 日志 */
.game-log { flex: 1; overflow-y: auto; font-size: 8px; line-height: 1.6; }

.log-entry {
  padding: 3px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--gray);
}

.log-entry.important { color: var(--gold); }
.log-entry.danger { color: var(--red); }
.log-entry.boss { color: var(--orange); }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--under);
  border: 4px solid var(--gold);
  padding: 20px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  font-size: 9px;
  line-height: 1.8;
  max-height: 80vh;
  overflow-y: auto;
  color: var(--white);
  clip-path: polygon(0 8px, 8px 8px, 8px 0, calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px));
}

.modal-title { font-size: 13px; color: var(--gold); margin-bottom: 10px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ===== Boss 战斗 ===== */
.boss-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: bossIn .5s ease-out;
}

@keyframes bossIn {
  from { opacity: 0; transform: scale(1.2); }
  to   { opacity: 1; transform: scale(1); }
}

.boss-stage {
  background: var(--under);
  border: 4px solid var(--red);
  padding: 20px 30px;
  max-width: 520px;
  width: 90%;
  text-align: center;
  color: var(--white);
}

.boss-name {
  font-size: clamp(14px, 2.5vw, 22px);
  color: var(--red);
  text-shadow: 2px 2px 0 var(--black);
  margin-bottom: 8px;
  animation: glow 1.5s ease-in-out infinite alternate;
}

@keyframes glow {
  from { text-shadow: 2px 2px 0 var(--black), 0 0 10px rgba(229,37,33,.3); }
  to   { text-shadow: 2px 2px 0 var(--black), 0 0 20px rgba(229,37,33,.6); }
}

.boss-icon-box {
  width: clamp(52px, 8vw, 80px);
  height: clamp(52px, 8vw, 80px);
  background: var(--red-dk);
  border: 4px solid var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto;
  animation: idle 1s ease-in-out infinite alternate;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.15), inset -2px -2px 0 rgba(0,0,0,.3);
}

@keyframes idle {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}

.boss-hp-bg {
  width: 100%;
  height: 16px;
  background: var(--gray-dk);
  border: 2px solid var(--gray);
  margin: 8px 0;
  position: relative;
}

.boss-hp-fill {
  height: 100%;
  background: var(--red);
  transition: width .5s;
  position: relative;
}

.boss-hp-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(255,255,255,.15);
}

.boss-atk-info { font-size: 8px; color: var(--orange); margin: 8px 0; }

.boss-player-box {
  margin: 12px 0;
  padding: 10px;
  background: rgba(255,255,255,.05);
  border: 2px solid;
  font-size: 9px;
}

.boss-player-hp-bg {
  width: 120px;
  height: 8px;
  background: var(--gray-dk);
  border: 1px solid var(--gray);
  margin: 4px auto;
}

.boss-player-hp-fill { height: 100%; transition: width .3s; }

.boss-log {
  font-size: 6px;
  color: var(--gray);
  margin-top: 6px;
  max-height: 60px;
  overflow-y: auto;
}

.boss-btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.boss-btns .pixel-btn { font-size: 8px; padding: 6px 14px; }

.boss-defeated { color: var(--gold); font-size: 18px; animation: bounce .5s ease infinite alternate; }
.boss-reward { color: var(--green); margin: 8px 0; }

/* ===== 帮助 ===== */
.help-content {
  text-align: left;
  font-size: clamp(7px, 1vw, 10px);
  line-height: 2;
  color: var(--white);
}

.help-content h3 {
  color: var(--gold);
  margin: 8px 0 4px;
  font-size: clamp(8px, 1.1vw, 11px);
}

.help-content ul { padding-left: 16px; margin: 4px 0; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  /* 手机：整体纵向排列并可滚动 */
  .game-body {
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 棋盘优先：地图占满宽度与主要高度，HUD 面板移到地图下方 */
  .board-container-map {
    flex-direction: column;
    flex-shrink: 0;
  }
  .board-map-svg-wrap {
    min-height: 62vh;
    padding: 8px;
    flex-shrink: 0;
  }
  .board-hud-panel {
    width: 100%;
    flex-shrink: 0;
    border-left: none;
    border-top: 4px solid var(--brick);
    gap: 8px 12px;
    overflow-y: visible;
    padding: 10px 12px;
  }
  .board-hud-panel .board-center-map {
    flex: 0 0 150px;
  }
  .board-hud-panel .board-myprops {
    flex: 1;
    min-width: 0;
    margin-top: 0;
  }

  .sidebar {
    width: 100%;
    max-height: none;
    flex-shrink: 0; /* 关键：防止被 flex 压缩到不可见 */
    border-left: none;
    border-top: 4px solid var(--red);
  }
}

/* ===== 联机: 角色选择阶段 ===== */
.lobby-players {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 10px 0;
  min-height: 40px;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--under);
  border: 2px solid var(--brick);
  padding: 4px 10px;
  font-size: 7px;
  color: var(--white);
}

.lobby-player.current {
  border-color: var(--gold);
}

.room-info {
  font-size: 7px;
  color: var(--white);
  background: rgba(0,0,0,.5);
  padding: 4px 10px;
  border-radius: 0;
  margin-bottom: 8px;
  text-shadow: 1px 1px 0 rgba(0,0,0,.5);
}

.room-info code {
  font-family: monospace;
  font-size: 9px;
  color: var(--gold);
  background: rgba(0,0,0,.3);
  padding: 2px 4px;
}

/* ==================== 联机版大厅 ==================== */

.lobby-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-lt) 100%);
  gap: 10px;
  padding: 20px;
  box-sizing: border-box;
  /* 内容超高时可上下滚动（body 是 overflow:hidden，滚动发生在本容器内） */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 内容少时垂直居中；内容多时自动贴顶、顶部可达（修复 flex 居中溢出裁顶问题） */
.lobby-screen::before,
.lobby-screen::after {
  content: '';
  margin: auto;
  flex-shrink: 0;
}

.char-card.selected {
  border-color: var(--gold) !important;
  box-shadow: 0 0 8px rgba(251, 208, 0, .5);
}

/* ==================== 联机版游戏画面 ==================== */

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(0, 0, 0, .7);
  color: var(--white);
  font-size: 8px;
}

.game-header .header-left,
.game-header .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.multi-player-card {
  padding: 4px 6px;
  background: rgba(255, 255, 255, .05);
  border-left: 3px solid transparent;
  margin-bottom: 3px;
  font-size: 7px;
}
/* 联机：地产出售行 */
.mp-property-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.mp-property-name { flex: 1; min-width: 0; font-size: 8px; }
.mp-property-lv { color: #43b047; font-size: 7px; }
.mp-sell-btn {
  flex-shrink: 0;
  font-size: 8px !important;
  padding: 5px 8px !important;
  min-width: 72px;
  line-height: 1.2;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}


/* ==================== 标准模式（StdGame） ==================== */
.std-wrap { position: fixed; inset: 0; display: flex; flex-direction: column; background: #0a0618; overflow: hidden; }
.std-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: rgba(10,10,25,.8); color: #fff; font-size: 13px; z-index: 5; }
.std-phase { flex: 1; text-align: center; color: #FFD75E; font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.std-board-outer { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 4px; }
.std-board { position: relative; display: grid; grid-template-columns: repeat(11, 1fr); grid-template-rows: repeat(11, 1fr); aspect-ratio: 1/1; width: min(96vw, 96vh - 120px, 640px); border: 2px solid #333; background: #16213e; }
.std-tile { position: relative; border: 1px solid rgba(0,0,0,.35); min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.std-tile-name { font-size: 8px; line-height: 1.1; color: #222; text-align: center; padding: 1px; word-break: break-all; max-height: 60%; overflow: hidden; }
.std-tile-price { font-size: 7px; color: #444; }
.std-tile-houses { position: absolute; top: 1px; right: 1px; font-size: 7px; }
.std-tile-owner { position: absolute; bottom: 1px; left: 1px; width: 7px; height: 7px; border-radius: 50%; border: 1px solid #000; }
.std-tile-tokens { position: absolute; inset: 0; pointer-events: none; }
.std-token { position: absolute; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #fff; box-shadow: 0 0 2px #000; }
.std-token:nth-child(1) { top: 2px; left: 2px; }
.std-token:nth-child(2) { top: 2px; right: 2px; }
.std-token:nth-child(3) { bottom: 2px; left: 2px; }
.std-token:nth-child(4) { bottom: 2px; right: 2px; }
.std-token:nth-child(5) { top: 12px; left: 2px; }
.std-token:nth-child(6) { bottom: 12px; right: 2px; }

.std-center { grid-area: 2 / 2 / 11 / 11; display: flex; flex-direction: column; padding: 8px; overflow: hidden; }
.std-players { display: flex; flex-direction: column; gap: 3px; }
.std-prow { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 8px; color: #ddd; font-size: 12px; }
.std-prow.cur { background: rgba(255,215,94,.18); outline: 1px solid rgba(255,215,94,.5); }
.std-prow.dead { opacity: .45; text-decoration: line-through; }
.std-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.std-pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.std-pmoney { color: #FFD75E; font-weight: 700; }
.std-log { margin-top: 8px; flex: 1; overflow-y: auto; font-size: 10px; color: #9aa; display: flex; flex-direction: column-reverse; }
.std-logline { padding: 1px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }

.std-actions { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(10,10,25,.92); z-index: 5; max-height: 42vh; overflow-y: auto; }
.std-btn { padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; font-size: 13px; cursor: pointer; }
.std-btn.primary { background: linear-gradient(45deg,#5e7ce2,#7c5ce2); border-color: transparent; font-weight: 600; }
.std-btn.danger { background: #e2504a; border-color: transparent; }
.std-btn.mini { padding: 3px 8px; font-size: 11px; border-radius: 7px; }
.std-btn:disabled { opacity: .4; cursor: not-allowed; }
.std-btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.std-buybox, .std-debtbox, .std-managebox { color: #eee; font-size: 13px; }
.std-hint { color: #888; font-size: 12px; padding: 4px 0; }
.std-props { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; max-height: 20vh; overflow-y: auto; }
.std-proprow { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(255,255,255,.06); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.std-gameover { color: #FFD75E; font-size: 15px; font-weight: 700; text-align: center; }
.std-debtbox .std-btn.danger { margin-top: 8px; width: 100%; }


/* ==================== 标准模式：交易与倒计时 ==================== */
.std-cdbar { position: relative; height: 6px; background: rgba(255,255,255,.08); }
.std-cdfill { height: 100%; background: linear-gradient(90deg,#5e7ce2,#7c5ce2); transition: width 1s linear; }
.std-cdfill.low { background: #e2504a; }
.std-cdtext { position: absolute; right: 6px; top: -18px; font-size: 11px; color: #9aa; }
.std-cdtext.low { color: #ff6b64; font-weight: 700; }
.std-tradein { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: rgba(255,215,94,.15); border-bottom: 1px solid rgba(255,215,94,.4); color: #FFD75E; font-size: 12px; flex-wrap: wrap; }
.std-tradepanel { padding: 10px 12px; background: rgba(20,20,45,.95); border-bottom: 1px solid rgba(255,255,255,.15); max-height: 46vh; overflow-y: auto; }
.std-traderow { display: flex; align-items: center; gap: 8px; color: #eee; font-size: 13px; margin-bottom: 6px; }
.std-traderow select { flex: 1; padding: 6px; border-radius: 8px; background: #fff; color: #222; border: none; }
.std-tradecols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.std-tradecol { background: rgba(255,255,255,.05); border-radius: 10px; padding: 8px; max-height: 24vh; overflow-y: auto; }
.std-tradetitle { font-size: 11px; color: #FFD75E; margin-bottom: 4px; }
.std-tradecol input[type=number] { width: 100%; box-sizing: border-box; padding: 5px; border-radius: 6px; border: none; background: #fff; color: #222; margin-bottom: 4px; font-size: 12px; }
.std-chk { display: flex; align-items: center; gap: 5px; padding: 3px 4px; border-radius: 6px; color: #ddd; font-size: 11px; cursor: pointer; }
.std-chk.on { background: rgba(94,124,226,.35); }


.std-trap { position: absolute; top: 1px; left: 1px; font-size: 8px; }


.std-deedmask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: center; justify-content: center; }
.std-deed { width: min(86vw, 340px); background: #fffdf5; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.std-deedhead { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; color: #fff; font-size: 15px; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.std-deedclose { cursor: pointer; opacity: .85; font-size: 16px; }
.std-deedbody { padding: 10px 14px 14px; color: #333; font-size: 13px; }
.std-deedrow { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed #e5dcc8; }
.std-deedrents { margin: 6px 0; background: #faf6ea; border-radius: 8px; padding: 4px 8px; }


.std-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: rgba(255,255,255,.1); }
.std-token-img { position: absolute; width: 13px; height: 13px; border-radius: 50%; object-fit: cover; border: 1px solid #fff; box-shadow: 0 0 2px #000; top: 2px; }
.std-tile-icon { width: 60%; height: auto; max-height: 45%; object-fit: contain; }
.std-tile-house-img { position: absolute; top: 1px; right: 1px; width: 12px; height: 12px; object-fit: contain; }
.std-dice { display: flex; align-items: center; gap: 3px; color: #FFD75E; font-weight: 800; }
.std-dice-img { width: 18px; height: 18px; object-fit: contain; }
.std-item-img { width: 16px; height: 16px; object-fit: contain; vertical-align: middle; }
.std-scene { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 6px; }

