/* style.css — 数字魔法大战 网页版(像素卡通画风) */
/* 设计基准:phone-shape,#app 容器最大 600px 宽,居中。
   像素字体 VT323 / Press Start 2P 用于数字,ZCOOL KuaiLe 用于中文标题 */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow-x: hidden; }
body {
  background:
    radial-gradient(circle at 20% 20%, rgba(120,40,160,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(60,180,255,0.12) 0%, transparent 50%),
    linear-gradient(180deg, #1a1040 0%, #0d1a3d 50%, #1a0840 100%);
  color: #fff8e0;
  /* 中文 ZCOOL KuaiLe 卡通圆体,数字/英文交给 VT323 */
  font-family: 'ZCOOL KuaiLe', -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-y: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible,
select:focus-visible,
input:focus-visible,
.stone:focus-visible {
  outline: 2px solid var(--arena-gold, #ffd700);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(79,216,232,0.18), 0 0 18px rgba(230,185,92,0.34);
}

/* 数字和英文用 VT323 像素体 */
.stone, .cast-btn, .heart-num, .heart-icon, .score-big, .score-divider,
.board-stat-val, .placed-num.stone, .placed-remain, .room-code,
#deck-count, #round-number, #game-room-code, .player-tag,
.cast-banner-msg, .cast-num, .owl-num-mine, .game-over-emoji,
.dice-roll, .dice-num {
  font-family: 'VT323', 'Press Start 2P', monospace;
  letter-spacing: 0;
}

/* ====== 全屏星空背景 ====== */
.bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  width: 2px; height: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
  animation: twinkle 3s ease-in-out infinite;
}
/* ---- 背景飞船:从屏幕一侧飞到另一侧,不同高度/速度/方向 ---- */
.bg-ship {
  position: fixed;
  left: 0;
  font-size: 28px;
  opacity: 0.75;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 0 8px rgba(120,200,255,0.6)) drop-shadow(2px 2px 0 rgba(0,0,0,0.5));
  /* delay 期间保持 0% 关键帧(屏幕外),否则正式起飞前会停在屏幕左边可见 */
  animation-fill-mode: backwards !important;
}
.bg-ship.ship1 { top: 16%; animation: rocketFlyRight 16s linear infinite; }
.bg-ship.ship2 { top: 42%; font-size: 34px; animation: ufoFlyLeft 24s linear infinite; animation-delay: 4s; }
.bg-ship.ship3 { top: 68%; font-size: 22px; animation: rocketFlyRight 20s linear infinite; animation-delay: 9s; }
.bg-ship.ship4 { top: 84%; font-size: 26px; animation: ufoFlyLeft 28s linear infinite; animation-delay: 14s; }
.bg-ship.ship5 { top: 6%;  font-size: 20px; animation: ufoFlyRight 34s linear infinite; animation-delay: 6s; }
/* 🚀 默认朝右上 45°,转 45° 后朝正右 */
@keyframes rocketFlyRight {
  0%   { transform: translateX(-18vw) translateY(0)    rotate(45deg); }
  50%  { transform: translateX(50vw)  translateY(14px) rotate(45deg); }
  100% { transform: translateX(118vw) translateY(0)    rotate(45deg); }
}
/* 🛸/🛰️ 不旋转,带上下漂浮 */
@keyframes ufoFlyLeft {
  0%   { transform: translateX(118vw) translateY(0); }
  25%  { transform: translateX(84vw)  translateY(-14px); }
  50%  { transform: translateX(50vw)  translateY(0); }
  75%  { transform: translateX(16vw)  translateY(12px); }
  100% { transform: translateX(-18vw) translateY(0); }
}
@keyframes ufoFlyRight {
  0%   { transform: translateX(-18vw) translateY(0); }
  50%  { transform: translateX(50vw)  translateY(-12px); }
  100% { transform: translateX(118vw) translateY(0); }
}

.star.s1 { top: 10%; left: 8%;  animation-delay: 0s; }
.star.s2 { top: 25%; left: 80%; animation-delay: 0.5s; }
.star.s3 { top: 50%; left: 15%; animation-delay: 1s; }
.star.s4 { top: 65%; left: 88%; animation-delay: 1.5s; }
.star.s5 { top: 80%; left: 30%; animation-delay: 2s; }
.star.s6 { top: 35%; left: 50%; animation-delay: 2.5s; }
.star.s7 { top: 15%; left: 65%; animation-delay: 0.3s; }
.star.s8 { top: 90%; left: 60%; animation-delay: 1.8s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.6); }
}

/* ====== app 容器 ====== */
#app {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  /* 底部留 50px:为 site-footer(28px)+ debug-bar(13px)留出空间 */
  padding: 2px 0 50px;
}

.page { display: block; padding: 0 14px; }
/* 游戏页:窄左右 padding,纵向更紧 */
#page-game.page { padding: 0 6px; }
[hidden] { display: none !important; }

/* ====== 按钮 ====== */
.btn {
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 0;
  border: none;
  border-radius: 6px;
  letter-spacing: 2px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; }
.btn-primary {
  background: linear-gradient(180deg, rgba(0,200,255,0.22), rgba(0,100,200,0.4));
  color: #00f0ff;
  border: 1px solid #00d4ff;
  text-shadow: 0 0 6px rgba(0,200,255,0.8);
  box-shadow:
    inset 0 0 12px rgba(0,200,255,0.3),
    0 0 12px rgba(0,200,255,0.4);
}
.btn-secondary {
  background: linear-gradient(180deg, rgba(255,100,200,0.18), rgba(180,50,140,0.35));
  color: #ff90ee;
  border: 1px solid #ff60d0;
  text-shadow: 0 0 6px rgba(255,100,200,0.8);
  box-shadow:
    inset 0 0 12px rgba(255,100,200,0.3),
    0 0 12px rgba(255,100,200,0.4);
}
.btn-text {
  background: transparent;
  color: rgba(170,220,255,0.7);
  text-shadow: 0 0 4px rgba(0,200,255,0.4);
  font-weight: 400;
}
.btn-link {
  background: transparent;
  border: none;
  color: #00d4ff;
  font-size: 13px;
  padding: 0 6px;
  text-decoration: underline;
}

/* ====== 大厅 ====== */
.game-title {
  text-align: center;
  font-size: 36px;
  color: #ffd700;
  font-weight: 800;
  letter-spacing: 6px;
  margin: 30px 0 12px;
  text-shadow:
    0 0 10px rgba(255,215,0,0.8),
    0 0 22px rgba(255,200,0,0.5),
    3px 3px 4px rgba(0,0,0,0.7);
  animation: titleGlow 2.6s ease-in-out infinite;
}
@keyframes titleGlow {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.25); }
}
.author-credit { text-align: center; margin-bottom: 30px; }
.author-name {
  color: #00f0ff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  text-shadow: 0 0 8px rgba(0,200,255,0.7), 0 0 16px rgba(0,200,255,0.4);
  animation: authorSparkle 2s ease-in-out infinite;
}
@keyframes authorSparkle {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}
.copyright-hint {
  font-size: 12px;
  color: rgba(170,220,255,0.55);
  margin-top: 6px;
}
.lobby-nickname {
  text-align: center;
  font-size: 15px;
  color: #aaccff;
  margin: 16px 0 24px;
}
.lobby-nickname .nickname-text {
  color: #00f0ff;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(0,200,255,0.6);
  padding: 0 4px;
}
.lobby-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 24px;
}

/* ====== 房间(等待) ====== */
.room-header { text-align: center; padding: 22px 0 14px; }
.room-code-label {
  font-size: 13px;
  color: #aaccff;
  letter-spacing: 3px;
  text-shadow: 0 0 5px rgba(0,200,255,0.5);
}
.room-code {
  font-size: 60px;
  font-weight: 700;
  color: #ffd700;
  letter-spacing: 10px;
  margin: 4px 0;
  font-family: -apple-system, "SF Mono", Menlo, monospace;
  text-shadow:
    0 0 12px rgba(255,215,0,0.9),
    0 0 24px rgba(255,200,0,0.55),
    0 0 36px rgba(0,220,255,0.4);
  line-height: 1.1;
}
.room-hint { font-size: 12px; color: #aaccff; }
.room-copy-btn {
  margin-top: 8px;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(79,216,232,0.56);
  background: rgba(79,216,232,0.1);
  color: #bff8ff;
  font-size: 13px;
  font-weight: 700;
}
.room-copy-btn:active { transform: translateY(1px); }

.player-list { margin: 14px 8px 0; }
.player-list-title {
  font-size: 13px;
  color: #c0e0ff;
  margin-bottom: 8px;
  letter-spacing: 2px;
}
.player-row {
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, rgba(10,25,55,0.6), rgba(5,15,38,0.72));
  border: 1px solid #00d4ff;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 6px;
  gap: 12px;
  box-shadow: inset 0 0 8px rgba(0,200,255,0.18), 0 0 8px rgba(0,200,255,0.25);
}
.player-row.empty {
  background: rgba(0,50,100,0.15);
  border: 1px dashed rgba(0,200,255,0.45);
  box-shadow: none;
  color: rgba(170,220,255,0.5);
}
.player-row.is-bot { background: rgba(255,100,200,0.05); }
.player-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6a95d4, #3e6ba6);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px #2a4070;
}
.player-avatar.empty {
  background: transparent;
  color: rgba(0,200,255,0.5);
  border: 1px dashed rgba(0,200,255,0.5);
  box-shadow: none;
}
.player-row .player-name { flex: 1; font-size: 15px; color: #e8edf4; }
.player-row .player-name.empty { color: rgba(170,220,255,0.55); font-size: 13px; }
.player-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 4px;
  white-space: nowrap;
}
.player-tag.host {
  background: rgba(255,215,0,0.18);
  color: #ffd700;
  border: 1px solid #ffd700;
}
.player-tag.self {
  background: rgba(0,200,255,0.15);
  color: #00f0ff;
  border: 1px solid #00d4ff;
}
.player-tag.bot-weak   { background: rgba(150,220,150,0.15); color: #9dffa1; border: 1px solid #6cd070; }
.player-tag.bot-medium { background: rgba(255,200,100,0.15); color: #ffcb6b; border: 1px solid #d49a3c; }
.player-tag.bot-strong { background: rgba(255,100,200,0.18); color: #ff7adf; border: 1px solid #ff60d0; }
.player-remove-btn {
  margin-left: auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,80,80,0.18);
  color: #ff8080;
  border: 1px solid rgba(255,80,80,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.bot-add-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 8px 0;
  padding: 8px 14px;
  background: rgba(20,30,60,0.55);
  border: 1px solid rgba(0,200,255,0.25);
  border-radius: 8px;
}
.bot-add-label { color: #aaccff; font-size: 13px; }
.bot-add-btn {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 12px;
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.5);
  color: #aaccff;
}
.bot-add-btn.bot-weak   { color: #9dffa1; border-color: #6cd070; }
.bot-add-btn.bot-medium { color: #ffcb6b; border-color: #d49a3c; }
.bot-add-btn.bot-strong { color: #ff7adf; border-color: #ff60d0; }

.win-target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 8px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(10,25,55,0.6), rgba(5,15,38,0.72));
  border: 1px solid #00d4ff;
  border-radius: 6px;
}
.wt-label { color: #aaccff; font-size: 14px; }
.wt-picker {
  font-size: 15px;
  color: #00f0ff;
  font-weight: bold;
  padding: 4px 12px;
  background: linear-gradient(180deg, rgba(0,200,255,0.22), rgba(0,100,200,0.4));
  border: 1px solid #00d4ff;
  border-radius: 4px;
}

.action-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 8px 8px;
}

/* ====== 游戏(上下尺寸 -32% 累计紧凑版,避免任何人数滑动)====== */
.game-top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border-bottom: 1px solid rgba(0,200,255,0.3);
  background: rgba(5,10,30,0.5);
}
.room-code-small { font-size: 12px; color: #aaccff; }
.turn-indicator { flex: 1; text-align: center; font-size: 12px; }
.turn-indicator .turn-mine {
  color: #ffd700;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(255,215,0,0.7);
}
.turn-indicator .turn-other { color: #aaccff; }
.help-btn {
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.5);
  color: #00d4ff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
}
.exit-btn {
  background: rgba(255,100,100,0.12);
  border: 1px solid rgba(255,100,100,0.55);
  color: #ff9090;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.exit-btn:hover { background: rgba(255,100,100,0.22); }
.exit-btn:active { transform: scale(0.96); }

.board {
  margin: 3px 8px;
  padding: 5px 14px;
  background: linear-gradient(180deg, rgba(5,15,40,0.65), rgba(3,8,22,0.78));
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: 8px;
  box-shadow: inset 0 0 12px rgba(0,200,255,0.1);
}
.board-secrets {}
.board-label { font-size: 11px; color: #aaccff; letter-spacing: 1.5px; }
.secret-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; min-height: 34px; }
.secret-empty { color: rgba(170,220,255,0.45); font-size: 11px; padding: 7px 0; }
.board-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 4px 0 2px;
}
.board-stat { font-size: 13px; color: #aaccff; }
.board-stat-val {
  color: #ffd700;
  font-weight: 700;
  font-size: 19px;
  margin-left: 4px;
  text-shadow: 0 0 6px rgba(255,215,0,0.7);
}
.placed-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 3px 2px 1px;
}
.placed-item { display: flex; flex-direction: column; align-items: center; }
/* 顶部数字:模拟手牌石头(青蓝底 + 青色描边发光),和上方区分明显 */
.placed-num.stone {
  width: 24px;
  height: 26px;
  margin-bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  background: linear-gradient(180deg, rgba(20,60,120,0.7), rgba(8,25,60,0.85));
  color: #00f0ff;
  text-shadow: 0 0 4px #00d4ff;
  border: 1px solid #00d4ff;
  box-shadow:
    inset 0 0 4px rgba(0,200,255,0.3),
    0 0 4px rgba(0,200,255,0.4);
}
/* 底部剩余张数 */
.placed-remain {
  font-size: 10px;
  color: #ffd700;
  font-weight: 600;
  margin-top: 2px;
  text-shadow: 0 0 4px rgba(255,215,0,0.55);
  white-space: nowrap;
}
.placed-remain.zero {
  color: #c83848;
  text-shadow: 0 0 4px rgba(200,56,72,0.7);
  font-weight: 700;
}
.placed-dots {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  height: 40px;
  justify-content: flex-start;
}
.placed-dot {
  width: 16px; height: 3px;
  border-radius: 1px;
  background: #2a3a5a;
}
.placed-dot.used {
  background: linear-gradient(180deg, #6090d0, #3a5d9a);
}
.pick-hint {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  margin-top: 4px;
}
.pick-hint.me {
  background: rgba(255,215,0,0.15);
  color: #ffd700;
  border: 1px solid rgba(255,215,0,0.5);
  animation: pickPulse 1s ease-in-out infinite;
}
.pick-hint.other { background: rgba(0,200,255,0.1); color: #aaccff; }
@keyframes pickPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,215,0,0); }
  50%      { box-shadow: 0 0 12px rgba(255,215,0,0.6); }
}

/* 玩家卡(其他玩家 + 自己,上下紧凑 -32% 累计) */
.player-card, .me-card {
  padding: 4px 12px;
  background: linear-gradient(180deg, rgba(10,25,55,0.6), rgba(5,15,38,0.72));
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: 8px;
  margin: 2px 8px;
  position: relative;
  box-shadow: inset 0 0 8px rgba(0,200,255,0.08);
}
.player-card.active, .me-card.my-turn {
  border-color: #ffd700;
  background: linear-gradient(180deg, rgba(40,30,10,0.65), rgba(20,15,5,0.78));
  animation: activePulse 1.6s ease-in-out infinite;
}
@keyframes activePulse {
  0%, 100% { box-shadow: inset 0 0 8px rgba(255,215,0,0.15), 0 0 0 rgba(255,215,0,0); }
  50%      { box-shadow: inset 0 0 12px rgba(255,215,0,0.25), 0 0 12px rgba(255,215,0,0.5); }
}
.player-card.dead, .me-card.dead { opacity: 0.4; }
.player-card.offline { background: rgba(120,100,80,0.12); filter: grayscale(40%); }
.player-card.damaged, .me-card.damaged {
  animation: damageShake 0.4s ease-in-out;
  background: rgba(200,56,72,0.12) !important;
}
@keyframes damageShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); } 40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}
.player-card.healed, .me-card.healed {
  background: rgba(74,144,80,0.18) !important;
  animation: healFlash 0.6s ease-out;
}
@keyframes healFlash {
  0%   { background: rgba(74,144,80,0.35) !important; }
  100% { background: rgba(74,144,80,0.05) !important; }
}

.player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  position: relative;
  flex-wrap: nowrap;
}
.player-header .player-name {
  font-size: 15px;
  font-weight: 600;
  color: #e8edf4;
  text-shadow: 0 0 4px rgba(0,200,255,0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 45%;
  flex: 0 1 auto;
}
.bot-tag { color: #c08030; font-size: 11px; }

.hp-bar { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.heart-icon {
  font-size: 16px;
  color: #ff4060;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255,80,100,0.7);
  filter: drop-shadow(0 0 4px rgba(255,80,100,0.5));
}
.heart-num {
  font-size: 15px;
  font-weight: 700;
  color: #ff90a0;
  margin-left: 2px;
  text-shadow: 0 0 4px rgba(255,100,120,0.6);
  letter-spacing: 0.5px;
}
/* 保留旧 .heart 类(防误用) */
.heart {
  width: 11px; height: 11px;
  background: radial-gradient(circle at 32% 28%, #ff95a5, #d04050 50%, #8a1010);
  border-radius: 50%;
}

.score-big {
  font-size: 17px;
  font-weight: 700;
  color: #ffd700;
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  text-shadow:
    0 0 6px rgba(255,215,0,0.85),
    0 0 12px rgba(255,200,0,0.45);
}
.score-divider { font-size: 11px; color: rgba(255,215,0,0.7); margin: 0 1px; font-weight: 400; }

.owl-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}
.owl-icon {
  font-size: 14px;
  filter: drop-shadow(0 0 4px rgba(255,200,0,0.6));
}
.owl-row.my-owls { gap: 4px; }
.owl-num-mine {
  font-size: 14px;
  font-weight: 700;
  color: #ffd700;
  padding: 1px 6px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,200,60,0.22), rgba(180,110,0,0.32));
  border: 1px solid rgba(255,215,0,0.75);
  text-shadow: 0 0 6px rgba(255,215,0,0.9);
  box-shadow: inset 0 0 4px rgba(255,215,0,0.35);
  cursor: pointer;
  line-height: 1.4;
}

/* 手牌(咒语石,高度 -32% 累计紧凑版) */
.hand { display: flex; gap: 5px; flex-wrap: wrap; }
.stone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-weight: bold;
  flex-shrink: 0;
}
.stone-face {
  background: linear-gradient(180deg, rgba(20,60,120,0.7), rgba(8,25,60,0.85));
  color: #00f0ff;
  width: 38px; height: 33px;
  font-size: 17px;
  text-shadow: 0 0 6px #00d4ff;
  border: 1px solid #00d4ff;
  box-shadow: inset 0 0 6px rgba(0,200,255,0.3), 0 0 8px rgba(0,200,255,0.4);
}
.stone-back {
  background: linear-gradient(180deg, rgba(40,25,70,0.75), rgba(20,12,40,0.85));
  color: #ffd700;
  width: 38px; height: 33px;
  font-size: 14px;
  text-shadow: 0 0 6px #ffd700;
  border: 1px solid #ffd700;
  box-shadow: inset 0 0 6px rgba(255,215,0,0.22), 0 0 8px rgba(255,215,0,0.4);
}
.stone.mini { width: 32px; height: 27px; font-size: 14px; }
.stone.small { width: 34px; height: 30px; font-size: 14px; }
.stone.tiny { width: 26px; height: 22px; font-size: 12px; }
.stone.secret-mine {
  background: linear-gradient(180deg, rgba(80,40,10,0.8), rgba(40,18,5,0.9));
  color: #ffaa44;
  border: 1px solid #ffaa44;
  text-shadow: 0 0 6px #ffaa44;
}
.stone.pickable {
  animation: pickStonePulse 1s ease-in-out infinite;
}
@keyframes pickStonePulse {
  0%, 100% { box-shadow: 0 0 0 1px #ffd700, 0 0 8px rgba(255,215,0,0.5); }
  50%      { box-shadow: 0 0 0 2px #ffd700, 0 0 16px rgba(255,215,0,1); }
}

.float-num {
  position: absolute;
  right: 14px;
  top: 6px;
  font-size: 26px;
  font-weight: bold;
  pointer-events: none;
  animation: floatUp 1.3s ease-out forwards;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.float-dmg { color: #c83848; }
.float-heal { color: #4a9050; }
@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(10px) scale(0.8); }
  20%  { opacity: 1; transform: translateY(0)   scale(1.2); }
  100% { opacity: 0; transform: translateY(-50px) scale(1); }
}

/* 死亡横幅(紧凑) */
.dead-banner {
  text-align: center;
  font-size: 14px;
  color: #c83848;
  padding: 5px 10px;
  border: 1px solid #c83848;
  border-radius: 6px;
  margin: 4px 8px;
  background: rgba(200,56,72,0.1);
  text-shadow: 0 0 6px rgba(200,56,72,0.6);
}

/* 操作栏(施法 + 结束回合,sticky 在 site-footer 之上) */
.action-bar {
  position: sticky;
  bottom: 42px;  /* 让出 debug-bar(13px)+ site-footer(28px)+ 1px 间隙 */
  background: linear-gradient(180deg, rgba(5,10,30,0.95), rgba(2,5,18,0.98));
  padding: 5px 12px;
  border-top: 2px solid #00d4ff;
  box-shadow: 0 -3px 10px rgba(0,200,255,0.3);
  z-index: 40;
}
.floor-hint {
  font-size: 11px;
  color: #c08030;
  text-align: center;
  margin-bottom: 3px;
}
.cast-row { display: flex; gap: 4px; margin-bottom: 5px; }
.cast-btn {
  flex: 1 1 0;
  min-width: 0;
  background: linear-gradient(180deg, rgba(0,200,255,0.22), rgba(0,100,200,0.4));
  color: #00f0ff;
  border-radius: 4px;
  font-size: 15px;
  font-weight: bold;
  padding: 6px 0;
  border: 1px solid #00d4ff;
  text-shadow: 0 0 4px rgba(0,200,255,0.9);
}
.cast-btn:disabled {
  background: rgba(80,100,130,0.2);
  color: rgba(170,200,255,0.4);
  border-color: rgba(170,200,255,0.25);
  opacity: 0.5;
}
.end-btn {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,100,200,0.2), rgba(180,50,140,0.4));
  color: #ff90ee;
  font-size: 13px;
  font-weight: bold;
  border-radius: 6px;
  padding: 6px 0;
  border: 1px solid #ff60d0;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 4px rgba(255,100,200,0.9);
}
.end-btn:disabled {
  background: rgba(80,100,130,0.2);
  color: rgba(170,200,255,0.4);
  border-color: rgba(170,200,255,0.25);
  opacity: 0.5;
}

/* ====== 弹层(Overlay)====== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,5,20,0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, #102040, #050a20);
  border: 1px solid #00d4ff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 30px rgba(0,200,255,0.4);
  position: relative;
}
/* 弹窗右上角关闭按钮 */
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,100,100,0.15);
  border: 1px solid rgba(255,100,100,0.55);
  color: #ff9090;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { background: rgba(255,100,100,0.3); transform: scale(1.08); }
.modal-close:active { transform: scale(0.92); }
.modal.modal-large { max-height: 80vh; overflow-y: auto; }
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #00f0ff;
  text-align: center;
  margin-bottom: 12px;
  text-shadow: 0 0 6px rgba(0,200,255,0.6);
}
.modal-sub { font-size: 13px; color: #aaccff; text-align: center; margin-bottom: 10px; }
.modal-sub.small { font-size: 11px; opacity: 0.7; }
.modal-content {
  font-size: 13px;
  color: #d8e2ee;
  margin-bottom: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.modal-content strong { color: #ffd700; }
.modal-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  background: rgba(0,30,60,0.6);
  border: 1px solid #00d4ff;
  border-radius: 5px;
  color: #00f0ff;
  margin-bottom: 12px;
  font-family: inherit;
}
.modal-input:focus { outline: none; box-shadow: 0 0 8px rgba(0,200,255,0.5); }
.modal-buttons { display: flex; gap: 10px; }
.modal-buttons .btn { flex: 1; }

.score-table {
  background: rgba(0,30,60,0.4);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 14px;
}
.score-row {
  display: flex;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,200,255,0.15);
  font-size: 13px;
}
.score-row:last-child { border-bottom: none; }
.sr-name { flex: 1; color: #d8e2ee; }
.sr-name.me { color: #ffd700; font-weight: 600; }
.sr-gain { color: #4ade80; margin-right: 12px; font-weight: 600; }
.sr-total { color: #00f0ff; font-weight: 600; min-width: 40px; text-align: right; }

.game-over-emoji { text-align: center; font-size: 48px; margin: 8px 0; }
.game-over-title {
  text-align: center;
  font-size: 22px;
  color: #ffd700;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 0 8px rgba(255,215,0,0.8);
}

/* ====== Toast ====== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 8px 16px;
  border-radius: 16px;
  font-size: 13px;
  z-index: 200;
  border: 1px solid #00d4ff;
}

/* ====== 施法横幅(顶部弹一下) ====== */
.cast-banner {
  position: fixed;
  top: 13%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 86%;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 150;
  text-align: center;
  animation: bannerPop 0.3s ease-out;
}
.cast-banner.success {
  background: rgba(0,200,255,0.25);
  border: 1px solid #00d4ff;
  color: #00f0ff;
  text-shadow: 0 0 6px rgba(0,200,255,0.7);
}
.cast-banner.fail {
  background: rgba(200,56,72,0.25);
  border: 1px solid #c83848;
  color: #ff8090;
  text-shadow: 0 0 6px rgba(200,56,72,0.7);
}
@keyframes bannerPop {
  0%   { opacity: 0; transform: translate(-50%, -10px) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
/* 横幅里"猜了数字 N"的 N 突出显示 */
.cast-banner .cast-num {
  font-size: 26px;
  font-weight: 800;
  color: #ffd700;
  margin: 0 4px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255,215,0,0.18);
  border: 1px solid rgba(255,215,0,0.6);
  text-shadow: 0 0 8px rgba(255,215,0,0.9);
  display: inline-block;
  line-height: 1.1;
  vertical-align: middle;
}
.dice-roll {
  font-size: 18px;
  font-weight: 700;
  color: #ffd700;
  margin-top: 4px;
  text-shadow: 0 0 8px rgba(255,215,0,0.7);
}

/* ====== 全屏法术特效 ====== */
.spell-fx {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  pointer-events: none;
  animation: fxFade 1.8s ease-out forwards;
}
.spell-fx-icon {
  font-size: 100px;
  animation: fxPop 1s ease-out;
  filter: drop-shadow(0 0 30px rgba(255,215,0,0.8));
}
.spell-fx-name {
  font-size: 26px;
  font-weight: 700;
  color: #ffd700;
  margin-top: 12px;
  text-shadow: 0 0 12px rgba(255,215,0,0.9);
}
@keyframes fxPop {
  0%   { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes fxFade {
  0%, 80% { opacity: 1; }
  100%    { opacity: 0; }
}

/* ====== 站点备案信息栏(最底,清晰可读,永久可见) ====== */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #c8d8f0;
  background: rgba(8,15,40,0.95);
  border-top: 1px solid rgba(0,200,255,0.45);
  padding: 6px 10px;
  z-index: 60;
  letter-spacing: 0.5px;
  box-shadow: 0 -2px 8px rgba(0,200,255,0.18);
}
.site-footer .footer-icp {
  color: #ffd700;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(255,215,0,0.55);
}
.site-footer .footer-divider { color: rgba(170,220,255,0.5); margin: 0 4px; }
.site-footer .footer-copy { color: #aaccff; font-weight: 400; }

/* ====== Debug bar(放在 footer 上方,只在游戏页有用) ====== */
.debug-bar {
  position: fixed;
  bottom: 28px;   /* 让出 footer 的高度,堆叠在它之上 */
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  color: #9cf;
  background: rgba(0,0,0,0.65);
  padding: 1px 6px;
  z-index: 50;
  border-top: 1px solid rgba(0,80,160,0.5);
  line-height: 1.2;
}

/* ====== 响应式微调 ====== */
@media (max-width: 380px) {
  .stone-face, .stone-back { width: 32px; height: 42px; font-size: 18px; }
  .stone.mini { width: 28px; height: 36px; font-size: 16px; }
  .heart { width: 9px; height: 9px; }
  .player-header .player-name { font-size: 13px; }
  .score-big { font-size: 15px; }
  .cast-btn { font-size: 15px; padding: 8px 0; }
  .game-title { font-size: 28px; letter-spacing: 4px; }
  .room-code { font-size: 50px; letter-spacing: 8px; }
}

/* ============================================================
   ====== 像素卡通画风覆盖(放在最后,优先级最高)===========
   ============================================================ */

/* ---- 字体放大 + 卡通圆体 ---- */
.game-title {
  font-family: 'ZCOOL KuaiLe', sans-serif;
  color: #ffe066;
  font-size: 42px;
  letter-spacing: 8px;
  text-shadow:
    3px 3px 0 #8b3a8b,
    6px 6px 0 #4a1d4a,
    0 0 20px rgba(255,224,102,0.6);
  -webkit-text-stroke: 1px #5a1d5a;
  animation: titleBounce 1.8s ease-in-out infinite;
}
@keyframes titleBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.author-name {
  font-family: 'ZCOOL KuaiLe', sans-serif;
  color: #ff8fc7;
  text-shadow: 2px 2px 0 #5b1f4a, 0 0 12px rgba(255,143,199,0.6);
}

/* ---- 房间号:像素大字 ---- */
.room-code {
  font-family: 'VT323', 'Press Start 2P', monospace;
  color: #ffe066;
  font-size: 100px;
  letter-spacing: 10px;
  text-shadow:
    4px 4px 0 #c46b00,
    8px 8px 0 #6e3800,
    0 0 24px rgba(255,224,102,0.7);
}

/* ---- 全局:去渐变,改纯色块 + 像素描边 ---- */
.player-card, .me-card {
  background: #2b1d4a !important;
  border: 3px solid #6f4abf !important;
  border-radius: 6px !important;
  box-shadow:
    0 4px 0 #1a0d33,        /* 下方像素阴影 */
    inset 0 0 0 1px rgba(255,255,255,0.08);
}
.player-card.active, .me-card.my-turn {
  background: #3a3010 !important;
  border-color: #ffd84a !important;
  box-shadow:
    0 4px 0 #5a4708,
    inset 0 0 0 2px rgba(255,255,255,0.15),
    0 0 20px rgba(255,216,74,0.5) !important;
  animation: pixelPulse 0.8s ease-in-out infinite;
}
@keyframes pixelPulse {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
.player-card.offline {
  background: #1a1a1a !important;
  border-color: #555 !important;
  filter: saturate(0.3);
}

/* ---- 咒语石(stone):像素卡牌 ---- */
.stone-face {
  background: #1a5a9a !important;
  border: 2px solid #6cf !important;
  border-radius: 4px !important;
  color: #fff !important;
  font-family: 'VT323', monospace !important;
  text-shadow: 2px 2px 0 #0a3060, 0 0 6px rgba(108,204,255,0.6) !important;
  box-shadow:
    0 3px 0 #052448,
    inset 0 0 0 1px rgba(255,255,255,0.25) !important;
  font-size: 22px !important;
}
.stone-back {
  background: #582890 !important;
  border: 2px solid #ffd84a !important;
  border-radius: 4px !important;
  color: #ffd84a !important;
  font-family: 'VT323', monospace !important;
  text-shadow: 2px 2px 0 #2a0d55, 0 0 6px rgba(255,216,74,0.6) !important;
  box-shadow:
    0 3px 0 #2a1450,
    inset 0 0 0 1px rgba(255,255,255,0.25) !important;
  font-size: 18px !important;
}
.stone.mini { font-size: 18px !important; }
.stone.small { font-size: 19px !important; }
.stone.tiny { font-size: 14px !important; }
.stone.secret-mine {
  background: #c2540a !important;
  border-color: #ffaa44 !important;
  color: #fff !important;
}

/* ---- 桌面板 ---- */
.board {
  background: #1a1248 !important;
  border: 3px solid #6f4abf !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 0 #0a0830, inset 0 0 0 1px rgba(255,255,255,0.08);
}
.placed-num.stone {
  background: #1a5a9a !important;
  border: 2px solid #6cf !important;
  color: #fff !important;
  text-shadow: 1px 1px 0 #0a3060 !important;
  box-shadow: 0 2px 0 #052448 !important;
}
.placed-remain {
  font-family: 'VT323', monospace;
  font-size: 13px;
}
.board-stat-val {
  font-family: 'VT323', monospace;
  font-size: 26px;
  text-shadow: 3px 3px 0 #6b4500;
}

/* ---- HP 显示:更大 + 心跳 ---- */
.heart-icon {
  font-size: 22px !important;
  animation: heartBeat 1.4s ease-in-out infinite;
}
@keyframes heartBeat {
  0%, 50%, 100% { transform: scale(1); }
  25%, 75%     { transform: scale(1.18); }
}
.heart-num {
  font-family: 'VT323', monospace !important;
  font-size: 22px !important;
  color: #ffffff !important;
  text-shadow: 2px 2px 0 #8b0a1c, 0 0 6px rgba(255,80,100,0.8) !important;
}

/* ---- 分数 ---- */
.score-big {
  font-family: 'VT323', monospace !important;
  font-size: 24px !important;
  color: #ffe066 !important;
  text-shadow: 2px 2px 0 #6b4500, 0 0 8px rgba(255,224,102,0.7) !important;
}
.score-divider { font-size: 16px !important; }

/* ---- 施法按钮:像素 ---- */
.cast-btn {
  background: #1a5a9a !important;
  border: 2px solid #6cf !important;
  border-radius: 4px !important;
  color: #fff !important;
  font-family: 'VT323', monospace !important;
  font-size: 22px !important;
  text-shadow: 2px 2px 0 #052448, 0 0 4px rgba(108,204,255,0.7) !important;
  box-shadow: 0 3px 0 #052448 !important;
  padding: 6px 0 !important;
}
.cast-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 0 0 #052448 !important;
}
.cast-btn:disabled {
  background: #2a3050 !important;
  border-color: #444a66 !important;
  color: rgba(170,200,255,0.4) !important;
  box-shadow: 0 2px 0 #1a2030 !important;
}
.end-btn {
  background: #b03a8b !important;
  border: 2px solid #ff8fdc !important;
  border-radius: 4px !important;
  color: #fff !important;
  text-shadow: 2px 2px 0 #500a3a !important;
  box-shadow: 0 3px 0 #500a3a !important;
}
.end-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 0 0 #500a3a !important;
}

/* ---- 咒语横幅:像素 + 大 ---- */
.cast-banner {
  font-family: 'VT323', monospace !important;
  font-size: 17px !important;
  border-width: 2px !important;
  border-radius: 6px !important;
}
.cast-banner.success {
  background: #0a3a5a !important;
  border-color: #6cf !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #052448 !important;
}
.cast-banner.fail {
  background: #5a1a28 !important;
  border-color: #ff7090 !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #2a0814 !important;
}
.cast-banner .cast-num {
  font-family: 'VT323', monospace !important;
  font-size: 26px !important;
  color: #ffe066 !important;
  text-shadow: 2px 2px 0 #6b4500, 0 0 8px rgba(255,224,102,1) !important;
  background: #2a1700 !important;
  border: 2px solid #ffd84a !important;
  padding: 0 7px !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 0 #6b4500 !important;
}

/* ---- 全屏法术特效:像素卡通 ---- */
.spell-fx {
  background: radial-gradient(circle, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 70%) !important;
}
.spell-fx-icon {
  font-size: 140px !important;
  animation: pixelBomb 1.4s ease-out !important;
  filter: drop-shadow(0 0 20px rgba(255,224,102,0.9)) drop-shadow(4px 4px 0 #000);
}
.spell-fx-name {
  font-family: 'ZCOOL KuaiLe', sans-serif !important;
  font-size: 36px !important;
  color: #ffe066 !important;
  text-shadow:
    3px 3px 0 #8b3a8b,
    6px 6px 0 #4a1d4a !important;
  -webkit-text-stroke: 1px #4a1d4a !important;
}
@keyframes pixelBomb {
  0%   { opacity: 0; transform: scale(0.2) rotate(-15deg); }
  20%  { opacity: 1; transform: scale(1.4) rotate(5deg); }
  40%  { transform: scale(1.0) rotate(-3deg); }
  60%  { transform: scale(1.15) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ====== 施法者高亮动画:每次成功施法的人卡片金色闪一下 ====== */
.player-card.casting, .me-card.casting {
  background: #4a3a10 !important;
  border-color: #ffe066 !important;
  box-shadow:
    0 0 30px rgba(255,224,102,1),
    0 0 60px rgba(255,150,50,0.7),
    inset 0 0 20px rgba(255,224,102,0.6),
    0 4px 0 #6b4500 !important;
  animation: casterFlash 1.5s ease-out !important;
  z-index: 5;
  position: relative;
}
@keyframes casterFlash {
  0%   { transform: scale(1); filter: brightness(1); }
  15%  { transform: scale(1.08); filter: brightness(2); }
  30%  { transform: scale(1.0); filter: brightness(1.4); }
  60%  { transform: scale(1.04); filter: brightness(1.2); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* ====== 受害者爆炸闪烁:扣血时更明显 ====== */
.player-card.damaged, .me-card.damaged {
  animation: pixelHit 0.7s ease-in-out !important;
  background: #6a1a28 !important;
  border-color: #ff5070 !important;
}
@keyframes pixelHit {
  0%   { transform: translateX(0) scale(1); }
  10%  { transform: translateX(-8px) scale(1.05); filter: brightness(2.5); }
  20%  { transform: translateX(8px) scale(1.05); }
  30%  { transform: translateX(-6px) scale(1.02); filter: brightness(1.8); }
  40%  { transform: translateX(6px) scale(1.02); }
  50%  { transform: translateX(-4px); filter: brightness(1.4); }
  60%  { transform: translateX(4px); }
  100% { transform: translateX(0) scale(1); filter: brightness(1); }
}

/* ====== 扣血飘字升级:更大像素字 ====== */
.float-num {
  font-family: 'VT323', monospace !important;
  font-size: 50px !important;
  text-shadow:
    3px 3px 0 #000,
    0 0 12px currentColor !important;
}

/* ====== 弹层标题用卡通字 ====== */
.modal-title {
  font-family: 'ZCOOL KuaiLe', sans-serif;
  font-size: 22px;
  text-shadow: 2px 2px 0 #0a3060;
}

/* ====== 大厅按钮像素化 ====== */
.btn-primary, .btn-secondary {
  border-radius: 4px !important;
  border-width: 2px !important;
}
.btn-primary {
  background: #1a5a9a !important;
  border-color: #6cf !important;
  text-shadow: 2px 2px 0 #052448 !important;
  box-shadow: 0 4px 0 #052448 !important;
}
.btn-secondary {
  background: #b03a8b !important;
  border-color: #ff8fdc !important;
  text-shadow: 2px 2px 0 #500a3a !important;
  box-shadow: 0 4px 0 #500a3a !important;
}
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 #052448 !important;
}

/* ====== 卡片内"猜数字"徽章:谁出牌谁的卡片右上角弹出 [icon 猜N ✓/✗] ====== */
.cast-badge {
  position: absolute;
  top: -14px;
  right: 6px;
  z-index: 10;
  font-family: 'VT323', monospace;
  font-size: 24px;
  line-height: 1.2;
  padding: 2px 12px;
  border-radius: 4px;
  border: 2px solid;
  pointer-events: none;
  white-space: nowrap;
  animation: badgePop 2s ease-out forwards;
}
.cast-badge.ok {
  background: #2a5a10;
  border-color: #9aff5a;
  color: #eaffd0;
  text-shadow: 2px 2px 0 #143005;
  box-shadow: 0 3px 0 #143005, 0 0 16px rgba(154,255,90,0.8);
}
.cast-badge.fail {
  background: #6a1a1a;
  border-color: #ff7070;
  color: #ffe0e0;
  text-shadow: 2px 2px 0 #300505;
  box-shadow: 0 3px 0 #300505, 0 0 16px rgba(255,112,112,0.8);
}
@keyframes badgePop {
  0%   { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  12%  { opacity: 1; transform: scale(1.3) rotate(3deg); }
  24%  { transform: scale(1) rotate(0); }
  78%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* ====== 加/扣血飘字:居中盖在卡片上,全场谁掉血谁加血一眼看清 ====== */
.float-num {
  left: 50% !important;
  right: auto !important;
  top: -4px !important;
  font-size: 44px !important;
  z-index: 9;
  animation: floatUpPx 1.4s ease-out forwards !important;
}
/* 提亮颜色:深红在红色受击卡上看不清,改亮红/亮绿 + 黑描边 */
.float-num.float-dmg {
  color: #ff5868 !important;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 0 0 14px #ff2040 !important;
}
.float-num.float-heal {
  color: #5aff8a !important;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 0 0 14px #20c050 !important;
}

/* ============================================================
   ====== 回合指引:谁在操作一眼看清 ==========================
   ============================================================ */

/* 当前操作玩家卡片左侧:弹跳的 👉 指针 */
.player-card.active::before, .me-card.my-turn::before {
  content: '👉';
  position: absolute;
  left: -4px;
  top: 50%;
  font-size: 20px;
  z-index: 11;
  animation: pointBounce 0.7s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,216,74,1)) drop-shadow(1px 1px 0 #000);
  pointer-events: none;
}
@keyframes pointBounce {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50%      { transform: translateY(-50%) translateX(5px); }
}
/* 其他玩家操作中:卡片右下角闪烁标记 */
.player-card.active::after {
  content: '⚡操作中';
  position: absolute;
  right: 8px;
  bottom: 3px;
  font-size: 12px;
  color: #ffe066;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(255,224,102,0.8);
  animation: actingBlink 1s steps(2) infinite;
  z-index: 11;
  pointer-events: none;
  font-family: 'ZCOOL KuaiLe', sans-serif;
}
/* 轮到自己:卡片右下角更醒目 */
.me-card.my-turn::after {
  content: '🎯 该你出牌!';
  position: absolute;
  right: 8px;
  bottom: 3px;
  font-size: 14px;
  color: #ffe066;
  text-shadow: 1px 1px 0 #000, 0 0 8px rgba(255,224,102,1);
  animation: actingBlink 0.8s steps(2) infinite;
  z-index: 11;
  pointer-events: none;
  font-family: 'ZCOOL KuaiLe', sans-serif;
}
@keyframes actingBlink {
  0%, 60%  { opacity: 1; }
  61%, 100% { opacity: 0.3; }
}

/* 顶栏"你的回合"也跳动 */
.turn-indicator .turn-mine {
  display: inline-block;
  animation: pointBounce2 0.8s ease-in-out infinite;
}
@keyframes pointBounce2 {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* 回合切换横幅:贴在顶栏下方的细条,不再盖住棋盘中央 */
.turn-banner {
  position: fixed;
  top: 4%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 160;
  pointer-events: none;
  font-family: 'ZCOOL KuaiLe', sans-serif;
  padding: 5px 18px;
  border-radius: 7px;
  border: 2px solid;
  white-space: nowrap;
  animation: turnBannerPop 1.3s ease-out forwards;
}
.turn-banner.mine {
  font-size: 20px;
  color: #ffe066;
  background: #3a2a05;
  border-color: #ffd84a;
  text-shadow: 1px 1px 0 #6b4500, 0 0 12px rgba(255,224,102,1);
  box-shadow: 0 3px 0 #6b4500, 0 0 24px rgba(255,216,74,0.7);
}
.turn-banner.other {
  font-size: 15px;
  color: #bfe8ff;
  background: #0a2a4a;
  border-color: #6cf;
  text-shadow: 1px 1px 0 #052448, 0 0 8px rgba(108,204,255,0.8);
  box-shadow: 0 2px 0 #052448, 0 0 14px rgba(108,204,255,0.4);
}
@keyframes turnBannerPop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(-6px); }
  16%  { opacity: 1; transform: translateX(-50%) scale(1.08); }
  28%  { transform: translateX(-50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.95); }
}

/* ============================================================
   ====== 绚丽特效:弹道 / 爆裂粒子 / 彩带 / 流星 =============
   ============================================================ */

/* 法术弹道:法术 icon 从施法者卡片飞向受害者卡片 */
.projectile {
  position: fixed;
  z-index: 95;
  font-size: 28px;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255,224,102,0.9)) drop-shadow(2px 2px 0 #000);
}

/* 命中爆裂粒子(JS 用 Web Animations API 驱动飞散) */
.burst-particle {
  position: fixed;
  z-index: 96;
  font-size: 17px;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255,200,80,0.8));
}

/* 终局彩带 */
.confetti {
  position: fixed;
  width: 9px;
  height: 14px;
  z-index: 210;
  pointer-events: none;
  border-radius: 2px;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

/* 背景流星:大部分时间隐身,周期性划过 */
.shooting-star {
  position: fixed;
  width: 90px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #ffffff);
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}
.shooting-star.ss-a { top: 12%; left: 72%; animation: shootStar 9s linear infinite 2s; }
.shooting-star.ss-b { top: 52%; left: 88%; animation: shootStar 13s linear infinite 7s; }
@keyframes shootStar {
  0%, 86% { opacity: 0; transform: translate(0, 0) rotate(-35deg); }
  88%     { opacity: 1; }
  100%    { opacity: 0; transform: translate(-46vw, 32vw) rotate(-35deg); }
}

/* 牌堆数字变化时弹一下 */
.stat-pop {
  animation: statPop 0.5s ease-out;
  display: inline-block;
}
@keyframes statPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.7); color: #fff; }
  100% { transform: scale(1); }
}
@keyframes floatUpPx {
  0%   { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.5); }
  18%  { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1.35); }
  35%  { transform: translateX(-50%) translateY(-4px) scale(1.05); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-46px) scale(1); }
}

/* ====== 回血绿闪(像素版,和扣血红闪对应) ====== */
.player-card.healed, .me-card.healed {
  background: #1a4a28 !important;
  border-color: #5aff8a !important;
  animation: pixelHeal 0.9s ease-out !important;
}
@keyframes pixelHeal {
  0%   { filter: brightness(2.2); transform: scale(1.06); }
  40%  { filter: brightness(1.5); transform: scale(1.02); }
  100% { filter: brightness(1);   transform: scale(1); }
}

/* ============================================================
   ====== 增强背景:星云 / 密集星海 / 漂浮星球 ===============
   ============================================================ */

/* 两团缓慢漂移的星云,营造深空纵深 */
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.28;
  pointer-events: none;
}
.nebula.nebula1 {
  width: 65vw; height: 65vw;
  top: -12vh; left: -16vw;
  background: radial-gradient(circle, rgba(150,50,220,0.7), transparent 70%);
  animation: nebDrift 46s ease-in-out infinite alternate;
}
.nebula.nebula2 {
  width: 55vw; height: 55vw;
  bottom: -14vh; right: -12vw;
  background: radial-gradient(circle, rgba(40,130,255,0.6), transparent 70%);
  animation: nebDrift 60s ease-in-out infinite alternate-reverse;
}
.nebula.nebula3 {
  width: 40vw; height: 40vw;
  top: 38%; left: 30%;
  background: radial-gradient(circle, rgba(255,80,180,0.4), transparent 70%);
  animation: nebDrift 38s ease-in-out infinite alternate;
}
@keyframes nebDrift {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(7vw, 6vh) scale(1.25); }
}

/* JS 生成的密集星点(约 70 颗,三档大小 + 随机闪烁) */
.gen-star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255,255,255,0.8);
  animation: genTwinkle ease-in-out infinite;
}
@keyframes genTwinkle {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 1; }
}

/* 漂浮星球:在原地小幅浮动 + 自转,幅度小于格子留白,保证不与邻居重叠 */
.drift-planet {
  position: absolute;
  opacity: 0.6;
  filter: drop-shadow(0 0 12px rgba(150,180,255,0.55));
  pointer-events: none;
  animation: planetBob ease-in-out infinite;
}
@keyframes planetBob {
  0%, 100% { transform: translate(0,0) rotate(0deg); }
  50%      { transform: translate(10px, -9px) rotate(16deg); }
}

/* 黑洞:黑色核心 + 旋转的彩色吸积盘(纯 CSS) */
.black-hole {
  position: absolute;
  width: 66px; height: 66px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: blackHoleBob 9s ease-in-out infinite;
}
.black-hole .bh-disk {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ff8a00, #ffe066, #8a2be2, #00d4ff, #ff3a8a, #ff8a00);
  -webkit-mask: radial-gradient(circle, transparent 28%, #000 34%, #000 50%, transparent 57%);
  mask: radial-gradient(circle, transparent 28%, #000 34%, #000 50%, transparent 57%);
  animation: bhSpin 3.5s linear infinite;
  opacity: 0.85;
}
.black-hole .bh-core {
  position: absolute; inset: 30%;
  background: #050008;
  border-radius: 50%;
  box-shadow: 0 0 16px 3px rgba(140,50,220,0.85), inset 0 0 10px rgba(0,0,0,1);
}
@keyframes bhSpin { to { transform: rotate(360deg); } }
@keyframes blackHoleBob {
  0%, 100% { transform: translate(-50%, -50%); }
  50%      { transform: translate(calc(-50% + 9px), calc(-50% - 8px)); }
}

/* 宏大的远方星系:巨大旋转螺旋,放在角落营造纵深 */
.galaxy-grand {
  position: absolute;
  width: 260px; height: 260px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.5;
  filter: blur(3px);
  background:
    radial-gradient(circle, rgba(255,245,210,0.95) 0%, rgba(210,150,255,0.45) 18%, rgba(120,80,200,0.2) 40%, transparent 62%),
    conic-gradient(from 0deg, transparent 0deg, rgba(120,180,255,0.35) 40deg, transparent 110deg, rgba(255,150,220,0.35) 180deg, transparent 250deg, rgba(150,220,255,0.3) 310deg, transparent 360deg);
  animation: galaxySpin 70s linear infinite;
  z-index: 0;
}
@keyframes galaxySpin { to { transform: rotate(360deg); } }

/* ====== 背景太空对战:激光 + 爆炸(持续,低调,在最底层)====== */
.battle-laser {
  position: absolute;
  height: 3px;
  border-radius: 2px;
  transform-origin: left center;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  animation: laserFlash 0.9s ease-out forwards;
}
@keyframes laserFlash {
  0%   { opacity: 0; transform: rotate(var(--ang)) scaleX(0); }
  22%  { opacity: 1; transform: rotate(var(--ang)) scaleX(1); }
  70%  { opacity: 0.9; }
  100% { opacity: 0; transform: rotate(var(--ang)) scaleX(1); }
}
.battle-boom {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  animation: battleBoom 1.1s ease-out forwards;
}
@keyframes battleBoom {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0.2); }
  30%  { opacity: 1; transform: translate(-50%,-50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(0.7); }
}

/* ============================================================
   ====== 史诗法术全屏特效(1 古龙 / 2 幽灵 / 3 梦境)========
   ============================================================ */
.epic-fx {
  position: fixed;
  inset: 0;
  z-index: 185;
  pointer-events: none;
  overflow: hidden;
}
.epic-particle {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255,200,80,0.7));
}
.epic-title {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'ZCOOL KuaiLe', sans-serif;
  font-size: 48px;
  white-space: nowrap;
  animation: epicTitlePop 2.2s ease-out forwards;
}
@keyframes epicTitlePop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.3) rotate(-6deg); }
  14%  { opacity: 1; transform: translateX(-50%) scale(1.3) rotate(3deg); }
  26%  { transform: translateX(-50%) scale(1) rotate(0); }
  78%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.1); }
}

/* —— 1 号 古代巨龙:红色烈焰 + 巨龙横扫 + 震屏 —— */
.epic-1 .epic-flash {
  position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(255,90,30,0.65), rgba(130,0,0,0.9) 80%);
  animation: epicFlashRed 2.1s ease-out forwards;
}
@keyframes epicFlashRed {
  0% { opacity: 0; } 12% { opacity: 1; } 45% { opacity: 0.45; } 100% { opacity: 0; }
}
.epic-1 .epic-dragon {
  position: absolute;
  top: 28%;
  font-size: 170px;
  filter: drop-shadow(0 0 36px rgba(255,130,40,1));
  animation: dragonSweep 2.1s cubic-bezier(.35,0,.3,1) forwards;
}
@keyframes dragonSweep {
  0%   { left: -42vw; transform: scaleX(-1) scale(0.6) rotate(-10deg); opacity: 0; }
  18%  { opacity: 1; }
  50%  { transform: scaleX(-1) scale(1.7) rotate(6deg); }
  100% { left: 122vw; transform: scaleX(-1) scale(0.9) rotate(-6deg); opacity: 0.7; }
}
.epic-title-1 {
  color: #ffcf40;
  text-shadow: 3px 3px 0 #8b2000, 6px 6px 0 #4a0d00, 0 0 24px rgba(255,120,30,1);
  -webkit-text-stroke: 1px #5a1500;
}

/* —— 2 号 黑暗幽灵:暗紫吞噬 + 幽灵升腾 —— */
.epic-2 .epic-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(circle, transparent 18%, rgba(40,0,70,0.85) 75%, rgba(15,0,30,0.96));
  animation: epicVignette 2.1s ease-out forwards;
}
@keyframes epicVignette {
  0% { opacity: 0; } 18% { opacity: 1; } 70% { opacity: 0.9; } 100% { opacity: 0; }
}
.epic-title-2 {
  color: #d89bff;
  text-shadow: 3px 3px 0 #2a0050, 0 0 22px rgba(200,120,255,1);
  -webkit-text-stroke: 1px #1a0030;
  animation: epicTitlePop 2.2s ease-out forwards, ghostWobble 1.2s ease-in-out infinite;
}
@keyframes ghostWobble {
  0%, 100% { letter-spacing: 0; }
  50%      { letter-spacing: 4px; }
}

/* —— 3 号 甜美梦境:粉青柔光 + 明月 + 星尘 —— */
.epic-3 .epic-dream {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,150,210,0.5), rgba(120,200,255,0.45) 60%, rgba(180,140,255,0.4));
  animation: epicDream 2.1s ease-out forwards;
}
@keyframes epicDream {
  0% { opacity: 0; } 20% { opacity: 1; } 70% { opacity: 0.8; } 100% { opacity: 0; }
}
.epic-3 .epic-moon {
  position: absolute;
  top: 14%;
  left: 50%;
  font-size: 130px;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 40px rgba(255,240,180,1));
  animation: moonRise 2.1s ease-out forwards;
}
@keyframes moonRise {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.3) rotate(-30deg); }
  30%  { opacity: 1; transform: translateX(-50%) scale(1.2) rotate(8deg); }
  60%  { transform: translateX(-50%) scale(1) rotate(0); }
  100% { opacity: 0.85; transform: translateX(-50%) scale(1.05) rotate(-4deg); }
}
.epic-title-3 {
  top: 52%;
  color: #fff0a8;
  text-shadow: 3px 3px 0 #b0508b, 0 0 22px rgba(255,200,230,1);
  -webkit-text-stroke: 1px #80406a;
}

/* —— 震屏:只抖游戏区,横幅/弹层不受影响 —— */
#page-game.shake { animation: screenShake 0.45s ease-in-out 2; }
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-7px, 5px); }
  40%      { transform: translate(7px, -5px); }
  60%      { transform: translate(-6px, -4px); }
  80%      { transform: translate(6px, 4px); }
}

/* ============================================================
   ====== 性能优化:GPU 合成 / 隐藏时暂停 / 降级 =============
   ============================================================ */

/* 把持续运动的背景层提升为独立 GPU 合成层,blur 纹理被缓存后只做廉价的
   位移/旋转合成,不会每帧重算模糊 —— 显著降低低端机卡顿 */
.nebula, .galaxy-grand, .black-hole, .drift-planet, .bg-ship, .shooting-star {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}
/* 星云不再做 scale(改纯位移),避免缩放触发模糊纹理重算 */
@keyframes nebDrift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(7vw, 6vh); }
}

/* 标签页切到后台 / 被遮挡时,冻结所有背景动画,省电省 CPU */
body.bg-frozen .nebula,
body.bg-frozen .galaxy-grand,
body.bg-frozen .black-hole,
body.bg-frozen .black-hole .bh-disk,
body.bg-frozen .drift-planet,
body.bg-frozen .bg-ship,
body.bg-frozen .shooting-star,
body.bg-frozen .gen-star {
  animation-play-state: paused !important;
}

/* 系统开启"减弱动态效果"时,关掉所有氛围循环动画(保留必要的对战反馈),
   照顾低端设备 / 晕动症用户 */
@media (prefers-reduced-motion: reduce) {
  .nebula, .galaxy-grand, .black-hole, .black-hole .bh-disk,
  .drift-planet, .bg-ship, .shooting-star, .gen-star,
  .game-title, .author-name {
    animation: none !important;
  }
  .gen-star { opacity: 0.6 !important; }
}

/* ============================================================
   ====== 轻量技能小窗(点数字弹出,不遮挡整屏)=============
   ============================================================ */
.spell-tip-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;   /* 高于法术特效 180/185,玩家看说明时不被特效盖住;仍低于彩带 210 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 8, 0.32);   /* 很浅的遮罩,棋盘仍透出 */
  animation: tipFade 0.16s ease-out;
}
.spell-tip-card {
  width: 100%;
  max-width: 280px;
  background: linear-gradient(180deg, #14254a, #0a1430);
  border: 2px solid #6cf;
  border-radius: 10px;
  padding: 16px 18px 14px;
  text-align: center;
  box-shadow: 0 6px 0 #052448, 0 0 26px rgba(0, 200, 255, 0.45);
  animation: tipPop 0.22s cubic-bezier(.3,1.5,.5,1);
}
.spell-tip-icon {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255, 224, 102, 0.7));
}
.spell-tip-name {
  font-family: 'ZCOOL KuaiLe', sans-serif;
  font-size: 19px;
  color: #ffe066;
  margin: 8px 0;
  text-shadow: 0 0 8px rgba(255, 224, 102, 0.6);
}
.spell-tip-effect {
  font-size: 14px;
  color: #dbe7f5;
  line-height: 1.55;
}
.spell-tip-note {
  font-size: 12px;
  color: #9ad0ff;
  margin-top: 8px;
  line-height: 1.5;
}
.spell-tip-hint {
  font-size: 11px;
  color: rgba(170, 200, 255, 0.55);
  margin-top: 12px;
}
@keyframes tipFade { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes tipPop {
  0%   { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}

/* 可点的数字:加手型 + 轻微提示可点 */
.placed-num.stone { cursor: pointer; }
.placed-num.stone:active { transform: scale(0.9); }
.player-card .stone-face.mini { cursor: pointer; }

/* 音效开关:右下角小圆钮,在备案栏之上 */
.mute-btn {
  position: fixed;
  right: 10px;
  bottom: 36px;
  z-index: 65;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(0,200,255,0.5);
  background: rgba(8,15,40,0.85);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0,200,255,0.3);
}
.mute-btn:active { transform: scale(0.9); }
.mute-btn.muted { opacity: 0.55; border-color: rgba(170,170,170,0.5); }

/* ============================================================
   ====== 2026 Arcane Arena upgrade ==========================
   ============================================================ */
:root {
  --arena-ink: #050916;
  --arena-abyss: #0b1430;
  --arena-panel: #111b35;
  --arena-panel-2: #182441;
  --arena-line: rgba(111, 145, 190, 0.38);
  --arena-cyan: #4fd8e8;
  --arena-cyan-soft: rgba(79, 216, 232, 0.18);
  --arena-gold: #e6b95c;
  --arena-gold-soft: rgba(230, 185, 92, 0.2);
  --arena-violet: #7e5bef;
  --arena-red: #ff5d7a;
  --arena-green: #67e08f;
  --arena-text: #edf5ff;
  --arena-muted: #94a8c7;
}

body {
  background:
    linear-gradient(180deg, #030712 0%, #08142c 44%, #050916 100%) !important;
  color: var(--arena-text) !important;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif !important;
  image-rendering: auto !important;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(79,216,232,0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(230,185,92,0.04) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 80%, transparent 100%);
}

.bg-stars {
  background:
    radial-gradient(ellipse at 50% 28%, rgba(79,216,232,0.12), transparent 46%),
    linear-gradient(180deg, rgba(126,91,239,0.16), transparent 38%) !important;
  opacity: 0.95;
}

.bg-stars::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 40%;
  width: min(94vw, 680px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 12deg, rgba(230,185,92,0.18) 0deg 2deg, transparent 2deg 10deg),
    repeating-radial-gradient(circle, transparent 0 17%, rgba(79,216,232,0.14) 17.5% 18%, transparent 18.5% 30%),
    radial-gradient(circle, transparent 0 52%, rgba(230,185,92,0.22) 52.5% 53.5%, transparent 54%);
  -webkit-mask: radial-gradient(circle, transparent 0 18%, #000 20% 64%, transparent 68%);
  mask: radial-gradient(circle, transparent 0 18%, #000 20% 64%, transparent 68%);
  opacity: 0.7;
  animation: galaxySpin 120s linear infinite;
}

.bg-ship,
.battle-laser,
.battle-boom {
  display: none !important;
}

.drift-planet,
.black-hole,
.galaxy-grand,
.shooting-star {
  opacity: 0.14 !important;
  filter: saturate(0.35) blur(0.2px) !important;
}

#app {
  max-width: 620px;
  padding: 8px 0 76px;
}

.page {
  padding: 0 16px;
}

#page-game.page {
  padding: 0 8px;
}

.game-title {
  margin: 36px auto 14px !important;
  color: var(--arena-gold) !important;
  font-family: 'ZCOOL KuaiLe', -apple-system, "PingFang SC", sans-serif !important;
  font-size: clamp(34px, 10vw, 48px) !important;
  letter-spacing: 4px !important;
  -webkit-text-stroke: 0 !important;
  text-shadow:
    0 2px 0 #4c3511,
    0 0 26px rgba(230,185,92,0.52),
    0 0 52px rgba(79,216,232,0.18) !important;
  animation: none !important;
}

.game-title::after {
  content: '';
  display: block;
  width: min(230px, 62vw);
  height: 2px;
  margin: 13px auto 0;
  background: linear-gradient(90deg, transparent, var(--arena-cyan), var(--arena-gold), transparent);
  box-shadow: 0 0 18px rgba(79,216,232,0.55);
}

.author-credit {
  margin-bottom: 26px;
}

.author-name {
  color: var(--arena-cyan) !important;
  text-shadow: 0 0 16px rgba(79,216,232,0.48) !important;
  animation: none !important;
}

.copyright-hint,
.room-hint,
.lobby-nickname,
.room-code-label,
.player-list-title,
.wt-label {
  color: var(--arena-muted) !important;
}

.btn,
.btn-primary,
.btn-secondary {
  min-height: 48px;
  border-radius: 8px !important;
  letter-spacing: 1px !important;
}

.btn-primary {
  background: linear-gradient(180deg, #1d6574, #0f3446) !important;
  border-color: rgba(79,216,232,0.8) !important;
  color: #f2fdff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.7) !important;
  box-shadow: 0 4px 0 #061b25, 0 0 22px rgba(79,216,232,0.22) !important;
}

.btn-secondary {
  background: linear-gradient(180deg, #5d3ab7, #271a58) !important;
  border-color: rgba(126,91,239,0.88) !important;
  color: #f4efff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.7) !important;
  box-shadow: 0 4px 0 #140c30, 0 0 22px rgba(126,91,239,0.24) !important;
}

.btn-text {
  color: #b6c8e4 !important;
}

.room-header,
.player-list,
.bot-add-row,
.win-target-row,
.board,
.player-card,
.me-card,
.modal {
  backdrop-filter: blur(16px);
}

.room-code {
  color: var(--arena-gold) !important;
  font-size: clamp(72px, 20vw, 104px) !important;
  letter-spacing: 8px !important;
  text-shadow:
    0 3px 0 #5a3a0d,
    0 0 22px rgba(230,185,92,0.65) !important;
}

.player-row,
.bot-add-row,
.win-target-row {
  background: linear-gradient(180deg, rgba(17,27,53,0.82), rgba(8,15,32,0.9)) !important;
  border: 1px solid var(--arena-line) !important;
  border-radius: 8px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 12px 30px rgba(0,0,0,0.22) !important;
}

.player-avatar {
  background: linear-gradient(135deg, #2e6f82, #5837a6) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 0 16px rgba(79,216,232,0.18) !important;
}

.player-tag {
  border-radius: 999px;
}

.game-top-bar {
  position: sticky;
  top: 0;
  z-index: 55;
  margin: 0 -8px 8px;
  padding: 8px 10px;
  background: rgba(5,9,22,0.82) !important;
  border-bottom: 1px solid rgba(230,185,92,0.28) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.26);
  backdrop-filter: blur(18px);
}

.room-code-small,
.turn-indicator,
.help-btn,
.exit-btn {
  font-size: 12px;
}

.room-code-small {
  color: var(--arena-muted) !important;
}

.turn-indicator .turn-mine {
  color: var(--arena-gold) !important;
  text-shadow: 0 0 13px rgba(230,185,92,0.62) !important;
}

.turn-indicator .turn-other {
  color: #a9bcdb !important;
}

.help-btn,
.exit-btn {
  border-radius: 999px !important;
  padding: 5px 10px !important;
}

.help-btn {
  background: rgba(79,216,232,0.1) !important;
  border-color: rgba(79,216,232,0.44) !important;
  color: #bff8ff !important;
}

.exit-btn {
  background: rgba(255,93,122,0.12) !important;
  border-color: rgba(255,93,122,0.46) !important;
  color: #ffc0cb !important;
}

.board {
  position: relative;
  overflow: hidden;
  margin: 8px 4px 10px !important;
  padding: 11px 12px 12px !important;
  background:
    linear-gradient(180deg, rgba(17,27,53,0.9), rgba(7,13,28,0.94)) !important;
  border: 1px solid rgba(230,185,92,0.34) !important;
  border-radius: 12px !important;
  box-shadow:
    0 14px 42px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 0 42px rgba(79,216,232,0.06) !important;
}

.board::before {
  content: '';
  position: absolute;
  inset: -46% 8% auto;
  height: 180px;
  border: 1px solid rgba(230,185,92,0.18);
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(79,216,232,0.13);
  pointer-events: none;
}

.board > * {
  position: relative;
  z-index: 1;
}

.board-label {
  color: #b9c8e2 !important;
  font-size: 12px !important;
}

.secret-row {
  min-height: 38px;
}

.board-row {
  justify-content: space-between;
  padding: 7px 0 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.board-stat {
  color: var(--arena-muted) !important;
}

.board-stat-val {
  color: var(--arena-gold) !important;
  text-shadow: 0 0 14px rgba(230,185,92,0.48) !important;
}

.placed-grid {
  gap: 6px !important;
  padding-top: 8px !important;
}

.placed-num.stone {
  width: 30px !important;
  height: 32px !important;
  background: linear-gradient(180deg, #194963, #0c2539) !important;
  border: 1px solid rgba(79,216,232,0.86) !important;
  color: #f2fdff !important;
  border-radius: 7px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 0 14px rgba(79,216,232,0.22) !important;
}

.placed-dots {
  height: 42px;
}

.placed-dot {
  width: 18px;
  background: rgba(120,141,170,0.25);
}

.placed-dot.used {
  background: linear-gradient(180deg, var(--arena-gold), #9d6a1f);
}

.placed-remain {
  color: #cfdaf0 !important;
  font-family: 'VT323', Menlo, monospace !important;
}

.placed-remain.zero {
  color: var(--arena-red) !important;
}

.player-card,
.me-card {
  margin: 7px 4px !important;
  padding: 9px 11px !important;
  background: linear-gradient(180deg, rgba(17,27,53,0.9), rgba(9,15,33,0.95)) !important;
  border: 1px solid var(--arena-line) !important;
  border-radius: 12px !important;
  box-shadow:
    0 10px 26px rgba(0,0,0,0.26),
    inset 0 1px 0 rgba(255,255,255,0.07) !important;
}

.player-card.active,
.me-card.my-turn {
  background: linear-gradient(180deg, rgba(55,39,13,0.92), rgba(19,20,31,0.95)) !important;
  border-color: rgba(230,185,92,0.86) !important;
  box-shadow:
    0 10px 30px rgba(0,0,0,0.3),
    0 0 0 1px rgba(230,185,92,0.2),
    0 0 30px rgba(230,185,92,0.26) !important;
  animation: activePulse 1.5s ease-in-out infinite !important;
}

.player-card.active::before,
.me-card.my-turn::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  width: 5px;
  height: 42%;
  border-radius: 999px;
  background: var(--arena-gold);
  filter: drop-shadow(0 0 10px rgba(230,185,92,0.8));
  animation: none;
  transform: translateY(-50%);
  pointer-events: none;
}

.player-card.active::after,
.me-card.my-turn::after {
  right: 10px;
  bottom: 6px;
  color: var(--arena-gold);
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  text-shadow: 0 0 8px rgba(230,185,92,0.7);
}

.player-header {
  gap: 8px;
  margin-bottom: 7px;
}

.player-header .player-name {
  color: #f3f7ff !important;
  text-shadow: none !important;
}

.heart-icon {
  color: var(--arena-red) !important;
  animation: none !important;
}

.heart-num {
  color: #ffd3dc !important;
  text-shadow: 0 0 10px rgba(255,93,122,0.35) !important;
}

.score-big {
  color: var(--arena-gold) !important;
  text-shadow: 0 0 14px rgba(230,185,92,0.46) !important;
}

.owl-num-mine {
  background: rgba(230,185,92,0.16) !important;
  border-color: rgba(230,185,92,0.6) !important;
  color: #fff0c2 !important;
  border-radius: 999px !important;
}

.stone-face,
.stone-back {
  border-radius: 8px !important;
  font-family: 'VT323', Menlo, monospace !important;
}

.stone-face {
  background: linear-gradient(180deg, #205f75, #0e2b3d) !important;
  border: 1px solid rgba(79,216,232,0.86) !important;
  color: #f6fdff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.65), 0 0 10px rgba(79,216,232,0.38) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 5px 13px rgba(0,0,0,0.22) !important;
}

.stone-back {
  background:
    linear-gradient(135deg, rgba(230,185,92,0.18) 0 10%, transparent 10% 20%, rgba(126,91,239,0.18) 20% 30%, transparent 30%),
    linear-gradient(180deg, #241848, #0f1430) !important;
  border: 1px solid rgba(230,185,92,0.76) !important;
  color: #ffe9a6 !important;
  text-shadow: 0 0 10px rgba(230,185,92,0.42) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 5px 13px rgba(0,0,0,0.22) !important;
}

.mine-unknown {
  position: relative;
  background:
    linear-gradient(180deg, #231a37, #0b1024) !important;
  border-color: rgba(230,185,92,0.72) !important;
  color: transparent !important;
}

.mine-unknown::before {
  content: '?';
  color: #ffe3a1;
  font-size: 25px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(230,185,92,0.65);
}

.dead-banner {
  background: rgba(255,93,122,0.12) !important;
  border-color: rgba(255,93,122,0.55) !important;
  color: #ffd0d8 !important;
}

.action-bar {
  bottom: 42px;
  margin: 0 4px;
  padding: 10px 10px 11px !important;
  background:
    linear-gradient(180deg, rgba(17,27,53,0.96), rgba(5,9,22,0.98)) !important;
  border: 1px solid rgba(79,216,232,0.34) !important;
  border-radius: 14px 14px 0 0 !important;
  box-shadow:
    0 -12px 34px rgba(0,0,0,0.42),
    inset 0 1px 0 rgba(255,255,255,0.08) !important;
  backdrop-filter: blur(18px);
}

.action-bar.busy {
  opacity: 0.82;
}

.action-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.action-eyebrow {
  color: var(--arena-cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.action-title {
  color: var(--arena-text);
  font-size: 15px;
  font-weight: 800;
  margin-top: 1px;
}

.floor-hint {
  flex: 0 0 auto;
  min-width: 54px;
  padding: 5px 9px;
  margin: 0 !important;
  border-radius: 999px;
  background: rgba(230,185,92,0.14);
  border: 1px solid rgba(230,185,92,0.48);
  color: #ffe7ae !important;
  font-size: 12px !important;
  font-weight: 800;
}

.spell-advisor {
  display: grid;
  gap: 4px;
  margin-bottom: 9px;
}

.spell-advisor span {
  display: block;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(79,216,232,0.08);
  color: #cfe6f2;
  border: 1px solid rgba(79,216,232,0.14);
  font-size: 12px;
  line-height: 1.35;
}

.cast-row {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px !important;
  margin-bottom: 8px !important;
}

.cast-btn {
  min-width: 0;
  min-height: 74px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 3px;
  row-gap: 0;
  padding: 7px 5px 6px !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #1c6074, #102c42) !important;
  border: 1px solid rgba(79,216,232,0.8) !important;
  color: #f6fdff !important;
  text-shadow: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 4px 0 #071826, 0 0 18px rgba(79,216,232,0.16) !important;
}

.cast-btn:active:not(:disabled) {
  transform: translateY(3px) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 1px 0 #071826 !important;
}

.cast-num-big {
  grid-row: 1 / 4;
  font-family: 'VT323', Menlo, monospace;
  font-size: 35px;
  line-height: 0.9;
  color: #fff;
}

.cast-icon {
  font-size: 19px;
  line-height: 1;
}

.cast-name {
  color: #eafcff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cast-status {
  color: #a8d8e4;
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cast-btn.high-risk {
  background: linear-gradient(180deg, #665118, #2f240a) !important;
  border-color: rgba(230,185,92,0.82) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.13), 0 4px 0 #211805, 0 0 18px rgba(230,185,92,0.16) !important;
}

.cast-btn.good-odds {
  background: linear-gradient(180deg, #236d54, #12372d) !important;
  border-color: rgba(103,224,143,0.84) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.13), 0 4px 0 #082117, 0 0 18px rgba(103,224,143,0.18) !important;
}

.cast-btn.known-exhausted {
  background: linear-gradient(180deg, #652234, #2b101c) !important;
  border-color: rgba(255,93,122,0.82) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 4px 0 #190711, 0 0 18px rgba(255,93,122,0.16) !important;
}

.cast-btn.dragon-risk:not(.known-exhausted):not(.floor-locked) {
  border-color: rgba(255,124,86,0.88) !important;
}

.cast-btn.floor-locked,
.cast-btn:disabled {
  background: linear-gradient(180deg, #22283a, #111624) !important;
  border-color: rgba(148,168,199,0.22) !important;
  color: rgba(200,214,235,0.45) !important;
  opacity: 0.64 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 3px 0 #080c15 !important;
}

.cast-btn.floor-locked .cast-status,
.cast-btn:disabled .cast-status {
  color: rgba(200,214,235,0.42);
}

.end-btn {
  min-height: 42px;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #6842be, #28175e) !important;
  border: 1px solid rgba(126,91,239,0.82) !important;
  color: #fff !important;
  text-shadow: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 4px 0 #140b34 !important;
}

.end-btn:disabled {
  background: linear-gradient(180deg, #22283a, #111624) !important;
  border-color: rgba(148,168,199,0.22) !important;
  color: rgba(200,214,235,0.48) !important;
}

.modal {
  background: linear-gradient(180deg, rgba(17,27,53,0.98), rgba(5,9,22,0.98)) !important;
  border: 1px solid rgba(79,216,232,0.48) !important;
  border-radius: 14px !important;
  box-shadow: 0 24px 90px rgba(0,0,0,0.55), 0 0 30px rgba(79,216,232,0.18) !important;
}

.modal-title,
.game-over-title {
  color: var(--arena-gold) !important;
  text-shadow: 0 0 18px rgba(230,185,92,0.42) !important;
}

.modal-content,
.modal-sub,
.score-row,
.sr-name {
  color: #dce7f8 !important;
}

.modal-input {
  background: rgba(5,9,22,0.72) !important;
  border-color: rgba(79,216,232,0.52) !important;
  color: #f3fcff !important;
  border-radius: 9px !important;
}

.toast,
.cast-banner {
  border-radius: 10px !important;
  backdrop-filter: blur(14px);
}

.toast {
  background: rgba(5,9,22,0.9) !important;
  border-color: rgba(79,216,232,0.46) !important;
  box-shadow: 0 14px 40px rgba(0,0,0,0.38);
}

#page-game:not([hidden]) ~ .toast {
  top: 72px;
  bottom: auto;
}

.cast-banner.success {
  background: rgba(8,50,62,0.88) !important;
  border-color: rgba(79,216,232,0.68) !important;
}

.cast-banner.fail {
  background: rgba(78,20,34,0.9) !important;
  border-color: rgba(255,93,122,0.7) !important;
}

.cast-badge {
  border-radius: 999px;
  font-family: 'VT323', Menlo, monospace;
}

.site-footer {
  background: rgba(5,9,22,0.96) !important;
  border-color: rgba(230,185,92,0.28) !important;
}

.debug-bar {
  color: rgba(170,205,230,0.7) !important;
  background: rgba(2,5,12,0.62) !important;
}

.mute-btn {
  background: rgba(5,9,22,0.9) !important;
  border-color: rgba(79,216,232,0.38) !important;
}

@media (min-width: 520px) {
  .cast-row {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .cast-btn {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    justify-items: center;
    min-height: 82px;
  }

  .cast-num-big {
    grid-row: auto;
    font-size: 33px;
  }

  .cast-icon { font-size: 18px; }
}

@media (max-width: 380px) {
  #app { padding-bottom: 82px; }
  .game-top-bar { gap: 6px; }
  .help-btn, .exit-btn { padding: 4px 7px !important; }
  .board { padding-left: 8px !important; padding-right: 8px !important; }
  .placed-grid { gap: 3px !important; }
  .placed-num.stone { width: 25px !important; height: 29px !important; }
  .cast-btn { min-height: 68px; padding: 6px 4px !important; }
  .cast-num-big { font-size: 30px; }
  .cast-name { font-size: 10px; }
  .cast-status { font-size: 8px; }
}

/* ====== 2026 no-scroll battle cockpit ======
   对局页变成固定视口 HUD:顶栏/盘面/玩家/自己/操作都纳入同一个高度预算。 */
body.game-mode {
  --battle-bottom-strip: 32px;
  --battle-gap: 5px;
  height: 100dvh;
  overflow: hidden;
}

body.game-mode #app {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: 0 0 var(--battle-bottom-strip);
}

body.game-mode #page-game.page {
  height: calc(100dvh - var(--battle-bottom-strip));
  max-height: calc(100dvh - var(--battle-bottom-strip));
  display: flex;
  flex-direction: column;
  gap: var(--battle-gap);
  padding: env(safe-area-inset-top, 0px) 8px 5px;
  overflow: hidden;
}

body.game-mode .game-top-bar {
  position: relative;
  top: auto;
  flex: 0 0 auto;
  min-height: 36px;
  margin: 0 -8px !important;
  padding: 5px 8px !important;
  gap: 7px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

body.game-mode .room-code-small,
body.game-mode .turn-indicator,
body.game-mode .help-btn,
body.game-mode .exit-btn {
  font-size: 11px;
}

body.game-mode .turn-indicator {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.game-mode .help-btn,
body.game-mode .exit-btn {
  min-height: 0;
  padding: 4px 7px !important;
  white-space: nowrap;
}

body.game-mode .board {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  margin: 0 !important;
  padding: 6px 8px 7px !important;
  border-radius: 10px !important;
}

body.game-mode .board-secrets {
  min-width: 0;
}

body.game-mode .board-label {
  display: block;
  font-size: 10px !important;
  line-height: 1;
  margin-bottom: 3px;
}

body.game-mode .secret-row {
  min-height: 24px;
  margin-top: 0;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

body.game-mode .secret-empty {
  padding: 3px 0;
  font-size: 10px;
}

body.game-mode .stone.small {
  width: 28px !important;
  height: 24px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}

body.game-mode .board-row {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 2px;
  margin: 0 !important;
  padding: 0 0 0 8px !important;
  border: 0;
  border-left: 1px solid rgba(255,255,255,0.08);
}

body.game-mode .board-stat {
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}

body.game-mode .board-stat-val {
  font-size: 16px;
  margin-left: 2px;
}

body.game-mode .placed-grid {
  grid-column: 1 / -1;
  gap: 3px !important;
  padding: 3px 0 0 !important;
}

body.game-mode .placed-num.stone {
  width: 23px !important;
  height: 23px !important;
  margin-bottom: 1px;
  border-radius: 6px !important;
  font-size: 13px !important;
}

body.game-mode .placed-dots {
  width: 26px;
  height: 15px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: start;
  gap: 1px;
}

body.game-mode .placed-dot {
  width: 100%;
  height: 3px;
  border-radius: 1px;
}

body.game-mode .placed-remain {
  margin-top: 1px;
  font-size: 9px;
  line-height: 1;
}

body.game-mode .pick-hint {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1.2;
}

body.game-mode #other-players {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 4px;
  align-content: start;
  overflow: hidden;
}

body.game-mode #other-players:empty {
  display: none;
}

body.game-mode .player-card,
body.game-mode .me-card {
  min-height: 0;
  margin: 0 !important;
  padding: 5px 8px !important;
  border-radius: 9px !important;
}

body.game-mode .player-card,
body.game-mode .me-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 7px;
}

body.game-mode .player-header {
  min-width: 0;
  gap: 5px;
  margin: 0 !important;
}

body.game-mode .player-header .player-name {
  max-width: none;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 12px;
}

body.game-mode .bot-tag {
  font-size: 10px;
}

body.game-mode .hp-bar {
  gap: 0;
}

body.game-mode .heart-icon {
  font-size: 13px;
}

body.game-mode .heart-num {
  font-size: 13px;
  margin-left: 1px;
}

body.game-mode .score-big {
  font-size: 14px;
  margin-left: 2px;
}

body.game-mode .score-divider {
  font-size: 10px;
}

body.game-mode .owl-row {
  gap: 2px;
}

body.game-mode .owl-icon {
  font-size: 12px;
}

body.game-mode .owl-num-mine {
  padding: 1px 5px;
  font-size: 12px;
}

body.game-mode .player-card .hand,
body.game-mode .me-card .hand {
  min-width: min(146px, 42vw);
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 3px;
  overflow: hidden;
}

body.game-mode .stone.mini {
  width: 24px !important;
  height: 22px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}

body.game-mode .me-card .stone-back {
  width: 27px !important;
  height: 24px !important;
  border-radius: 6px !important;
}

body.game-mode .mine-unknown::before {
  font-size: 20px;
}

body.game-mode .float-num {
  top: -2px;
  right: 8px;
  font-size: 20px;
}

body.game-mode .mute-btn,
body.game-mode .me-card.my-turn::after {
  display: none !important;
}

body.game-mode .turn-banner {
  top: 42px;
  max-width: calc(100vw - 28px);
  padding: 4px 12px;
  border-width: 1px;
}

body.game-mode .turn-banner.mine {
  font-size: 15px;
}

body.game-mode .turn-banner.other {
  font-size: 12px;
}

body.game-mode .dead-banner {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 4px 8px;
  font-size: 12px;
}

body.game-mode .action-bar {
  position: relative;
  bottom: auto;
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 6px 8px 7px !important;
  border-radius: 11px !important;
}

body.game-mode .action-panel-head {
  margin-bottom: 4px;
}

body.game-mode .action-eyebrow {
  display: none;
}

body.game-mode .action-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.15;
}

body.game-mode .floor-hint {
  min-width: 0;
  padding: 3px 7px;
  font-size: 10px !important;
}

body.game-mode .spell-advisor {
  display: block;
  min-height: 18px;
  max-height: 20px;
  margin-bottom: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body.game-mode .spell-advisor span {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1;
}

body.game-mode .spell-advisor span + span::before {
  content: ' · ';
  color: rgba(230,185,92,0.78);
}

body.game-mode .cast-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px !important;
  margin-bottom: 5px !important;
}

body.game-mode .cast-btn {
  min-height: 44px;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 4px;
  padding: 4px 5px !important;
  border-radius: 8px !important;
}

body.game-mode .cast-num-big {
  grid-row: 1 / 3;
  font-size: 26px;
  line-height: 0.9;
}

body.game-mode .cast-icon {
  display: none;
}

body.game-mode .cast-name {
  font-size: 10px;
  line-height: 1.05;
}

body.game-mode .cast-status {
  font-size: 8px;
  line-height: 1.05;
}

body.game-mode .end-btn {
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 8px !important;
  font-size: 12px;
}

body.game-mode #page-game:not([hidden]) ~ .toast {
  top: 46px;
}

@media (min-width: 520px) {
  body.game-mode .cast-row {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  body.game-mode .cast-btn {
    min-height: 54px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
  }

  body.game-mode .cast-num-big {
    grid-row: auto;
    font-size: 27px;
  }

  body.game-mode .cast-icon {
    display: block;
    font-size: 14px;
  }

  body.game-mode .player-header .player-name {
    font-size: 13px;
  }
}

@media (max-height: 760px) {
  body.game-mode {
    --battle-gap: 4px;
  }

  body.game-mode .game-top-bar {
    min-height: 32px;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
  }

  body.game-mode .board {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }

  body.game-mode .placed-dots {
    height: 12px;
  }

  body.game-mode .player-card,
  body.game-mode .me-card {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  body.game-mode .spell-advisor {
    min-height: 0;
    max-height: 16px;
    margin-bottom: 4px;
  }

  body.game-mode .cast-btn {
    min-height: 40px;
  }

  body.game-mode .end-btn {
    min-height: 31px;
  }
}

@media (max-width: 380px) {
  body.game-mode #app {
    padding-bottom: var(--battle-bottom-strip);
  }

  body.game-mode .room-code-small {
    display: none;
  }

  body.game-mode .player-card .hand,
  body.game-mode .me-card .hand {
    min-width: min(132px, 40vw);
  }

  body.game-mode .stone.mini {
    width: 22px !important;
  }

  body.game-mode .me-card .stone-back {
    width: 24px !important;
  }
}

/* ====== Player-count adaptive readability ======
   玩家越少,牌面越大;5 人也保持比基础紧凑版更清楚。 */
body.game-mode #page-game[data-player-count="5"] .stone.mini {
  width: 34px !important;
  height: 30px !important;
  font-size: 17px !important;
}

body.game-mode #page-game[data-player-count="5"] .me-card .stone-back {
  width: 32px !important;
  height: 29px !important;
}

body.game-mode #page-game[data-player-count="5"] .mine-unknown::before {
  font-size: 22px;
}

body.game-mode #page-game[data-player-count="4"] #other-players {
  gap: 6px;
}

body.game-mode #page-game[data-player-count="4"] .player-card,
body.game-mode #page-game[data-player-count="4"] .me-card {
  padding: 7px 9px !important;
}

body.game-mode #page-game[data-player-count="4"] .stone.mini {
  width: 40px !important;
  height: 34px !important;
  font-size: 20px !important;
}

body.game-mode #page-game[data-player-count="4"] .me-card .stone-back {
  width: 36px !important;
  height: 32px !important;
}

body.game-mode #page-game[data-player-count="4"] .mine-unknown::before {
  font-size: 24px;
}

body.game-mode #page-game[data-player-count="3"] #other-players {
  gap: 8px;
  align-content: center;
}

body.game-mode #page-game[data-player-count="3"] .player-card,
body.game-mode #page-game[data-player-count="3"] .me-card {
  padding: 10px 11px !important;
  border-radius: 11px !important;
}

body.game-mode #page-game[data-player-count="3"] .player-header .player-name {
  font-size: 14px;
}

body.game-mode #page-game[data-player-count="3"] .heart-icon,
body.game-mode #page-game[data-player-count="3"] .heart-num {
  font-size: 15px;
}

body.game-mode #page-game[data-player-count="3"] .score-big {
  font-size: 17px;
}

body.game-mode #page-game[data-player-count="3"] .stone.mini {
  width: 45px !important;
  height: 38px !important;
  font-size: 23px !important;
}

body.game-mode #page-game[data-player-count="3"] .me-card .stone-back {
  width: 38px !important;
  height: 34px !important;
}

body.game-mode #page-game[data-player-count="3"] .mine-unknown::before {
  font-size: 27px;
}

body.game-mode #page-game[data-player-count="2"] #other-players {
  align-content: center;
}

body.game-mode #page-game[data-player-count="2"] .player-card {
  padding: 14px 12px !important;
  border-radius: 12px !important;
}

body.game-mode #page-game[data-player-count="2"] .me-card {
  padding: 11px 12px !important;
  border-radius: 12px !important;
}

body.game-mode #page-game[data-player-count="2"] .player-header .player-name {
  font-size: 16px;
}

body.game-mode #page-game[data-player-count="2"] .heart-icon,
body.game-mode #page-game[data-player-count="2"] .heart-num {
  font-size: 17px;
}

body.game-mode #page-game[data-player-count="2"] .score-big {
  font-size: 20px;
}

body.game-mode #page-game[data-player-count="2"] .stone.mini {
  width: 46px !important;
  height: 40px !important;
  font-size: 25px !important;
}

body.game-mode #page-game[data-player-count="2"] .me-card .stone-back {
  width: 42px !important;
  height: 36px !important;
}

body.game-mode #page-game[data-player-count="2"] .mine-unknown::before {
  font-size: 30px;
}

@media (max-width: 380px) {
  body.game-mode #page-game[data-player-count="5"] .stone.mini {
    width: 32px !important;
    height: 29px !important;
  }

  body.game-mode #page-game[data-player-count="4"] .stone.mini {
    width: 36px !important;
    height: 32px !important;
  }

  body.game-mode #page-game[data-player-count="3"] .stone.mini {
    width: 42px !important;
    height: 36px !important;
  }

  body.game-mode #page-game[data-player-count="2"] .stone.mini {
    width: 43px !important;
    height: 38px !important;
  }
}

/* ====== Compact waiting room cockpit ======
   等待页也固定在首屏内:房号、玩家、目标、开始/离开同时可见。 */
body.room-mode {
  --room-bottom-strip: 32px;
  height: 100dvh;
  overflow: hidden;
}

.debug-bar {
  display: none !important;
}

body.room-mode #app {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: 7px 0 var(--room-bottom-strip) !important;
}

body.room-mode #page-room.page {
  height: calc(100dvh - var(--room-bottom-strip) - 7px);
  max-height: calc(100dvh - var(--room-bottom-strip) - 7px);
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  gap: 8px;
  overflow: hidden;
  padding: 0 16px 6px;
}

body.room-mode .room-header {
  display: grid;
  grid-template-columns: minmax(104px, 1fr) auto;
  grid-template-areas:
    "label code"
    "hint code"
    "copy code";
  align-items: center;
  column-gap: 12px;
  row-gap: 3px;
  min-height: 106px;
  margin: 0;
  padding: 10px 16px 9px !important;
  text-align: left;
  background: linear-gradient(180deg, rgba(17,27,53,0.88), rgba(7,13,28,0.93));
  border: 1px solid rgba(230,185,92,0.26);
  border-radius: 8px;
  box-shadow:
    0 14px 34px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

body.room-mode .room-code-label {
  grid-area: label;
  align-self: end;
  font-size: 13px;
  letter-spacing: 4px;
}

body.room-mode .room-code {
  grid-area: code;
  margin: 0 !important;
  line-height: 0.9;
  text-align: right;
  font-size: clamp(58px, 17vw, 78px) !important;
  letter-spacing: 5px !important;
}

body.room-mode .room-hint {
  grid-area: hint;
  align-self: start;
  max-width: 150px;
  font-size: 11px;
  line-height: 1.35;
}

body.room-mode .room-copy-btn {
  grid-area: copy;
  justify-self: start;
  min-height: 28px;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

body.room-mode .player-list {
  min-height: 0;
  margin: 0 !important;
}

body.room-mode .player-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 6px;
  font-size: 15px;
}

body.room-mode .player-list-count {
  font-family: 'VT323', Menlo, monospace;
  font-size: 26px;
  color: #c8d8f0;
  letter-spacing: 0;
  line-height: 1;
}

body.room-mode .player-list-cap {
  font-size: 11px;
  color: rgba(148,168,199,0.82);
  letter-spacing: 0;
}

body.room-mode #player-list-container {
  display: grid;
  gap: 6px;
}

body.room-mode .player-row {
  min-height: 44px;
  margin: 0 !important;
  padding: 6px 12px !important;
  gap: 10px;
}

body.room-mode .player-avatar {
  width: 30px;
  height: 30px;
  font-size: 15px;
}

body.room-mode .player-row .player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

body.room-mode .player-tag {
  padding: 2px 7px;
  font-size: 11px;
}

body.room-mode .bot-add-row {
  margin: 0 !important;
  padding: 7px 10px !important;
  gap: 6px;
}

body.room-mode .bot-add-label {
  flex: 1 0 100%;
  font-size: 12px;
}

body.room-mode .bot-add-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  padding: 4px 6px;
}

body.room-mode .win-target-row {
  min-height: 44px;
  margin: 0 !important;
  padding: 7px 12px !important;
}

body.room-mode .wt-picker {
  min-width: 116px;
  font-size: 20px;
  line-height: 1;
  padding: 5px 12px;
}

body.room-mode .action-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 0 !important;
}

body.room-mode .action-area .btn {
  min-height: 42px;
  font-size: 17px;
}

body.room-mode #btn-leave-room {
  min-height: 36px;
  font-size: 15px;
}

body.room-mode .site-footer {
  font-size: 12px;
  padding: 4px 8px;
}

@media (max-height: 760px) {
  body.room-mode #page-room.page {
    gap: 7px;
    padding-left: 14px;
    padding-right: 14px;
  }

  body.room-mode .room-header {
    min-height: 98px;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  body.room-mode .room-code {
    font-size: clamp(54px, 16vw, 70px) !important;
  }

  body.room-mode .player-row {
    min-height: 42px;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }

  body.room-mode .action-area .btn {
    min-height: 40px;
  }

  body.room-mode #btn-leave-room {
    min-height: 34px;
  }
}

body.room-mode #page-room[data-player-count="5"] .player-row {
  min-height: 40px;
  padding-top: 5px !important;
  padding-bottom: 5px !important;
}

body.room-mode #page-room[data-player-count="5"] .player-avatar {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

body.room-mode #page-room[data-player-count="5"] .player-list-title {
  margin-bottom: 5px;
}

body.room-mode #page-room[data-player-count="2"] .room-code,
body.room-mode #page-room[data-player-count="3"] .room-code {
  font-size: clamp(62px, 18vw, 82px) !important;
}

@media (max-width: 380px) {
  body.room-mode .room-header {
    grid-template-columns: minmax(92px, 1fr) auto;
    column-gap: 9px;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.room-mode .room-code {
    font-size: clamp(50px, 15.5vw, 64px) !important;
    letter-spacing: 3px !important;
  }

  body.room-mode .room-hint {
    max-width: 126px;
  }

  body.room-mode .room-copy-btn {
    min-height: 26px;
    padding-left: 9px;
    padding-right: 9px;
  }

  body.room-mode .player-row {
    gap: 8px;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
