/* ==========================================================================
 * 《军姿调整》样式表
 * 视觉基调：军绿 / 迷彩 + 扑克牌红黑花色点缀 + 军训铁牌质感
 * ========================================================================== */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1409;
  color: #eaf3e2;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#game { position: fixed; inset: 0; }

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ============================ HUD 顶部信息条 ============================ */
#hud {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;   /* 不挡鼠标点击 */
  z-index: 5;
}

.hud-col { display: flex; flex-direction: column; gap: 8px; }
.hud-right { align-items: flex-end; }

.panel {
  background: linear-gradient(180deg, rgba(46, 64, 36, 0.94), rgba(24, 36, 18, 0.94));
  border: 2px solid #7f9a52;
  border-radius: 9px;
  padding: 8px 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.panel-label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #b9cf8e;
  margin-bottom: 4px;
}

/* --- 剩余牌堆面板 --- */
.deck-panel { padding: 9px 12px 10px; }
.deck-body { display: flex; align-items: center; gap: 10px; }

.mini-card {
  position: relative;
  width: 40px;
  height: 56px;
  background: linear-gradient(160deg, #ffffff, #eef1e6);
  border-radius: 5px;
  color: #1b1b1b;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease;
}
.mini-card.red { color: #cf2b2b; }
.mini-card.pop { animation: cardPop 0.28s ease; }
@keyframes cardPop {
  0%   { transform: scale(0.72) rotate(-8deg); }
  60%  { transform: scale(1.12) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
.mc-rank { position: absolute; left: 4px; top: 2px; font-weight: 800; font-size: 15px; line-height: 1; letter-spacing: -1px; }
.mc-suit { position: absolute; right: 4px; bottom: 2px; font-size: 17px; line-height: 1; }

.deck-count { display: flex; align-items: baseline; gap: 3px; }
.deck-count b { font-size: 30px; line-height: 1; color: #ffe27a; text-shadow: 0 2px 0 #5c3d00; font-variant-numeric: tabular-nums; }
.deck-count small { font-size: 12px; color: #b9cf8e; }
.deck-count.low b { color: #ff7a5c; animation: blink 0.7s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* --- 右侧数据面板 --- */
.stat { min-width: 118px; text-align: right; }
.stat b { font-size: 21px; line-height: 1.1; color: #eaf3e2; font-variant-numeric: tabular-nums; }
#comboText.hot { color: #ffcf4d; text-shadow: 0 0 14px rgba(255, 190, 60, 0.85); animation: comboPulse 0.35s ease; }
@keyframes comboPulse { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ============================ 中上部横幅提示 ============================ */
#toastLayer {
  position: absolute;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 6;
}
.toast {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #ffe27a;
  white-space: nowrap;
  text-shadow: 0 3px 0 #6b3d00, 0 0 22px rgba(255, 200, 60, 0.75);
  animation: toastIn 2.1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.toast.warn { color: #ff8f6b; text-shadow: 0 3px 0 #5a1400, 0 0 22px rgba(255, 90, 40, 0.8); }
.toast.good { color: #b6ff7a; text-shadow: 0 3px 0 #1d4a00, 0 0 22px rgba(140, 255, 90, 0.7); }
@keyframes toastIn {
  0%   { opacity: 0; transform: scale(0.6) translateY(14px); }
  14%  { opacity: 1; transform: scale(1.14) translateY(0); }
  24%  { transform: scale(1); }
  72%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px) scale(0.96); }
}

/* ============================ 底部提示 ============================ */
#tipBar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 7px 20px;
  font-size: 13px;
  letter-spacing: 1px;
  color: #d8e8bd;
  background: rgba(20, 30, 14, 0.72);
  border: 1px solid rgba(150, 180, 100, 0.5);
  border-radius: 20px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

/* ============================ 按钮 ============================ */
.btn {
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 5px;
  color: #17250e;
  padding: 13px 36px;
  border: 2px solid #d6e7ab;
  border-radius: 11px;
  background: linear-gradient(180deg, #9dbe63, #5d7c36);
  box-shadow: 0 6px 0 #3b5223, 0 10px 22px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #3b5223, 0 4px 12px rgba(0, 0, 0, 0.4); }
.btn.small { font-size: 14px; letter-spacing: 2px; padding: 9px 18px; box-shadow: 0 4px 0 #3b5223; }

.icon-btn {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  font-size: 20px;
  border-radius: 50%;
  border: 2px solid #7f9a52;
  background: rgba(28, 42, 20, 0.9);
  color: #eaf3e2;
  cursor: pointer;
  z-index: 8;
  transition: transform 0.12s ease;
}
.icon-btn:hover { transform: scale(1.08); }
.icon-btn.off { opacity: 0.45; }

/* ============================ 全屏面板（开始 / 结算） ============================ */
.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 38%, rgba(22, 36, 16, 0.72), rgba(6, 10, 5, 0.95));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.3s ease;
}
.screen.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.card-box {
  width: min(790px, 96vw);
  max-height: 94vh;
  overflow-y: auto;
  padding: 26px 32px 28px;
  border-radius: 16px;
  border: 3px solid #86a75a;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.022) 0 14px, transparent 14px 28px),
    linear-gradient(180deg, #2c3d24, #17220f 70%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  text-align: center;
  animation: boxIn 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes boxIn { from { transform: translateY(22px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

.tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 4px;
  color: #d6e7ab;
  border: 1px solid rgba(180, 210, 130, 0.55);
  border-radius: 20px;
  padding: 4px 16px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.22);
}
.tag.danger { color: #ffb1a0; border-color: rgba(255, 140, 110, 0.6); }

h1.title {
  font-size: 46px;
  letter-spacing: 12px;
  color: #ffe9a8;
  text-shadow: 0 4px 0 #5a3a10, 0 0 30px rgba(255, 190, 60, 0.45);
  margin-bottom: 6px;
}
h1.title.small { font-size: 32px; letter-spacing: 8px; margin-bottom: 14px; }

.subtitle { color: #c3d6a0; font-size: 14px; letter-spacing: 1px; margin-bottom: 18px; }

.rules {
  list-style: none;
  text-align: left;
  margin: 0 auto 20px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.rules li {
  position: relative;
  padding: 9px 14px 9px 36px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #dbe8c6;
  background: rgba(0, 0, 0, 0.22);
  border-left: 3px solid #8fae5a;
  border-radius: 0 8px 8px 0;
}
.rules li::before {
  content: "▍";
  position: absolute;
  left: 12px;
  top: 9px;
  color: #ffe27a;
}
.rules b { color: #ffe27a; }
.rules li b.k {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  padding: 1px 6px;
  margin-right: 2px;
  border-radius: 5px;
  background: #ffe27a;
  color: #22300f;
  font-weight: 800;
}
.skills-list li { border-left-color: #ffd23c; background: rgba(255, 210, 60, 0.07); }
.skills-list li::before { content: "✦"; color: #ffd23c; }

.rule-title {
  max-width: 640px;
  margin: 2px auto 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #ffe27a;
  border-bottom: 1px dashed rgba(255, 226, 122, 0.35);
  padding-bottom: 5px;
}

.actions { margin-top: 8px; display: flex; justify-content: center; gap: 14px; }
.hint { margin-top: 14px; font-size: 12px; color: #93a97a; letter-spacing: 1px; }

/* ============================ 结算数据 ============================ */
.final-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 18px;
}
.final-score span { font-size: 14px; letter-spacing: 4px; color: #b9cf8e; }
.final-score b {
  font-size: 52px;
  color: #ffe27a;
  text-shadow: 0 4px 0 #5c3d00, 0 0 34px rgba(255, 200, 60, 0.6);
  font-variant-numeric: tabular-nums;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.roster {
  margin: -6px 0 14px;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: #cfe0a8;
}
.roster b { color: #ffd23c; }

.stat-cell {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(140, 175, 95, 0.45);
  border-radius: 9px;
  padding: 9px 6px;
}
.stat-cell span { display: block; font-size: 11px; color: #a8bd85; letter-spacing: 1px; margin-bottom: 4px; }
.stat-cell b { font-size: 18px; color: #eaf3e2; font-variant-numeric: tabular-nums; }

/* ============================ 排行榜 ============================ */
.lb {
  margin: 4px 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(140, 175, 95, 0.4);
  text-align: left;
}
.lb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  letter-spacing: 2px;
  color: #d6e7ab;
  margin-bottom: 8px;
}
.lb-state { font-size: 11px; color: #93a97a; letter-spacing: 0; }
.lb-list { list-style: none; display: flex; flex-direction: column; gap: 4px; min-height: 20px; }
.lb-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: #dbe8c6;
}
.lb-list li .rk { width: 22px; color: #ffe27a; font-weight: 800; }
.lb-list li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list li .sc { font-weight: 800; color: #ffe27a; font-variant-numeric: tabular-nums; }
.lb-list li .meta { font-size: 11px; color: #93a97a; }
.lb-list li.top1 { background: rgba(255, 200, 60, 0.14); }
.lb-list .empty { color: #7d9166; font-size: 12px; padding: 4px 8px; }

.lb-form { display: flex; gap: 8px; margin-top: 10px; }
.lb-form input {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  color: #eaf3e2;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(140, 175, 95, 0.55);
  border-radius: 8px;
  outline: none;
}
.lb-form input:focus { border-color: #ffe27a; }
.lb-form input::placeholder { color: #7d9166; }

/* ============================ 技能栏（左下） ============================ */
#skillBar {
  position: absolute;
  left: 16px;
  bottom: 56px;
  display: flex;
  gap: 8px;
  z-index: 6;
}
.skill {
  position: relative;
  width: 92px;
  padding: 7px 8px 8px;
  border-radius: 9px;
  border: 2px solid #6d8447;
  background: linear-gradient(180deg, rgba(38, 54, 32, 0.94), rgba(20, 30, 15, 0.94));
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.42);
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.skill:active { transform: translateY(2px); }
.skill .key {
  position: absolute;
  left: -6px;
  top: -8px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 6px;
  background: #ffe27a;
  color: #22300f;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 2px 0 #a8760b;
}
.skill .sname {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #eaf3e2;
  margin-bottom: 2px;
}
.skill .sstate {
  display: block;
  font-size: 10.5px;
  color: #a8bd85;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.skill.locked { opacity: 0.55; filter: grayscale(0.7); }
.skill.locked .key { background: #7d8a6a; box-shadow: 0 2px 0 #3d4a2c; color: #e8eedd; }
.skill.ready { border-color: #ffd23c; box-shadow: 0 5px 14px rgba(0, 0, 0, 0.42), 0 0 14px rgba(255, 210, 60, 0.45); }
.skill.ready .sstate { color: #ffe27a; }
.skill.active { border-color: #7fe6ff; box-shadow: 0 0 0 2px rgba(127, 230, 255, 0.55), 0 0 18px rgba(127, 230, 255, 0.55); }

/* ============================ 小屏适配 ============================ */
@media (max-width: 720px) {
  h1.title { font-size: 32px; letter-spacing: 6px; }
  h1.title.small { font-size: 24px; }
  .rules li { font-size: 12.5px; padding-left: 30px; }
  .card-box { padding: 20px 18px; }
  .stat { min-width: 92px; }
  .stat b { font-size: 17px; }
  #tipBar { font-size: 11px; padding: 6px 12px; }
  .deck-count b { font-size: 24px; }
  .toast { font-size: 20px; letter-spacing: 2px; }
  .final-score b { font-size: 38px; }
  #skillBar { left: 8px; bottom: 44px; gap: 5px; }
  .skill { width: 74px; padding: 6px 5px 7px; }
  .skill .sname { font-size: 11.5px; }
  .skill .sstate { font-size: 9.5px; }
  .skill .key { width: 19px; height: 19px; line-height: 19px; font-size: 11px; left: -5px; top: -7px; }
}
