/* style.css — 背包竞技场：羊皮纸 × 墨绿呢绒 × 黄铜长桌 */
/* 桌面端双栏沉浸舞台 + 移动端掌机化；无外部资源，系统字体栈 */

:root {
  --felt: #16372b;
  --felt-2: #1e4d3a;
  --felt-3: #2a6b4f;
  --wood: #3a2a1c;
  --wood-2: #4a3524;
  --brass: #b08d4f;
  --brass-hi: #e8c877;
  --brass-lo: #7a5f32;
  --parchment: #f1e4c3;
  --parchment-2: #e9d8ae;
  --parchment-hi: #faf3df;
  --ink: #3d2f1f;
  --ink-soft: #6b5a40;
  --blood: #8a2f2f;
  --blood-hi: #e05b4a;
  --gold: #d9a83c;
  --sky: #4aa3d8;
  --shadow: rgba(10, 12, 8, 0.45);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--parchment-hi);
  background: #0d1410;
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------------- 酒馆背景（景深氛围） ---------------- */
.tavern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(58, 107, 79, 0.55) 0%, rgba(22, 55, 43, 0.85) 45%, rgba(10, 18, 14, 1) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 5px),
    radial-gradient(80% 60% at 50% 50%, rgba(30, 77, 58, 0.35), transparent 70%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  animation: breathe 7s ease-in-out infinite;
}

.glow-a {
  width: 420px;
  height: 320px;
  left: -120px;
  top: 12%;
  background: radial-gradient(circle, rgba(232, 200, 119, 0.4), transparent 70%);
}

.glow-b {
  width: 380px;
  height: 300px;
  right: -100px;
  top: 40%;
  background: radial-gradient(circle, rgba(74, 163, 216, 0.25), transparent 70%);
  animation-delay: -3s;
}

.glow-c {
  width: 500px;
  height: 300px;
  left: 30%;
  bottom: -140px;
  background: radial-gradient(circle, rgba(232, 200, 119, 0.28), transparent 70%);
  animation-delay: -5s;
}

.dust i {
  position: absolute;
  width: var(--s);
  height: var(--s);
  left: var(--x);
  top: 85%;
  background: rgba(248, 239, 217, 0.5);
  border-radius: 50%;
  animation: rise var(--t) linear infinite;
  animation-delay: var(--d);
  opacity: 0;
}

@keyframes rise {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.25;
  }
  100% {
    transform: translateY(-90vh);
    opacity: 0;
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.12);
  }
}

/* ---------------- 机台骨架 ---------------- */
.cabinet {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 18px 14px calc(40px + env(safe-area-inset-bottom));
}

.table {
  position: relative;
  width: 100%;
  max-width: 1160px;
  background:
    linear-gradient(180deg, rgba(74, 53, 36, 0.9), rgba(58, 42, 28, 0.96)),
    radial-gradient(80% 120% at 50% 0%, rgba(90, 64, 40, 0.5), transparent 70%);
  border: 1px solid rgba(176, 141, 79, 0.5);
  border-radius: 18px 18px 26px 26px;
  box-shadow:
    inset 0 1px 0 rgba(248, 239, 217, 0.12),
    0 24px 60px var(--shadow),
    0 4px 14px rgba(0, 0, 0, 0.5);
  padding: 0 20px 20px;
}

/* ---------------- 黄铜机顶条 ---------------- */
.brass-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px 12px;
  border-bottom: 2px solid rgba(176, 141, 79, 0.4);
  margin-bottom: 14px;
}

.brass-bar::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 44px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 200, 119, 0.5), transparent);
  pointer-events: none;
}

.brass-bar a {
  color: var(--brass-hi);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  border: 1px solid rgba(176, 141, 79, 0.55);
  border-radius: 8px;
  background: rgba(122, 95, 50, 0.22);
  transition: transform 0.12s ease, background 0.12s ease;
}

.brass-bar a:hover {
  transform: translateY(-1px);
  background: rgba(176, 141, 79, 0.3);
}

.plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 1;
}

.plate-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--brass-hi);
  letter-spacing: 0.18em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.plate-sub {
  font-size: 10px;
  letter-spacing: 0.42em;
  color: rgba(232, 200, 119, 0.65);
}

.tools {
  display: flex;
  gap: 6px;
}

.knob {
  width: 36px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(176, 141, 79, 0.6);
  background:
    linear-gradient(180deg, rgba(232, 200, 119, 0.28), rgba(122, 95, 50, 0.35)),
    rgba(122, 95, 50, 0.2);
  color: var(--brass-hi);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(248, 239, 217, 0.25);
  transition: transform 0.1s ease;
}

.knob:hover {
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(232, 200, 119, 0.4), rgba(122, 95, 50, 0.45)),
    rgba(176, 141, 79, 0.25);
}

.knob:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.35), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.knob-wide {
  width: auto;
  padding: 0 10px;
}

/* ---------------- 主舞台 ---------------- */
.stage {
  position: relative;
  min-height: 480px;
}

/* ---------------- 通用按键 ---------------- */
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #241a0d;
  background:
    linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 100%);
  border: 1px solid rgba(58, 42, 28, 0.9);
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22);
  transition: transform 0.1s ease, filter 0.1s ease;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.key:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.key:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.45), inset 0 2px 5px rgba(0, 0, 0, 0.35);
}

.key-primary {
  background:
    linear-gradient(180deg, #f0cf7c 0%, #c9a55c 55%, #8a6a34 100%);
}

.key-danger {
  background:
    linear-gradient(180deg, #e08a78 0%, #a5433a 60%, #6f2822 100%);
  color: #fff2e4;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.key-quiet {
  background:
    linear-gradient(180deg, #c8b98f 0%, #9a8a5f 55%, #6f6140 100%);
  color: #2b2012;
}

.key-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.key-big {
  width: 100%;
  padding: 13px 18px;
  font-size: 15px;
}

.key[disabled],
.class-card[disabled],
.puzzle-cell[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ---------------- 菜单 / 开局场景 ---------------- */
.ready-scene,
.pick-scene,
.puzzles-scene,
.mirror {
  padding: 30px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.5em;
  color: var(--brass-hi);
  margin-bottom: 8px;
}

.title {
  font-size: 42px;
  font-weight: 900;
  color: var(--parchment-hi);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 24px rgba(232, 200, 119, 0.25);
  letter-spacing: 0.06em;
}

.lede {
  max-width: 640px;
  margin: 14px auto 20px;
  color: rgba(241, 228, 195, 0.85);
  line-height: 1.7;
  font-size: 14px;
}

.rank-line {
  color: var(--brass-hi);
  font-size: 13px;
  margin-bottom: 20px;
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.seed-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px dashed rgba(176, 141, 79, 0.55);
  background: rgba(0, 0, 0, 0.22);
}

.seed-zone label {
  font-size: 13px;
  color: var(--parchment-2);
}

.seed-zone input {
  width: 190px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(176, 141, 79, 0.6);
  background: rgba(15, 22, 17, 0.8);
  color: var(--parchment-hi);
  font-size: 13px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.08em;
}

.seed-zone input:focus {
  outline: none;
  border-color: var(--brass-hi);
  box-shadow: 0 0 0 2px rgba(232, 200, 119, 0.25);
}

.scene-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--brass-hi);
  margin-bottom: 16px;
}

.scene-sub {
  font-size: 13px;
  color: rgba(241, 228, 195, 0.8);
  margin-bottom: 16px;
}

.scene-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.class-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 760px;
}

.class-card {
  width: 210px;
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px solid rgba(176, 141, 79, 0.5);
  background:
    linear-gradient(180deg, rgba(46, 80, 60, 0.65), rgba(24, 46, 35, 0.85)),
    var(--felt-2);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(248, 239, 217, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.class-card:hover:not([disabled]) {
  transform: translateY(-3px);
  border-color: var(--brass-hi);
}

.class-card.is-active {
  border-color: var(--brass-hi);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(232, 200, 119, 0.4);
}

.class-icon {
  font-size: 34px;
}

.class-card b {
  font-size: 16px;
  color: var(--parchment-hi);
}

.class-card i {
  font-style: normal;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(241, 228, 195, 0.75);
}

.bag-cards {
  margin-top: 22px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.bag-card {
  width: 150px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(176, 141, 79, 0.5);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.12s ease;
}

.bag-card:hover {
  transform: translateY(-2px);
}

.bag-card.is-active {
  border-color: var(--brass-hi);
  box-shadow: 0 0 0 2px rgba(232, 200, 119, 0.35);
}

.bag-card b {
  color: var(--parchment-hi);
  font-size: 14px;
}

.bag-card i {
  font-style: normal;
  font-size: 20px;
  letter-spacing: 0.1em;
}

/* ---------------- 残局列表 ---------------- */
.puzzles-scene {
  align-items: stretch;
  text-align: left;
}

.puzzle-chapter {
  margin-bottom: 18px;
}

.puzzle-chapter h3 {
  color: var(--brass-hi);
  font-size: 15px;
  margin-bottom: 10px;
  letter-spacing: 0.08em;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.puzzle-cell {
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid rgba(176, 141, 79, 0.5);
  background:
    linear-gradient(180deg, rgba(46, 80, 60, 0.6), rgba(24, 46, 35, 0.9));
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease;
}

.puzzle-cell:hover:not([disabled]) {
  transform: translateY(-2px);
}

.puzzle-cell b {
  font-size: 18px;
  color: var(--parchment-hi);
}

.puzzle-cell .stars {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.1em;
}

.puzzle-cell i {
  font-style: normal;
  font-size: 15px;
  opacity: 0.85;
}

/* ---------------- 远征双栏舞台 ---------------- */
.expedition,
.puzzle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 10px;
}

.side-head h2 {
  font-size: 14px;
  font-weight: 800;
  color: var(--brass-hi);
  letter-spacing: 0.1em;
}

.run-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(176, 141, 79, 0.5);
  background: rgba(0, 0, 0, 0.3);
  color: var(--parchment-2);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chip b {
  color: var(--brass-hi);
}

.chip-win b {
  color: #7fd08a;
}

.chip-loss b {
  color: var(--blood-hi);
}

/* ---------------- 棋盘 ---------------- */
.board-frame {
  position: relative;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(176, 141, 79, 0.55);
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(58, 107, 79, 0.5), rgba(22, 55, 43, 0.9) 70%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 6px),
    var(--felt);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45), 0 2px 0 rgba(0, 0, 0, 0.4);
  min-height: 120px;
}

.board {
  position: relative;
  width: calc(var(--cols) * var(--cell));
  height: calc(var(--rows) * var(--cell));
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cell {
  position: absolute;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(248, 239, 217, 0.16), rgba(248, 239, 217, 0.05)),
    rgba(0, 0, 0, 0.14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.cell.is-blocked::before {
  background: rgba(8, 12, 9, 0.55);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
}

/* 格子定位由 item 的 transform 承担 */

.item {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 9px;
  border: 1px solid rgba(58, 42, 28, 0.7);
  background:
    radial-gradient(120% 100% at 50% 18%, rgba(255, 255, 255, 0.22), transparent 45%),
    linear-gradient(180deg, rgba(122, 95, 50, 0.55), rgba(58, 42, 28, 0.65));
  box-shadow:
    0 3px 5px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(248, 239, 217, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.3);
  z-index: 2;
  transition: filter 0.12s ease;
  touch-action: none;
}

.item::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 7px;
  pointer-events: none;
  background: radial-gradient(80% 60% at 50% 30%, rgba(248, 239, 217, 0.12), transparent 70%);
}

.item .item-icon {
  font-size: calc(var(--cell) * 0.52);
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
  position: relative;
  z-index: 1;
}

.item .item-name {
  font-size: calc(var(--cell) * 0.2);
  color: rgba(248, 239, 217, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  line-height: 1;
  position: relative;
  z-index: 1;
  max-width: 95%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 选中：无描边圈的柔光 + 轻浮起 */
.item.is-selected {
  z-index: 5;
  filter: brightness(1.14);
  box-shadow:
    0 3px 5px rgba(0, 0, 0, 0.5),
    0 0 0 3px rgba(232, 200, 119, 0.28),
    0 0 18px 4px rgba(232, 200, 119, 0.35),
    inset 0 1px 0 rgba(248, 239, 217, 0.4);
}

.item:hover {
  filter: brightness(1.08);
}

.ghost {
  position: fixed;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell, 40) * 0.5);
  border-radius: 9px;
  background: rgba(122, 95, 50, 0.85);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0.92;
}

.drop-preview {
  position: absolute;
  z-index: 1;
  border-radius: 9px;
  background: rgba(127, 208, 138, 0.28);
  box-shadow: 0 0 12px rgba(127, 208, 138, 0.4) inset;
  pointer-events: none;
}

.drop-preview.is-bad {
  background: rgba(224, 91, 74, 0.3);
  box-shadow: 0 0 12px rgba(224, 91, 74, 0.4) inset;
}

.board-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hint-line {
  font-size: 11px;
  color: rgba(241, 228, 195, 0.6);
  flex: 1;
  min-width: 140px;
}

/* ---------------- 商队柜台 ---------------- */
.counter-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.shop-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px 8px;
  border-radius: 11px;
  border: 1px solid rgba(176, 141, 79, 0.55);
  background:
    linear-gradient(180deg, rgba(241, 228, 195, 0.92), rgba(217, 196, 150, 0.96));
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.1s ease;
  touch-action: none;
}

.shop-item:hover {
  transform: translateY(-2px);
}

.shop-item:active {
  transform: translateY(2px);
}

.shop-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.shop-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shop-cost {
  font-size: 11px;
  font-weight: 800;
  color: #7a5a16;
}

.rack {
  min-height: 64px;
  border-radius: 12px;
  border: 1px dashed rgba(176, 141, 79, 0.5);
  background: rgba(0, 0, 0, 0.22);
  padding: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.rack-empty {
  font-size: 12px;
  color: rgba(241, 228, 195, 0.55);
  padding: 6px;
}

.rack-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid rgba(176, 141, 79, 0.6);
  background:
    linear-gradient(180deg, rgba(232, 200, 119, 0.3), rgba(122, 95, 50, 0.35));
  font-size: 12px;
  color: var(--parchment-hi);
  font-weight: 700;
  touch-action: none;
  transition: transform 0.1s ease;
}

.rack-item:hover {
  transform: translateY(-2px);
}

.rack-item .item-icon {
  font-size: 18px;
}

/* ---------------- 信息面板 ---------------- */
.info-panel {
  border-radius: 12px;
  border: 1px solid rgba(176, 141, 79, 0.5);
  background: rgba(0, 0, 0, 0.26);
  padding: 12px;
  min-height: 74px;
}

.info-empty {
  font-size: 12px;
  color: rgba(241, 228, 195, 0.55);
}

.info-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--brass-hi);
  margin-bottom: 4px;
}

.info-desc {
  font-size: 12px;
  color: rgba(241, 228, 195, 0.85);
  line-height: 1.5;
  margin-bottom: 8px;
}

.info-actions {
  display: flex;
  gap: 8px;
}

/* ---------------- 对手卡 ---------------- */
.enemy-card {
  border-radius: 12px;
  border: 1px solid rgba(176, 141, 79, 0.5);
  background:
    linear-gradient(180deg, rgba(70, 34, 30, 0.5), rgba(40, 22, 20, 0.75));
  padding: 10px 12px;
}

.enemy-label {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: rgba(241, 228, 195, 0.55);
  margin-bottom: 3px;
}

.enemy-main {
  font-size: 15px;
  font-weight: 800;
  color: var(--parchment-hi);
  margin-bottom: 3px;
}

.enemy-sub {
  font-size: 11px;
  color: rgba(241, 228, 195, 0.7);
  line-height: 1.45;
  margin-bottom: 5px;
}

.enemy-scale {
  font-size: 11px;
  color: var(--blood-hi);
  font-weight: 700;
}

/* ---------------- 战斗幕布 ---------------- */
.curtain {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(90% 80% at 50% 50%, rgba(12, 18, 14, 0.82), rgba(6, 10, 8, 0.94));
  border-radius: 14px;
  backdrop-filter: blur(2px);
}

#battle-canvas {
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 420px;
  display: block;
}

/* ---------------- 提示气泡 ---------------- */
.toasts {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(232, 200, 119, 0.7);
  background: rgba(28, 20, 10, 0.92);
  color: var(--parchment-hi);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------- 覆盖面板 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 8, 0.72);
  backdrop-filter: blur(3px);
  padding: 16px;
}

/* hidden 显式兜底：.overlay/.curtain 的 display 会覆盖 UA 的 [hidden]，导致遮罩常驻拦截点击 */
.overlay[hidden],
.curtain[hidden],
.panel[hidden] {
  display: none !important;
}

.panel {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px 28px;
  border-radius: 16px;
  border: 2px solid rgba(176, 141, 79, 0.85);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(248, 239, 217, 0.9), rgba(233, 216, 174, 0.97)),
    var(--parchment);
  color: var(--ink);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.panel-title {
  font-size: 22px;
  font-weight: 900;
  color: #5a3d14;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.panel-kicker {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: #8a6a34;
  margin-bottom: 4px;
}

.panel-lede {
  font-size: 13px;
  line-height: 1.65;
  color: rgba(61, 47, 31, 0.88);
  margin-bottom: 10px;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 0;
}

.help-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(61, 47, 31, 0.9);
}

.help-list li::before {
  content: "◆";
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 9px;
  color: #8a6a34;
}

.hint-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint-list li {
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-list small {
  color: rgba(61, 47, 31, 0.6);
}

.stars-big {
  font-size: 30px;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 4px 0 2px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.tally {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 6px 0;
}

.tally p {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(122, 95, 50, 0.14);
  font-size: 13px;
  color: var(--ink);
}

.tally b {
  color: #5a3d14;
}

.seed-line {
  font-size: 12px;
  color: rgba(61, 47, 31, 0.75);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  margin-top: 4px;
}

/* ---------------- 镜像场景 ---------------- */
.mirror-herald {
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.mirror-herald .key-big {
  margin-top: 8px;
  max-width: 280px;
}

/* ---------------- noscript ---------------- */
.noscript {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 200;
  background: #2a1010;
  color: #ffd9c9;
  text-align: center;
  padding: 12px;
  font-size: 13px;
}

/* ---------------- 动效降级 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------- 移动端：掌机化 ---------------- */
@media (max-width: 768px) {
  .cabinet {
    padding: 10px 6px max(68px, calc(16px + env(safe-area-inset-bottom)));
  }

  .table {
    padding: 0 10px 12px;
    border-radius: 14px;
  }

  .brass-bar {
    padding: 8px 2px 10px;
  }

  .plate-name {
    font-size: 14px;
  }

  .expedition,
  .puzzle {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .board-frame {
    padding: 8px;
  }

  .counter-side {
    order: 2;
  }

  .board-actions {
    padding-bottom: 4px;
  }

  .title {
    font-size: 30px;
  }

  .class-card {
    width: 100%;
    max-width: 320px;
  }

  .shop {
    grid-template-columns: repeat(3, 1fr);
  }

  .curtain {
    border-radius: 10px;
  }

  #battle-canvas {
    min-height: 240px;
  }
}

/* 极窄屏兜底 */
@media (max-width: 420px) {
  .knob {
    width: 32px;
  }

  .shop-item {
    padding: 8px 4px 6px;
  }

  .shop-icon {
    font-size: 22px;
  }

  .hint-line {
    display: none;
  }
}
