/* ==================== reset.css ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#app {
  height: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
  font-weight: inherit;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

canvas {
  display: block;
}

::selection {
  background: rgba(70, 224, 255, 0.28);
}

*:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(70, 224, 255, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(70, 224, 255, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==================== theme.css ==================== */
:root {
  --c-bg: #05070d;
  --c-bg-2: #080c15;
  --c-panel: rgba(12, 18, 30, 0.82);
  --c-panel-solid: #0c121e;
  --c-line: rgba(120, 180, 220, 0.16);
  --c-line-strong: rgba(120, 200, 240, 0.34);

  --c-red: #ff3b52;
  --c-red-soft: #ff7385;
  --c-green: #12d18e;
  --c-green-soft: #4ef0b8;
  --c-cyan: #46e0ff;
  --c-gold: #f5c451;
  --c-purple: #a06bff;
  --c-blue: #4d8dff;

  --c-text: #dfe9f5;
  --c-text-dim: #8ea3bd;
  --c-text-faint: #5c718c;

  --font-ui: 'HarmonyOS Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC',
    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --sh-glow-cyan: 0 0 18px rgba(70, 224, 255, 0.35);
  --sh-glow-red: 0 0 18px rgba(255, 59, 82, 0.4);
  --sh-glow-green: 0 0 18px rgba(18, 209, 142, 0.4);

  --t-fast: 0.12s cubic-bezier(0.3, 0.7, 0.4, 1);
  --t-mid: 0.24s cubic-bezier(0.3, 0.7, 0.4, 1);
}

html,
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
}

/* 全局背景：网格 + 扫描线 + 呼吸光 */
body::before {
  content: '';
  position: fixed;
  inset: -10%;
  background-image: linear-gradient(rgba(70, 224, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 224, 255, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(600px) rotateX(0deg);
  animation: gridDrift 24s linear infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.55;
}

@keyframes gridDrift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 0 48px, 48px 0;
  }
}

#app {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: hidden;
}

/* 通用文本工具 */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.dim {
  color: var(--c-text-dim);
}
.faint {
  color: var(--c-text-faint);
}
.up {
  color: var(--c-red);
}
.down {
  color: var(--c-green);
}
.gold {
  color: var(--c-gold);
}
.center {
  text-align: center;
}

/* 启动占位 */
#boot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.boot-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 700;
  color: var(--c-red);
  border: 2px solid var(--c-red);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--c-text-faint);
  letter-spacing: 0.2em;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.97);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

/* 场景切换动画（3D 推近） */
.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  animation: sceneIn 0.42s cubic-bezier(0.16, 0.84, 0.28, 1);
  transform-style: preserve-3d;
}
@keyframes sceneIn {
  from {
    opacity: 0;
    transform: perspective(1500px) translateZ(-130px) rotateX(4deg);
  }
  to {
    opacity: 1;
    transform: perspective(1500px) translateZ(0) rotateX(0deg);
  }
}
.scene.fade-out {
  animation: sceneOut 0.2s ease forwards;
  pointer-events: none;
}

/* canvas 是替换元素：inset 不会拉伸它，必须显式给定尺寸 */
.scene canvas {
  width: 100%;
  height: 100%;
}
@keyframes sceneOut {
  to {
    opacity: 0;
    transform: perspective(1500px) translateZ(90px) scale(1.02);
  }
}

/* 故障效果 */
.glitch {
  animation: glitch 0.4s steps(2, end) 3;
}
@keyframes glitch {
  0% {
    transform: translate(0);
    filter: none;
  }
  20% {
    transform: translate(-2px, 1px);
    filter: hue-rotate(35deg);
  }
  40% {
    transform: translate(2px, -1px);
  }
  60% {
    transform: translate(-1px, -2px);
    filter: hue-rotate(-35deg);
  }
  80% {
    transform: translate(1px, 2px);
  }
  100% {
    transform: translate(0);
    filter: none;
  }
}

.shake {
  animation: shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }
  40%,
  60% {
    transform: translateX(6px);
  }
}

.flash {
  animation: flash 0.5s ease-out;
}
@keyframes flash {
  0% {
    filter: brightness(2.6) saturate(0.4);
  }
  100% {
    filter: none;
  }
}

/* ==================== ui.css ==================== */
/* ————————————————— 面板 ————————————————— */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(14, 22, 36, 0.86), rgba(8, 13, 22, 0.9));
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(120, 200, 240, 0.08), 0 10px 30px rgba(0, 0, 0, 0.45);
}
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--c-line-strong);
  pointer-events: none;
  transition: border-color var(--t-mid);
}
.panel::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}
.panel::after {
  bottom: -1px;
  right: -1px;
  border-left: 0;
  border-top: 0;
}
.panel:hover::before,
.panel:hover::after {
  border-color: var(--c-cyan);
}
/* 顶部的全息高光扫描 */
.panel > .panel-title::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-cyan), transparent);
  animation: panelScan 4.5s linear infinite;
  opacity: 0.7;
}
@keyframes panelScan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(350%);
  }
}
.panel-title {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--c-text-faint);
  text-transform: uppercase;
  font-family: var(--font-mono);
  padding: 8px 12px 0;
  position: relative;
  overflow: hidden;
}

/* ————————————————— 按钮 ————————————————— */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--c-text);
  background: linear-gradient(180deg, rgba(70, 224, 255, 0.1), rgba(70, 224, 255, 0.02));
  border: 1px solid rgba(70, 224, 255, 0.28);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
  max-width: 100%;
  overflow: hidden;
}
.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(70, 224, 255, 0.22), rgba(70, 224, 255, 0.06));
  border-color: var(--c-cyan);
  box-shadow: var(--sh-glow-cyan);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}
.btn:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}
.btn.primary {
  border-color: var(--c-red);
  background: linear-gradient(180deg, rgba(255, 59, 82, 0.2), rgba(255, 59, 82, 0.05));
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  box-shadow: var(--sh-glow-red);
  background: linear-gradient(180deg, rgba(255, 59, 82, 0.34), rgba(255, 59, 82, 0.1));
}
.btn.ghost {
  background: transparent;
  border-color: var(--c-line);
  color: var(--c-text-dim);
}
.btn.ghost:hover:not(:disabled) {
  border-color: var(--c-line-strong);
  color: var(--c-text);
  box-shadow: none;
}
.btn.gold {
  border-color: var(--c-gold);
  background: linear-gradient(180deg, rgba(245, 196, 81, 0.18), rgba(245, 196, 81, 0.04));
  color: #ffe9b0;
}
.btn.gold:hover:not(:disabled) {
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.4);
}
.btn.sm {
  padding: 6px 12px;
  font-size: 13px;
}
.btn.xs {
  padding: 3px 9px;
  font-size: 12px;
}
.btn.block {
  width: 100%;
}

/* ————————————————— 条 ————————————————— */
.bar {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-line);
  border-radius: 2px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  transition: width 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.bar.hp > i {
  background: linear-gradient(90deg, #ff3b52, #ff8a5c);
  box-shadow: 0 0 12px rgba(255, 59, 82, 0.55);
}
.bar.hp.enemy > i {
  background: linear-gradient(90deg, #a06bff, #ff3b52);
  box-shadow: 0 0 12px rgba(160, 107, 255, 0.5);
}
.bar.pl > i {
  background: linear-gradient(90deg, var(--c-gold), #fff1c2);
}
.bar .bar-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px #000;
}

/* ————————————————— 标签 ————————————————— */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  font-size: 11px;
  line-height: 1.7;
  border-radius: 2px;
  border: 1px solid hsl(var(--hue, 200) 70% 60% / 0.45);
  color: hsl(var(--hue, 200) 85% 72%);
  background: hsl(var(--hue, 200) 70% 50% / 0.12);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ————————————————— 卡牌 ————————————————— */
.card {
  --hue: 200;
  position: relative;
  width: 154px;
  min-height: 214px;
  display: flex;
  flex-direction: column;
  padding: 9px 10px 10px;
  background: linear-gradient(165deg, hsl(var(--hue) 42% 12%), rgba(8, 12, 20, 0.96) 62%);
  border: 1px solid hsl(var(--hue) 70% 55% / 0.4);
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.1s ease-out, box-shadow var(--t-mid), border-color var(--t-mid);
  user-select: none;
  overflow: hidden;
  transform-style: preserve-3d;
}
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 60% at 50% -10%, hsl(var(--hue) 90% 60% / 0.28), transparent 70%);
  pointer-events: none;
}
/* 跟随鼠标的高光 */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 7px;
  pointer-events: none;
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 0%),
    rgba(255, 255, 255, 0.2),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 4;
  mix-blend-mode: screen;
}
.card:hover::before {
  opacity: 1;
}

.card-badge {
  position: absolute;
  top: -9px;
  left: -9px;
  width: 24px;
  height: 27px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(180deg, #ffe9a8, #e0a92b);
  color: #241704;
  font-size: 12px;
  font-weight: 700;
  z-index: 6;
  box-shadow: 0 0 16px rgba(245, 196, 81, 0.8);
}
.card.recommended {
  border-color: var(--c-gold);
  box-shadow: 0 0 0 1px rgba(245, 196, 81, 0.6), 0 0 28px rgba(245, 196, 81, 0.42);
}
.card.recommended .card-name {
  color: #fff3cf;
}
.card:hover {
  transform: translateY(-14px) scale(1.045);
  border-color: hsl(var(--hue) 90% 68%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65), 0 0 26px hsl(var(--hue) 90% 60% / 0.35);
  z-index: 20;
}
.card.legend {
  border-color: rgba(245, 196, 81, 0.75);
  box-shadow: 0 0 22px rgba(245, 196, 81, 0.25);
}
.card.legend::after {
  background: radial-gradient(120% 60% at 50% -10%, rgba(245, 196, 81, 0.36), transparent 70%);
}
.card.disabled {
  filter: grayscale(0.75) brightness(0.62);
  cursor: not-allowed;
}
.card.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: hsl(var(--hue) 70% 55% / 0.4);
}
.card.selected {
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 2px rgba(70, 224, 255, 0.5), 0 0 30px rgba(70, 224, 255, 0.4);
  transform: translateY(-18px) scale(1.05);
}
.card.targeting {
  border-color: var(--c-gold);
  box-shadow: 0 0 0 2px rgba(245, 196, 81, 0.5), 0 0 26px rgba(245, 196, 81, 0.4);
}
.card-cost {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 30px;
  height: 34px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: hsl(var(--hue) 80% 50%);
  color: #06121c;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  text-shadow: none;
  z-index: 3;
}
.card-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  padding-right: 18px;
  min-height: 22px;
}
.card-kind {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  color: hsl(var(--hue) 80% 70%);
  margin-bottom: 6px;
}
.card-art {
  height: 46px;
  margin: 4px 0 7px;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: hsl(var(--hue) 90% 72%);
  background: repeating-linear-gradient(
      90deg,
      hsl(var(--hue) 80% 60% / 0.14) 0 3px,
      transparent 3px 7px
    ),
    linear-gradient(180deg, hsl(var(--hue) 60% 30% / 0.32), transparent);
  border-top: 1px solid hsl(var(--hue) 70% 60% / 0.24);
  border-bottom: 1px solid hsl(var(--hue) 70% 60% / 0.24);
}
.card-text {
  font-size: 12px;
  line-height: 1.5;
  color: #cfe0f0;
  flex: 1;
}
.card-flavor {
  margin-top: 6px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--c-text-faint);
  font-style: italic;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 5px;
}
.card-up {
  position: absolute;
  bottom: 6px;
  left: 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--c-gold);
  letter-spacing: 0.1em;
}

/* 卡牌小尺寸（卡组列表） */
.card.mini {
  width: 100%;
  min-height: 0;
  transform: none !important;
  padding: 7px 9px;
}
.card.mini:hover {
  transform: none;
  box-shadow: 0 0 16px hsl(var(--hue) 90% 60% / 0.28);
}
.card.mini .card-art,
.card.mini .card-flavor {
  display: none;
}
.card.mini .card-text {
  font-size: 11.5px;
}

/* ————————————————— 提示气泡 ————————————————— */
.tip {
  position: relative;
}
.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: rgba(6, 10, 18, 0.97);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  width: max-content;
  max-width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast);
  z-index: 60;
  color: var(--c-text);
}
.tip:hover::after {
  opacity: 1;
}

/* ————————————————— 开关 ————————————————— */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  display: none;
}
.switch .track {
  width: 42px;
  height: 22px;
  border-radius: 11px;
  border: 1px solid var(--c-line-strong);
  background: rgba(255, 255, 255, 0.05);
  position: relative;
  transition: all var(--t-fast);
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-text-faint);
  transition: all var(--t-fast);
}
.switch input:checked + .track {
  background: rgba(70, 224, 255, 0.22);
  border-color: var(--c-cyan);
}
.switch input:checked + .track::after {
  left: 22px;
  background: var(--c-cyan);
  box-shadow: 0 0 10px var(--c-cyan);
}

/* 滑块 */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--c-cyan);
  box-shadow: 0 0 10px rgba(70, 224, 255, 0.7);
  cursor: pointer;
}

/* ————————————————— 飘字 ————————————————— */
.float-text {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  pointer-events: none;
  animation: floatUp 0.95s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  z-index: 40;
  white-space: nowrap;
}
@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.7);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -6px) scale(1.12);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -52px) scale(1);
  }
}

/* 提示横幅 */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  background: rgba(6, 10, 18, 0.96);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  font-size: 14px;
  z-index: 9999;
  animation: toastIn 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -14px);
  }
}

/* ==================== battle.css ==================== */
/* ══════════════════════════════════════════════
   大A 的牌桌 —— 战斗场景
   ══════════════════════════════════════════════ */

.battle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 8%, #0a0f1c 0%, #05070d 55%, #02040a 100%);
}

/* ————— 大A：填满上半屏的巨大黑影 ————— */
.biga-layer {
  position: absolute;
  left: -6%;
  right: -6%;
  top: -2%;
  height: 68%;
  z-index: 0;
  pointer-events: none;
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.3, 1);
  animation: bigaBreathe 7s ease-in-out infinite;
}
.biga-layer .biga-svg {
  width: 100%;
  height: 100%;
}
.biga-layer .biga-eyes {
  animation: eyesBlink 6.5s steps(1) infinite;
  transform-origin: 600px 250px;
}
@keyframes bigaBreathe {
  0%,
  100% {
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.035) translateY(-1.2%);
  }
}
@keyframes eyesBlink {
  0%,
  92%,
  100% {
    opacity: 1;
  }
  94% {
    opacity: 0.05;
  }
  96% {
    opacity: 1;
  }
}

/* ————— 巨手 ————— */
.hand-layer {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 50%;
  width: min(340px, 34vw);
  height: 66%;
  margin-left: max(-170px, -17vw);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-46%) rotate(-5deg);
  transform-origin: 50% 0%;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.9));
}
.hand-layer .hand-svg {
  width: 100%;
  height: 100%;
}
.hand-layer.slam {
  animation: handSlam 1.1s cubic-bezier(0.34, 0.86, 0.3, 1) forwards;
}
.hand-layer.strike {
  animation: handStrike 0.92s cubic-bezier(0.4, 0.9, 0.3, 1) forwards;
}
@keyframes handSlam {
  0% {
    opacity: 0;
    transform: translateY(-52%) rotate(-9deg) scale(1.08);
  }
  16% {
    opacity: 1;
  }
  40% {
    opacity: 1;
    transform: translateY(16%) rotate(-2deg) scale(1);
  }
  50% {
    transform: translateY(13%) rotate(-2deg) scale(1.02);
  }
  100% {
    opacity: 0;
    transform: translateY(-52%) rotate(-7deg) scale(1.05);
  }
}
@keyframes handStrike {
  0% {
    opacity: 0;
    transform: translateY(-50%) rotate(6deg) scale(1.04);
  }
  20% {
    opacity: 1;
  }
  44% {
    opacity: 1;
    transform: translateY(20%) rotate(2deg) scale(1.02);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) rotate(5deg) scale(1.04);
  }
}

/* ————— 前景层 ————— */
.stage-front {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px 12px 0;
  gap: 8px;
}

.battle-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--c-line);
  flex: 0 0 auto;
  backdrop-filter: blur(6px);
}
.battle-top .chapter-name {
  font-size: 14px;
  letter-spacing: 0.1em;
}
.battle-top .turn-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  color: var(--c-text-dim);
  white-space: nowrap;
}
.battle-top .spacer {
  flex: 1;
}

.battle-body {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.side {
  width: 246px;
  flex: 0 0 246px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.table-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* ══════════════ 桌面 ══════════════ */
.table-stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 210px;
  perspective: 1000px;
  perspective-origin: 50% 26%;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.table-plane {
  position: absolute;
  left: -4%;
  right: -4%;
  top: 20%;
  bottom: 2%;
  transform: rotateX(64deg);
  transform-origin: 50% 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, #0b1322 0%, #070c16 60%, #05080f 100%);
  border: 1px solid rgba(120, 200, 240, 0.14);
  box-shadow: inset 0 0 90px rgba(70, 224, 255, 0.07), 0 40px 90px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}
.table-grid {
  position: absolute;
  inset: -20%;
  background-image: linear-gradient(rgba(70, 224, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 224, 255, 0.14) 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.5;
}
.table-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(120, 210, 255, 0.1), transparent 45%);
}
.table-glow {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 34%;
  bottom: 0;
  background: radial-gradient(60% 60% at 50% 60%, rgba(70, 224, 255, 0.16), transparent 72%);
  filter: blur(18px);
  z-index: 0;
}
.table-lip {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #101a2b, #060a12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(120, 200, 240, 0.22);
  z-index: 2;
}

/* 基准线：桌面中央的水平轴 */
.table-baseline {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 54%;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(70, 224, 255, 0.5) 0 1px, transparent 1px 46px),
    linear-gradient(90deg, transparent 1%, rgba(120, 235, 255, 1) 50%, transparent 99%);
  box-shadow: 0 0 24px rgba(70, 224, 255, 0.85), 0 0 60px rgba(70, 224, 255, 0.3);
  z-index: 5;
}

/* 柱子所在的横排（屏幕空间，因此始终正立可读） */
.candle-strip {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 34%;
  height: 40%;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 6;
}

.kc {
  position: relative;
  width: 34px;
  height: 100%;
  flex: 0 0 auto;
}
/* 基准线上的锚点阴影，让柱子看起来真的立在桌上 */
.kc::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.85), transparent 78%);
  z-index: 0;
}

.kc-bar {
  position: absolute;
  z-index: 2;
  left: 0;
  width: 34px;
  height: calc(var(--h, 40) * 0.5%);
  border-radius: 4px;
  transition: height 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.kc-wick {
  position: absolute;
  z-index: 1;
  left: 15px;
  width: 3px;
  height: calc(var(--h, 40) * 0.5% + 9%);
  opacity: 0.7;
}
.kc-tip {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 2px 8px #000, 0 0 14px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.02em;
}

/* 阳线：立在基准线之上，向上刺进大A 的黑暗 */
.kc.up .kc-bar {
  bottom: 50%;
  background: linear-gradient(90deg, #ff2b45, #ff7080 52%, #c8122c);
  box-shadow: 0 0 26px rgba(255, 59, 82, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.55);
  border-top: 3px solid #ffbcc4;
}
.kc.up .kc-wick {
  bottom: 50%;
  background: linear-gradient(180deg, #ff9aa6, rgba(255, 120, 140, 0.15));
}
.kc.up .kc-tip {
  bottom: calc(50% + var(--h, 40) * 0.5% + 1%);
  color: #ff9aa6;
}

/* 阴线：垂在基准线之下，扎进桌面 */
.kc.down .kc-bar {
  top: 50%;
  background: linear-gradient(90deg, #0bb87c, #4ef0b8 52%, #078a63);
  box-shadow: 0 0 26px rgba(18, 209, 142, 0.65), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  border-bottom: 3px solid #c4ffec;
}
.kc.down .kc-wick {
  top: 50%;
  background: linear-gradient(0deg, #6ff5c4, rgba(78, 240, 184, 0.15));
}
.kc.down .kc-tip {
  top: calc(50% + var(--h, 40) * 0.5% + 1%);
  color: #6ff5c4;
}

/* 未开的那根 */
.kc.pending .kc-bar {
  top: 20%;
  height: 60%;
  background: repeating-linear-gradient(
    45deg,
    rgba(170, 195, 225, 0.24) 0 7px,
    rgba(120, 150, 190, 0.12) 7px 14px
  );
  border: 2px dashed rgba(170, 205, 240, 0.6);
  box-shadow: 0 0 30px rgba(120, 180, 230, 0.3);
  animation: pendingPulse 2.2s ease-in-out infinite;
}
.kc.pending .kc-wick {
  display: none;
}
.kc.pending .kc-tip {
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: #cfe6ff;
  opacity: 0.85;
}
@keyframes pendingPulse {
  50% {
    box-shadow: 0 0 34px rgba(120, 180, 230, 0.5);
    border-color: rgba(200, 225, 255, 0.8);
  }
}

/* 黑手印：大A 要来砸盘 */
.kc-print {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  font-size: 26px;
  display: none;
  filter: drop-shadow(0 0 12px rgba(255, 0, 40, 0.95));
  animation: printPulse 1.4s ease-in-out infinite;
  z-index: 3;
}
@keyframes printPulse {
  50% {
    transform: translate(-50%, -50%) rotate(-14deg) scale(1.16);
    filter: drop-shadow(0 0 22px rgba(255, 30, 60, 1));
  }
}
.kc.rigged .kc-bar {
  border-color: rgba(255, 60, 90, 0.85);
  box-shadow: 0 0 26px rgba(255, 40, 70, 0.5);
}
.kc.empty {
  opacity: 0;
}

/* 最新一根更亮 */
.kc.latest .kc-bar {
  filter: brightness(1.25);
}

/* 桌面演出 */
.table-stage.slam {
  animation: tableShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes tableShake {
  10%,
  90% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(7px) scale(1.006);
  }
  50% {
    transform: translateY(-4px);
  }
  75% {
    transform: translateY(3px);
  }
}
.table-stage.smash .table-plane {
  animation: planeCrack 0.6s ease;
}
@keyframes planeCrack {
  0%,
  100% {
    filter: none;
  }
  30% {
    filter: brightness(1.9) saturate(0.4);
  }
}
.table-stage.reveal .candle-strip {
  animation: stripFlash 0.5s ease;
}
@keyframes stripFlash {
  0%,
  100% {
    filter: none;
  }
  40% {
    filter: brightness(2.1);
  }
}

/* ══════════════ 仓位 ══════════════ */
.position-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.position-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--c-text-faint);
}
.position-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 560px;
}
.pos-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 6px;
  border: 1px solid var(--c-line);
  background: linear-gradient(180deg, rgba(70, 224, 255, 0.06), rgba(8, 13, 22, 0.7));
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: all var(--t-fast);
  cursor: pointer;
}
.pos-btn:hover:not(:disabled) {
  border-color: var(--c-line-strong);
  background: linear-gradient(180deg, rgba(70, 224, 255, 0.16), rgba(8, 13, 22, 0.7));
  transform: translateY(-2px);
}
.pos-btn .pb-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.pos-btn .pb-hint {
  font-size: 10.5px;
  color: var(--c-text-faint);
  white-space: nowrap;
}
.pos-btn.on {
  border-color: var(--c-gold);
  background: linear-gradient(180deg, rgba(245, 196, 81, 0.24), rgba(245, 196, 81, 0.05));
  box-shadow: 0 0 22px rgba(245, 196, 81, 0.4);
}
.pos-btn.on .pb-name {
  color: #ffe9b0;
}
.pos-btn.on .pb-hint {
  color: rgba(255, 233, 176, 0.7);
}
.pos-btn.locked {
  opacity: 0.35;
}
.pos-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.pos-btn.on:disabled {
  opacity: 1;
}
/* 荐股助手推荐的仓位 */
.pos-btn.recommended {
  border-color: var(--c-gold);
  box-shadow: 0 0 0 1px rgba(245, 196, 81, 0.5), 0 0 22px rgba(245, 196, 81, 0.35);
  animation: posRec 1.8s ease-in-out infinite;
}
.pos-btn.recommended .pb-name {
  color: #fff3cf;
}
@keyframes posRec {
  50% {
    box-shadow: 0 0 0 1px rgba(245, 196, 81, 0.8), 0 0 30px rgba(245, 196, 81, 0.55);
  }
}
.pb-badge {
  position: absolute;
  top: -10px;
  left: -8px;
  width: 22px;
  height: 25px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(180deg, #ffe9a8, #e0a92b);
  color: #241704;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(245, 196, 81, 0.8);
  z-index: 3;
}

/* ══════════════ 浮层 / 飘字 ══════════════ */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.overlay-host {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: none;
  pointer-events: none;
}
.overlay-host:not(:empty) {
  display: block;
  pointer-events: auto;
}

/* ══════════════ 面板与日志 ══════════════ */
.side .stat-block {
  padding: 10px 12px 12px;
}
.side .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 2px 0;
}
.side .row .k {
  color: var(--c-text-faint);
  font-size: 12px;
}
.side .row .v {
  font-family: var(--font-mono);
  font-weight: 600;
}
.side .big-hp {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.side .big-hp small {
  font-size: 13px;
  color: var(--c-text-faint);
  margin-left: 3px;
}

.funds {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 4px;
}
.funds .pip {
  width: 15px;
  height: 17px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: rgba(255, 255, 255, 0.08);
  transition: all var(--t-fast);
}
.funds .pip.on {
  background: linear-gradient(180deg, #ffe08a, #e0a92b);
  box-shadow: 0 0 10px rgba(245, 196, 81, 0.75);
}

.enemy-card {
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.enemy-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(100% 60% at 50% 0%, hsl(var(--eh) 85% 55% / 0.22), transparent 70%);
  pointer-events: none;
}
.enemy-portrait {
  position: relative;
  width: 74px;
  height: 88px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.enemy-portrait .ep-sil {
  position: absolute;
  inset: -6% -10% -10%;
  animation: silFloat 5.5s ease-in-out infinite;
}
.enemy-portrait .ep-sil svg {
  width: 100%;
  height: 100%;
}
.enemy-portrait .ep-sigil {
  position: absolute;
  right: -8px;
  bottom: -4px;
  width: 32px;
  height: 36px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(180deg, hsl(var(--eh) 85% 60%), hsl(var(--eh) 90% 32%));
  color: #0d0207;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 0 16px hsl(var(--eh) 90% 55% / 0.7);
}
.enemy-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.enemy-name {
  font-size: 16px;
  font-weight: 600;
}
.enemy-epithet {
  font-size: 11.5px;
  color: var(--c-text-faint);
}
.intent-box {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 59, 82, 0.35);
  border-radius: var(--r-sm);
  background: rgba(255, 59, 82, 0.08);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.intent-box.move {
  border-color: var(--c-line-strong);
  background: rgba(70, 224, 255, 0.06);
}
.intent-box .intent-label {
  font-weight: 600;
}
.intent-box .intent-dmg {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--c-red-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--c-line);
  color: var(--c-text-dim);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.chip.gold {
  border-color: rgba(245, 196, 81, 0.5);
  color: var(--c-gold);
  background: rgba(245, 196, 81, 0.08);
}
.legend-inline {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-text-faint);
  letter-spacing: 0.08em;
}

.log-box {
  flex: 1;
  min-height: 84px;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.7;
}
.log-box .line {
  padding: 1px 0;
  color: var(--c-text-dim);
}
.log-box .line.good {
  color: var(--c-green-soft);
}
.log-box .line.bad {
  color: #ff8b98;
}
.log-box .line.combo {
  color: var(--c-gold);
  font-weight: 600;
}
.log-box .line.market {
  color: var(--c-cyan);
  letter-spacing: 0.08em;
}

/* ————— 荐股助手 ————— */
.advisor {
  padding: 10px 12px 12px;
  border-color: rgba(245, 196, 81, 0.28);
  background: linear-gradient(180deg, rgba(245, 196, 81, 0.07), rgba(10, 14, 22, 0.9));
}
.advisor .panel-title::after {
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}
.advice-situation {
  font-size: 12.5px;
  line-height: 1.75;
  margin: 8px 0 0;
}
.advice-action {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed rgba(245, 196, 81, 0.25);
  font-size: 12.5px;
  line-height: 1.7;
  color: #ffe9b0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.advice-tag {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 2px;
  background: rgba(245, 196, 81, 0.9);
  color: #241704;
  font-weight: 700;
  margin-top: 2px;
}

.tutorial {
  padding: 10px 14px;
  border-left: 2px solid var(--c-cyan);
  background: rgba(70, 224, 255, 0.06);
  font-size: 12.5px;
  line-height: 1.7;
  color: #bfe6f5;
  overflow-wrap: anywhere;
}
.tutorial b {
  color: var(--c-cyan);
}

/* ————— 手牌 ————— */
.hand-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  min-height: 196px;
  padding: 4px 12px 10px;
  position: relative;
}
.hand-inner {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}
.hand-actions {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.pile-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-text-faint);
  text-align: right;
}
.end-turn-btn {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  border-color: var(--c-gold);
  background: linear-gradient(180deg, rgba(245, 196, 81, 0.24), rgba(245, 196, 81, 0.06));
  color: #ffe9b0;
}
.end-turn-btn:hover:not(:disabled) {
  box-shadow: 0 0 24px rgba(245, 196, 81, 0.55);
}
.end-turn-btn.urgent {
  animation: urgentPulse 1.4s ease-in-out infinite;
}
@keyframes urgentPulse {
  50% {
    box-shadow: 0 0 26px rgba(245, 196, 81, 0.7);
  }
}
.autopilot-btn {
  border-color: var(--c-gold);
  color: var(--c-gold);
}
.autopilot-btn:hover:not(:disabled) {
  background: rgba(245, 196, 81, 0.16);
  box-shadow: 0 0 14px rgba(245, 196, 81, 0.4);
}
.btn.on {
  border-color: var(--c-cyan);
  color: var(--c-cyan);
  box-shadow: 0 0 12px rgba(70, 224, 255, 0.28);
}

/* ————— 结果 / 暂停 ————— */
.result-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(60% 60% at 50% 50%, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.94));
  z-index: 100;
  animation: sceneIn 0.4s ease;
}
.result-title {
  font-size: 42px;
  letter-spacing: 0.3em;
  font-weight: 700;
  margin-bottom: 8px;
}
.result-title.win {
  color: var(--c-green-soft);
  text-shadow: 0 0 34px rgba(18, 209, 142, 0.7);
}
.result-title.lose {
  color: var(--c-red);
  text-shadow: 0 0 34px rgba(255, 59, 82, 0.7);
}
.result-stats {
  display: flex;
  gap: 26px;
  justify-content: center;
  margin: 20px 0 26px;
}
.result-stats .rs {
  text-align: center;
}
.result-stats .rs .n {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
}
.result-stats .rs .l {
  font-size: 11px;
  color: var(--c-text-faint);
  letter-spacing: 0.1em;
}

.combo-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 90;
  animation: comboIn 1.7s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.combo-banner .cb-name {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--c-gold);
  text-shadow: 0 0 30px rgba(245, 196, 81, 0.9), 0 4px 14px #000;
}
.combo-banner .cb-desc {
  margin-top: 6px;
  font-size: 14px;
  color: #ffe9b0;
  text-shadow: 0 2px 8px #000;
}
@keyframes comboIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  30% {
    transform: translate(-50%, -50%) scale(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(1);
  }
}

/* ══════════════ 响应式 ══════════════ */
@media (max-width: 1180px) {
  .side {
    width: 210px;
    flex-basis: 210px;
  }
  .card {
    width: 138px;
    min-height: 196px;
  }
}

@media (max-width: 960px) {
  .battle {
    overflow-y: auto;
  }
  .stage-front {
    height: auto;
    min-height: 100%;
    padding: 6px;
  }
  .battle-body {
    flex: 0 0 auto;
    flex-direction: column;
    overflow: visible;
  }
  .side {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
  }
  .side > * {
    flex: 1 1 260px;
    min-width: 0;
  }
  .table-col {
    order: -1;
    flex: 0 0 auto;
    width: 100%;
  }
  .table-stage {
    min-height: 260px;
    flex: 0 0 auto;
    height: 300px;
  }
  .biga-layer {
    height: 46%;
  }
  .hand-layer {
    width: 200px;
    margin-left: -100px;
    height: 44%;
  }
  .log-box {
    max-height: 84px;
  }
  .hand-bar {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-height: auto;
    padding-bottom: 8px;
  }
  .hand-inner {
    gap: 7px;
    justify-content: center;
  }
  .hand-actions {
    position: static;
    flex-direction: row;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
  }
  .pile-counter {
    margin-right: auto;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .hide-sm {
    display: none !important;
  }
  .battle-top {
    gap: 8px;
    padding: 4px 6px;
    flex-wrap: wrap;
  }
  .battle-top .chapter-name {
    font-size: 12px;
  }
  .side > * {
    flex: 1 1 100%;
  }
  .table-stage {
    height: 240px;
    min-height: 240px;
  }
  .position-row {
    gap: 6px;
  }
  .pos-btn {
    padding: 7px 3px;
  }
  .pos-btn .pb-name {
    font-size: 14px;
  }
  .pos-btn .pb-hint {
    font-size: 9px;
  }
  .card {
    width: 116px;
    min-height: 160px;
    padding: 6px 7px;
  }
  .card-art {
    height: 30px;
    font-size: 17px;
  }
  .card-text {
    font-size: 10.5px;
  }
  .card-flavor,
  .card-kind {
    display: none;
  }
  .card-name {
    font-size: 12px;
    min-height: 18px;
  }
  .card-cost {
    width: 25px;
    height: 28px;
    font-size: 13px;
    top: -6px;
    right: -6px;
  }
  .big-hp {
    font-size: 22px;
  }
  .market-banner {
    font-size: 11px;
    padding: 5px 8px;
    gap: 6px;
  }
  .market-banner .mb-sub {
    font-size: 9.5px;
  }
  .log-box {
    max-height: 62px;
  }
}

@media (max-width: 430px) {
  .card {
    width: 100px;
    min-height: 146px;
  }
  .hand-inner {
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .biga-layer,
  .kc.pending .kc-bar,
  .kc-print {
    animation: none !important;
  }
}

/* ==================== scenes.css ==================== */
/* ————————————————— 标题 ————————————————— */
.title-screen {
  display: grid;
  place-items: center;
  overflow: hidden;
}
.title-bg {
  position: absolute;
  inset: 0;
  opacity: 0.55;
}
.title-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
}
.title-logo {
  font-size: clamp(46px, 9vw, 104px);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  background: linear-gradient(180deg, #fff 10%, #ff6b7d 55%, #7a0e1f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(255, 59, 82, 0.55));
  position: relative;
}
.title-logo::after {
  content: '股神异闻录';
  position: absolute;
  inset: 0;
  color: var(--c-cyan);
  -webkit-background-clip: initial;
  background: none;
  opacity: 0;
  animation: logoGlitch 6s steps(1) infinite;
  mix-blend-mode: screen;
}
@keyframes logoGlitch {
  0%,
  92%,
  100% {
    opacity: 0;
    transform: none;
  }
  93% {
    opacity: 0.85;
    transform: translate(-3px, 2px);
  }
  95% {
    opacity: 0.6;
    transform: translate(3px, -2px);
  }
  97% {
    opacity: 0.8;
    transform: translate(-2px, -1px);
  }
}
.title-en {
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.6vw, 14px);
  letter-spacing: 0.62em;
  color: var(--c-text-faint);
  margin-top: 10px;
  padding-left: 0.62em;
}
.title-tag {
  margin: 22px auto 0;
  max-width: 560px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--c-text-dim);
}
.title-tag em {
  color: var(--c-gold);
  font-style: normal;
}
.title-menu {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 288px;
  margin-left: auto;
  margin-right: auto;
}

/* ————— 难度选择 ————— */
.mode-picker {
  margin: 22px auto 0;
  width: 288px;
  padding: 12px 14px 14px;
  border: 1px solid rgba(70, 224, 255, 0.24);
  background: linear-gradient(180deg, rgba(70, 224, 255, 0.07), rgba(8, 13, 22, 0.8));
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.mode-head {
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--c-text-faint);
  margin-bottom: 9px;
}
.mode-chips {
  display: flex;
  gap: 6px;
}
.mode-chip {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid var(--c-line);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all var(--t-fast);
  cursor: pointer;
}
.mode-chip:hover {
  border-color: var(--c-line-strong);
  background: rgba(70, 224, 255, 0.08);
}
.mode-chip.on {
  border-color: var(--c-cyan);
  background: rgba(70, 224, 255, 0.16);
  box-shadow: 0 0 16px rgba(70, 224, 255, 0.35);
}
.mode-chip .mc-name {
  font-size: 12px;
  color: var(--c-text);
  white-space: nowrap;
}
.mode-chip.on .mc-name {
  color: #fff;
  font-weight: 600;
}
.mode-chip .mc-stat {
  font-size: 9.5px;
  color: var(--c-text-faint);
}
.mode-desc {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--c-text-dim);
  min-height: 3.4em;
}

/* ————— 3D 透视地面 ————— */
.title-floor {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: -6%;
  height: 46%;
  perspective: 340px;
  perspective-origin: 50% 0%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  mask-image: linear-gradient(to top, #000 0%, transparent 92%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 92%);
}
.floor-grid {
  position: absolute;
  inset: -60% -20% -20%;
  background-image: linear-gradient(rgba(70, 224, 255, 0.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 224, 255, 0.42) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotateX(72deg);
  animation: floorScroll 3.6s linear infinite;
}
@keyframes floorScroll {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 0 64px, 0 0;
  }
}
.title-meta {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-text-faint);
  letter-spacing: 0.1em;
  z-index: 2;
}
.title-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(70, 224, 255, 0.6), transparent);
  animation: scanDown 7s linear infinite;
  z-index: 1;
  pointer-events: none;
}
@keyframes scanDown {
  from {
    top: -2%;
  }
  to {
    top: 102%;
  }
}

/* ————————————————— 影片式开场 ————————————————— */
.cinema {
  display: grid;
  place-items: center;
  background: #000;
}
.cinema canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.cinema .cap {
  position: relative;
  z-index: 2;
  max-width: 760px;
  padding: 0 26px;
  text-align: center;
  font-size: clamp(15px, 2.4vw, 22px);
  line-height: 2;
  letter-spacing: 0.06em;
  color: #eaf4ff;
  text-shadow: 0 4px 28px #000, 0 0 60px rgba(0, 0, 0, 0.9);
  min-height: 3em;
}
.cinema .cap.small {
  font-size: clamp(12px, 1.6vw, 15px);
  color: var(--c-text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.24em;
}
.cinema .skip {
  position: absolute;
  right: 22px;
  bottom: 20px;
  z-index: 3;
  font-size: 12px;
  letter-spacing: 0.14em;
}
.cinema-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 70% at 50% 50%, transparent 30%, rgba(0, 0, 0, 0.86) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ————————————————— 视觉小说 ————————————————— */
.vn {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.vn-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.vn-bg canvas {
  width: 100%;
  height: 100%;
}
.vn-place {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--c-text-dim);
  padding: 5px 18px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: rgba(6, 10, 18, 0.7);
}
.vn-chapter {
  position: absolute;
  top: 18px;
  left: 26px;
  z-index: 3;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--c-gold);
  opacity: 0.85;
}
.vn-backlog-btn {
  position: absolute;
  top: 16px;
  right: 22px;
  z-index: 4;
}

.vn-portrait {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -78%);
  z-index: 2;
  width: 240px;
  height: 264px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: radial-gradient(70% 70% at 50% 30%, hsl(var(--hue) 80% 60% / 0.4), transparent 72%);
  transition: opacity var(--t-mid), transform var(--t-mid);
}
.vn-portrait .glyph {
  font-size: 92px;
  font-weight: 800;
  color: hsl(var(--hue) 85% 70%);
  text-shadow: 0 0 50px hsl(var(--hue) 90% 55% / 0.9), 0 6px 24px #000;
  opacity: 0.92;
}
.vn-portrait .sil {
  position: absolute;
  inset: 1% 3% -4%;
  display: grid;
  place-items: end center;
  animation: silFloat 5s ease-in-out infinite;
}
.vn-portrait .sil svg {
  width: 100%;
  height: 100%;
}
@keyframes silFloat {
  50% {
    transform: translateY(-8px);
  }
}
.vn-portrait.in {
  animation: portraitIn 0.44s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes portraitIn {
  from {
    opacity: 0;
    transform: translate(-50%, -70%) scale(0.9);
  }
}

.vn-box {
  position: relative;
  z-index: 5;
  margin: 0 auto 26px;
  width: min(1020px, calc(100% - 40px));
  padding: 22px 30px 24px;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.94), rgba(4, 7, 13, 0.985));
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
  min-height: 172px;
  cursor: pointer;
}
.vn-plate {
  position: absolute;
  top: -17px;
  left: 26px;
  padding: 5px 20px;
  background: linear-gradient(180deg, hsl(var(--hue, 196) 55% 20%), rgba(6, 10, 18, 0.98));
  border: 1px solid hsl(var(--hue, 196) 80% 60% / 0.65);
  border-radius: var(--r-sm);
  font-size: 15px;
  letter-spacing: 0.14em;
  color: hsl(var(--hue, 196) 90% 78%);
  box-shadow: 0 0 20px hsl(var(--hue, 196) 90% 55% / 0.3);
}
.vn-role {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--c-text-faint);
}
.vn-text {
  font-size: 17px;
  line-height: 2;
  letter-spacing: 0.03em;
  color: #e6f0fa;
  min-height: 4em;
  white-space: pre-wrap;
}
.vn-text .cursor {
  display: inline-block;
  width: 9px;
  height: 19px;
  background: var(--c-cyan);
  vertical-align: -3px;
  margin-left: 3px;
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.vn-next {
  position: absolute;
  right: 24px;
  bottom: 12px;
  font-size: 18px;
  color: var(--c-cyan);
  animation: bobY2 1.2s ease-in-out infinite;
}
@keyframes bobY2 {
  50% {
    transform: translateY(5px);
  }
}
.vn-mood-shock {
  border-color: rgba(255, 59, 82, 0.6);
  box-shadow: 0 0 44px rgba(255, 59, 82, 0.24), 0 20px 60px rgba(0, 0, 0, 0.75);
}
.vn-mood-dark {
  border-color: rgba(160, 107, 255, 0.5);
}
.vn-mood-warm {
  border-color: rgba(245, 196, 81, 0.5);
}
.vn-mood-cold {
  border-color: rgba(70, 224, 255, 0.45);
}

/* 抉择 */
.vn-choices {
  position: relative;
  z-index: 6;
  width: min(1020px, calc(100% - 40px));
  margin: 0 auto 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vn-choice {
  position: relative;
  text-align: left;
  padding: 14px 20px;
  background: linear-gradient(90deg, rgba(70, 224, 255, 0.09), rgba(70, 224, 255, 0.015));
  border: 1px solid rgba(70, 224, 255, 0.3);
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
  font-size: 15px;
  cursor: pointer;
}
.vn-choice:hover {
  border-color: var(--c-cyan);
  background: linear-gradient(90deg, rgba(70, 224, 255, 0.2), rgba(70, 224, 255, 0.04));
  transform: translateX(6px);
  box-shadow: -4px 0 0 0 var(--c-cyan);
}
.vn-choice .hint {
  display: block;
  font-size: 12px;
  color: var(--c-text-faint);
  margin-top: 3px;
  font-family: var(--font-mono);
}
.vn-prompt {
  position: relative;
  z-index: 6;
  width: min(1020px, calc(100% - 40px));
  margin: 0 auto 12px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--c-gold);
}

/* 回想 */
.backlog {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(3, 5, 10, 0.95);
  overflow-y: auto;
  padding: 40px 24px 90px;
  animation: sceneIn 0.24s ease;
}
.backlog .bl-line {
  max-width: 860px;
  margin: 0 auto 16px;
  font-size: 15px;
  line-height: 1.9;
}
.backlog .bl-who {
  color: hsl(var(--hue) 85% 72%);
  font-size: 13px;
  letter-spacing: 0.14em;
  margin-bottom: 3px;
}
.backlog .bl-body {
  color: var(--c-text-dim);
}

/* ————————————————— 章节地图 ————————————————— */
.map-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 22px;
  gap: 14px;
  overflow: hidden;
}
.map-head {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.map-head .ch-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.map-head .ch-sub {
  font-size: 14px;
  color: var(--c-gold);
  letter-spacing: 0.2em;
}
.map-head .spacer {
  flex: 1;
}
.map-body {
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
}
.map-track-wrap {
  flex: 1;
  overflow: auto;
  padding: 26px 8px;
  display: flex;
  align-items: center;
  min-width: 0;
}
.map-track {
  display: flex;
  align-items: center;
  gap: 0;
  margin: auto;
}
.map-node {
  position: relative;
  width: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: default;
}
.map-node .node-dot {
  position: relative;
  width: 60px;
  height: 66px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: rgba(20, 28, 42, 0.95);
  border: 0;
  font-size: 20px;
  color: var(--c-text-faint);
  transition: all var(--t-mid);
}
.map-node.done .node-dot {
  background: linear-gradient(180deg, rgba(18, 209, 142, 0.5), rgba(18, 209, 142, 0.15));
  color: #d6fff0;
}
.map-node.current .node-dot {
  background: linear-gradient(180deg, hsl(var(--hue) 85% 60%), hsl(var(--hue) 90% 34%));
  color: #08040c;
  box-shadow: 0 0 26px hsl(var(--hue) 90% 55% / 0.75);
  animation: nodePulse 2s ease-in-out infinite;
}
@keyframes nodePulse {
  50% {
    box-shadow: 0 0 44px hsl(var(--hue) 90% 60% / 0.95);
    transform: scale(1.05);
  }
}
.map-node .node-name {
  font-size: 12.5px;
  text-align: center;
  color: var(--c-text-dim);
  line-height: 1.4;
}
.map-node.current .node-name {
  color: #fff;
  font-weight: 600;
}
.map-node .node-kind {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--c-text-faint);
}
.map-link {
  width: 44px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  flex: 0 0 auto;
  position: relative;
  top: -22px;
}
.map-link.done {
  background: linear-gradient(90deg, rgba(18, 209, 142, 0.7), rgba(18, 209, 142, 0.3));
}

.map-side {
  width: 290px;
  flex: 0 0 290px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.side-card {
  padding: 12px 14px 14px;
}
.side-card h4 {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--c-text-faint);
  font-family: var(--font-mono);
  margin-bottom: 9px;
}

/* ————————————————— 奖励 / 复盘 ————————————————— */
.reward-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  overflow-y: auto;
}
/* margin:auto 在内容较短时居中，内容过长时不会裁掉顶部 */
.reward-inner {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.reward-title {
  font-size: 26px;
  letter-spacing: 0.24em;
  color: var(--c-gold);
  text-shadow: 0 0 26px rgba(245, 196, 81, 0.5);
}
.reward-sub {
  font-size: 13.5px;
  color: var(--c-text-dim);
  max-width: 620px;
  text-align: center;
  line-height: 1.8;
}
.reward-cards {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 22px 0 6px;
}
.reward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  width: min(900px, 100%);
}
.reward-option {
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(70, 224, 255, 0.08), rgba(10, 16, 26, 0.9));
  transition: all var(--t-fast);
  cursor: pointer;
}
.reward-option:hover {
  border-color: var(--c-cyan);
  box-shadow: var(--sh-glow-cyan);
  transform: translateY(-2px);
}
.reward-option.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.reward-option .ro-name {
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 5px;
}
.reward-option .ro-desc {
  font-size: 12.5px;
  color: var(--c-text-dim);
  line-height: 1.65;
}
.reward-option .ro-cost {
  float: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-gold);
}

/* ————————————————— 卡组 ————————————————— */
.deck-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 22px;
  gap: 14px;
  overflow: hidden;
}
.deck-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.deck-head h2 {
  font-size: 22px;
  letter-spacing: 0.12em;
}
.deck-body {
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
}
.deck-list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 10px;
  align-content: start;
  padding-right: 4px;
}
.deck-side {
  width: 260px;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.kind-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0 10px;
}
.kind-bar > i {
  display: block;
  height: 100%;
}

/* ————————————————— 图鉴 ————————————————— */
.codex-screen {
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px 60px;
}
.codex-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.codex-head h2 {
  font-size: 24px;
  letter-spacing: 0.16em;
}
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.codex-card {
  padding: 14px;
  display: flex;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.cx-art {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 118px;
  display: grid;
  place-items: center;
}
.cx-art .cx-sil {
  position: absolute;
  inset: 0;
  animation: silFloat 6s ease-in-out infinite;
}
.cx-art .cx-sil svg {
  width: 100%;
  height: 100%;
}
.cx-art .cx-locked {
  font-size: 40px;
  color: var(--c-text-faint);
  opacity: 0.5;
}
.codex-card.locked {
  filter: grayscale(1) brightness(0.5);
}
.codex-card .cx-body {
  flex: 1;
  min-width: 0;
}
.codex-card .cx-name {
  font-size: 16px;
  font-weight: 600;
}
.codex-card .cx-ep {
  font-size: 11.5px;
  color: var(--c-text-faint);
  margin-bottom: 7px;
}
.codex-card .cx-lore {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--c-text-dim);
}
.codex-card .cx-stats {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin: 7px 0;
  color: var(--c-text-faint);
}
.codex-card .cx-skill {
  font-size: 12px;
  color: var(--c-gold);
  margin-top: 4px;
}

/* ————————————————— 设置 ————————————————— */
.settings-screen {
  height: 100%;
  overflow-y: auto;
  display: grid;
  place-items: center;
  padding: 24px;
}
.settings-inner {
  width: min(560px, 100%);
  padding: 24px 26px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.setting-row:last-of-type {
  border-bottom: none;
}
.setting-row .sr-label {
  font-size: 14px;
}
.setting-row .sr-desc {
  font-size: 11.5px;
  color: var(--c-text-faint);
  margin-top: 2px;
}

/* ————————————————— 结局 ————————————————— */
.ending-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 24px;
  overflow-y: auto;
  background: radial-gradient(60% 60% at 50% 40%, hsl(var(--hue) 60% 22% / 0.5), transparent 72%);
}
.ending-inner {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.ending-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.4em;
  color: hsl(var(--hue) 80% 70%);
  margin-bottom: 14px;
}
.ending-title {
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #fff;
  text-shadow: 0 0 40px hsl(var(--hue) 90% 55% / 0.8);
  text-align: center;
}
.ending-sub {
  margin-top: 10px;
  font-size: 16px;
  letter-spacing: 0.3em;
  color: hsl(var(--hue) 80% 72%);
}
.ending-text {
  width: min(760px, 100%);
  margin: 30px 0;
  font-size: 15.5px;
  line-height: 2.1;
  color: #dbe7f2;
  white-space: pre-wrap;
}
.ending-text .e-who {
  color: hsl(var(--hue) 80% 72%);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  display: block;
  margin-top: 12px;
}
.ending-stats {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 26px;
}
.ending-stats .es {
  text-align: center;
}
.ending-stats .es .n {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--c-gold);
}
.ending-stats .es .l {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--c-text-faint);
}

/* ————————————————— 帮助 ————————————————— */
.help-screen {
  height: 100%;
  overflow-y: auto;
  padding: 26px 24px 70px;
}
.help-inner {
  width: min(860px, 100%);
  margin: 0 auto;
}
.help-inner h2 {
  font-size: 24px;
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}
.help-inner h3 {
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--c-cyan);
  margin: 26px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--c-cyan);
}
.help-inner p,
.help-inner li {
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--c-text-dim);
}
.help-inner li {
  padding-left: 16px;
  position: relative;
}
.help-inner li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--c-cyan);
}
.help-inner b {
  color: var(--c-text);
}
.help-kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 14px;
  font-size: 13px;
  margin: 8px 0;
}
.help-kv .k {
  color: var(--c-gold);
  font-family: var(--font-mono);
}
.help-kv .v {
  color: var(--c-text-dim);
  line-height: 1.8;
}

@media (max-width: 900px) {
  .map-body {
    flex-direction: column;
  }
  .map-side {
    width: 100%;
    flex-basis: auto;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .map-side > * {
    flex: 1 1 200px;
  }
  .deck-body {
    flex-direction: column;
  }
  .deck-side {
    width: 100%;
    flex-basis: auto;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .deck-side > * {
    flex: 1 1 200px;
  }
  .vn-portrait {
    width: 170px;
    height: 188px;
    transform: translate(-50%, -84%);
  }
  .vn-portrait .glyph {
    font-size: 62px;
  }
  .vn-text {
    font-size: 15px;
  }
  .vn-box {
    padding: 18px 18px 20px;
    min-height: 150px;
    margin-bottom: 14px;
  }
}