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

body {
  background: radial-gradient(ellipse at 50% 30%, #2d7fd6 0%, #1257a8 70%, #0d3f80 100%);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#stage {
  position: relative;
  width: min(1200px, 100vw);
  aspect-ratio: 12 / 7;
}
#game {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.hidden { display: none !important; }

/* —— 顶部日期 —— */
#date-box {
  position: absolute;
  top: 10px; left: 10px;
  background: linear-gradient(180deg, #3d7dc4, #1a4f96);
  border: 2px solid #9fd1ff;
  border-radius: 8px;
  padding: 5px 14px;
  color: #eaf6ff;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
#index-line { font-size: 11px; opacity: 0.85; }

/* —— 对手小卡片 —— */
#rivals {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rival {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(61,125,196,0.92), rgba(26,79,150,0.92));
  border: 2px solid #9fd1ff;
  border-radius: 24px;
  padding: 3px 12px 3px 4px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.rival.dead { filter: grayscale(1); opacity: 0.6; }
.rival img { width: 34px; height: 34px; border-radius: 50%; }
.rival-name { font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px rgba(255,255,255,0.6); }
.rival-cash { font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* —— 底部 HUD —— */
#hud {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px 0 92px;
  background: linear-gradient(180deg, #2e7fd8 0%, #1355a8 100%);
  border-top: 2px solid #8fc9ff;
  border-radius: 0 0 10px 10px;
}
#hud-avatar {
  position: absolute;
  left: 8px; bottom: 4px;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: radial-gradient(#fff, #cfe8ff);
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  overflow: hidden;
}
#hud-avatar img { width: 100%; height: 100%; }
#hud-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 4px #fff, 0 2px 3px rgba(0,0,0,0.4);
  min-width: 80px;
}
.hud-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  text-shadow: 0 2px 3px rgba(0,0,0,0.5);
}
.coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe082, #f9a825);
  color: #7b4d00;
  font-weight: 900;
  font-size: 15px;
  border: 2px solid #fff8e1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.coin.house { background: radial-gradient(circle at 35% 30%, #b3e5fc, #0288d1); font-size: 13px; }
.coin.pig { background: radial-gradient(circle at 35% 30%, #f8bbd0, #ec407a); font-size: 13px; }

/* —— 按钮 —— */
#controls {
  position: absolute;
  right: 14px; bottom: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.big-btn {
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  padding: 12px 26px;
  border: 3px solid #ffe082;
  border-radius: 40px;
  background: linear-gradient(180deg, #ffb74d 0%, #f57c00 55%, #e65100 100%);
  cursor: pointer;
  text-shadow: 0 2px 3px rgba(0,0,0,0.4);
  box-shadow: 0 5px 14px rgba(0,0,0,0.45), inset 0 2px 3px rgba(255,255,255,0.5);
  transition: transform 0.1s;
}
.big-btn:hover:not(:disabled) { transform: scale(1.05); }
.big-btn:disabled { filter: grayscale(0.8); opacity: 0.55; cursor: default; }
.big-btn.pulse { animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 5px 14px rgba(0,0,0,0.45), 0 0 0 0 rgba(255,224,130,0.8); }
  50% { box-shadow: 0 5px 14px rgba(0,0,0,0.45), 0 0 0 12px rgba(255,224,130,0); }
}
.round-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  font-size: 20px;
  border: 3px solid #b39ddb;
  background: linear-gradient(180deg, #9575cd, #5e35b1);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.round-btn:hover:not(:disabled) { transform: scale(1.1); }
.round-btn:disabled { opacity: 0.5; }

/* —— 骰子 —— */
#dice-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#dice {
  width: 110px; height: 110px;
  background: linear-gradient(145deg, #ffffff, #dfe6ec);
  border-radius: 22px;
  border: 3px solid #b0bec5;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5), inset 0 2px 4px #fff;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 16px;
  gap: 5px;
}
#dice .pip { border-radius: 50%; }
#dice .pip.on {
  background: radial-gradient(circle at 35% 30%, #4a5568, #1a202c);
  box-shadow: inset 0 -2px 3px rgba(0,0,0,0.5);
}
#dice.shaking { animation: shake 0.35s infinite; }
@keyframes shake {
  0% { transform: rotate(-12deg) translate(-6px, 4px) scale(1.02); }
  25% { transform: rotate(9deg) translate(5px, -7px); }
  50% { transform: rotate(-7deg) translate(-4px, -3px) scale(0.98); }
  75% { transform: rotate(11deg) translate(6px, 5px); }
  100% { transform: rotate(-12deg) translate(-6px, 4px) scale(1.02); }
}
#dice.landed { animation: land 0.4s ease-out; }
@keyframes land {
  0% { transform: scale(1.35); }
  60% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

/* —— 气泡 —— */
#bubble {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  background: linear-gradient(180deg, #eaf6ff 0%, #bfe3ff 100%);
  border: 3px solid #5aa9e6;
  border-radius: 18px;
  padding: 10px 22px 10px 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.4);
  animation: pop 0.25s ease-out;
  z-index: 5;
}
@keyframes pop {
  from { transform: translateX(-50%) scale(0.6); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}
#bubble img { width: 58px; height: 58px; border-radius: 50%; }
#bubble-text {
  font-size: 16px;
  font-weight: 700;
  color: #1a3a5c;
}

/* —— 对话框 —— */
#dialog-layer {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 60, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#dialog {
  min-width: 340px;
  max-width: 640px;
  background: linear-gradient(180deg, #c5d4f2 0%, #9fb4e0 100%);
  border: 3px solid #fff;
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  animation: pop2 0.22s ease-out;
}
@keyframes pop2 {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.dlg-title {
  text-align: center;
  font-size: 21px;
  font-weight: 900;
  color: #d84315;
  text-shadow: 0 1px 0 #fff, 0 2px 3px rgba(0,0,0,0.25);
  margin-bottom: 12px;
}
.prop-name {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: #283593;
  margin-bottom: 8px;
}
.dlg-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.65);
  border-radius: 8px;
  overflow: hidden;
}
.dlg-table td, .dlg-table th {
  padding: 7px 12px;
  font-size: 14px;
  color: #1a2a4a;
  border-bottom: 1px solid rgba(120,140,190,0.35);
}
.dlg-table th {
  background: linear-gradient(180deg, #3f51b5, #283593);
  color: #fff;
  font-size: 13px;
}
.dlg-table .num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.dlg-table .up { color: #c62828; }
.dlg-table .down { color: #2e7d32; }
.dlg-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.dlg-btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  padding: 9px 26px;
  border-radius: 26px;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #90a4ae, #546e7a);
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  transition: transform 0.1s;
}
.dlg-btn:hover { transform: scale(1.06); }
.dlg-btn.primary { background: linear-gradient(180deg, #66bb6a, #2e7d32); }

/* —— 股票 —— */
.stock-cash {
  text-align: center;
  font-weight: 800;
  color: #1a2a4a;
  margin-bottom: 8px;
}
.stock-table td { font-size: 13px; padding: 6px 8px; }
.mini-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid #fff;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.mini-btn.buy { background: linear-gradient(180deg, #ef5350, #c62828); }
.mini-btn.sell { background: linear-gradient(180deg, #66bb6a, #2e7d32); }
.mini-btn:disabled { filter: grayscale(1); opacity: 0.5; cursor: default; }
.mini-btn:hover:not(:disabled) { transform: scale(1.08); }

/* —— 排行榜 —— */
.rank-table td { vertical-align: middle; }
.rank-face { width: 30px; height: 30px; border-radius: 50%; vertical-align: middle; }
.rank-table tr.dead td { opacity: 0.55; }

/* —— 双骰子 —— */
#dice-layer { gap: 26px; }
#dice2 {
  width: 110px; height: 110px;
  background: linear-gradient(145deg, #ffffff, #dfe6ec);
  border-radius: 22px;
  border: 3px solid #b0bec5;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5), inset 0 2px 4px #fff;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 16px;
  gap: 5px;
}
#dice2 .pip { border-radius: 50%; }
#dice2 .pip.on {
  background: radial-gradient(circle at 35% 30%, #4a5568, #1a202c);
  box-shadow: inset 0 -2px 3px rgba(0,0,0,0.5);
}
#dice2.shaking { animation: shake 0.35s infinite; }
#dice2.landed { animation: land 0.4s ease-out; }

/* —— 开场选择 —— */
#setup-layer {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(45,127,214,0.96), rgba(10,50,110,0.97));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  border-radius: 10px;
}
#setup-box { text-align: center; max-width: 860px; width: 92%; }
#setup-title {
  font-size: 44px;
  font-weight: 900;
  color: #ffe082;
  text-shadow: 0 0 12px rgba(255,224,130,0.6), 0 4px 6px rgba(0,0,0,0.5);
  margin-bottom: 22px;
}
.setup-sec {
  font-size: 17px;
  font-weight: 800;
  color: #cfe8ff;
  margin: 14px 0 10px;
  text-shadow: 0 2px 3px rgba(0,0,0,0.4);
}
#map-row, #char-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 8px;
}
.map-card {
  width: 260px;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
  border: 3px solid rgba(255,255,255,0.35);
  border-radius: 16px;
  padding: 16px 12px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.map-card:hover { transform: translateY(-3px); }
.map-card.sel {
  border-color: #ffe082;
  box-shadow: 0 0 18px rgba(255,224,130,0.55);
  background: linear-gradient(180deg, rgba(255,235,170,0.25), rgba(255,255,255,0.08));
}
.map-emoji { font-size: 40px; margin-bottom: 6px; }
.map-name { font-size: 19px; font-weight: 900; color: #fff; text-shadow: 0 2px 3px rgba(0,0,0,0.4); }
.map-sub { font-size: 12px; color: #cfe8ff; margin-top: 4px; }
.char-card {
  width: 120px;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
  border: 3px solid rgba(255,255,255,0.35);
  border-radius: 16px;
  padding: 12px 8px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.char-card:hover { transform: translateY(-3px); }
.char-card.sel {
  border-color: #ffe082;
  box-shadow: 0 0 18px rgba(255,224,130,0.55);
  background: linear-gradient(180deg, rgba(255,235,170,0.25), rgba(255,255,255,0.08));
}
.char-card img { width: 72px; height: 72px; }
.char-name { font-size: 15px; font-weight: 800; text-shadow: 0 1px 2px rgba(255,255,255,0.7); }
#setup-start { margin-top: 22px; font-size: 24px; padding: 14px 46px; }

/* —— 岔路口 —— */
#fork-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
#fork-tip {
  position: absolute;
  top: 9%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff8e1, #ffe082);
  border: 3px solid #f57f17;
  border-radius: 22px;
  padding: 8px 22px;
  font-size: 17px;
  font-weight: 900;
  color: #7b4d00;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  animation: pop 0.25s ease-out;
}
.fork-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255,248,225,0.95);
  border: 3px solid #f57f17;
  border-radius: 14px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 14px rgba(0,0,0,0.45);
  animation: forkPulse 0.9s infinite;
  z-index: 7;
}
.fork-btn:hover { background: #fff; }
@keyframes forkPulse {
  0%, 100% { box-shadow: 0 6px 14px rgba(0,0,0,0.45), 0 0 0 0 rgba(255,213,79,0.7); }
  50% { box-shadow: 0 6px 14px rgba(0,0,0,0.45), 0 0 0 10px rgba(255,213,79,0); }
}
.fork-arrow { font-size: 20px; color: #e65100; display: inline-block; }
.fork-label { font-size: 12px; font-weight: 800; color: #5d4037; white-space: nowrap; }

/* —— 道具卡栏 —— */
#card-bar {
  position: absolute;
  left: 10px;
  bottom: 92px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 4;
}
.card-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  background: linear-gradient(180deg, #fff8e1, #ffecb3);
  border: 2px solid #ffb300;
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  font-size: 13px;
  font-weight: 800;
  color: #7b4d00;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  cursor: default;
  opacity: 0.75;
  transition: transform 0.1s;
}
.card-chip.usable {
  cursor: pointer;
  opacity: 1;
  animation: pulse 1.4s infinite;
}
.card-chip.usable:hover { transform: scale(1.08); }
.card-icon { font-size: 16px; }

/* —— 银行 & 选择器 —— */
.bank-input {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
#bank-amt {
  width: 130px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid #7986cb;
  text-align: right;
}
.bank-msg {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 800;
  color: #1a3a5c;
}
.dlg-btn.warn { background: linear-gradient(180deg, #ffb74d, #ef6c00); }
.pick-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}
.pick-n { min-width: 56px; font-size: 20px; }
.pick-rival { display: flex; align-items: center; gap: 8px; }
.stock-sym {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 800;
  color: #5c6bc0;
  background: rgba(92,107,192,0.15);
  border-radius: 6px;
  padding: 1px 5px;
}
