/* ===== 16-bit 复古字体 ===== */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=ZCOOL+KuaiLe&family=ZCOOL+QingKe+HuangYou&display=swap');

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

:root {
  --c-purple-deep: #2a0a4a;
  --c-purple: #5a1a8a;
  --c-purple-light: #9a4dd0;
  --c-gold: #f5c842;
  --c-red: #d32f2f;
  --c-white: #f5f5f0;
  --c-black: #0a0612;
  --c-gray: #6a6878;
  --c-bg: #100818;
  --pixel-font: 'Press Start 2P', monospace;
  --cn-font: 'ZCOOL KuaiLe', sans-serif;
  --impact-font: 'ZCOOL QingKe HuangYou', sans-serif;
}

html, body {
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: var(--cn-font);
  color: var(--c-white);
  user-select: none;
  cursor: default;
}

#game {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #1a0a2a 0%, #000 80%),
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(0,0,0,0.15) 3px, rgba(0,0,0,0.15) 4px);
  position: relative;
  image-rendering: pixelated;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.screen.active { display: flex; }

/* ===================== 标题屏 ===================== */
#title-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(154,77,208,0.3) 0%, transparent 70%),
    linear-gradient(180deg, #0a0612 0%, #2a0a4a 50%, #0a0612 100%);
}

.title-content { text-align: center; animation: titleFadeIn 1.5s ease; }

@keyframes titleFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-title {
  font-family: var(--pixel-font);
  font-size: clamp(36px, 7vw, 80px);
  color: var(--c-gold);
  text-shadow:
    4px 4px 0 var(--c-purple-deep),
    8px 8px 0 var(--c-red),
    0 0 30px rgba(245,200,66,0.5);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
  0%,100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.game-subtitle {
  font-family: var(--cn-font);
  font-size: clamp(24px, 3vw, 36px);
  color: var(--c-purple-light);
  text-shadow: 2px 2px 0 var(--c-black);
  letter-spacing: 0.3em;
  margin-bottom: 40px;
}

.chapter-tag {
  display: inline-block;
  font-size: 18px;
  padding: 8px 24px;
  border: 3px solid var(--c-gold);
  background: rgba(42,10,74,0.6);
  color: var(--c-gold);
  margin-bottom: 60px;
  letter-spacing: 0.2em;
}

.press-start {
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--c-white);
  animation: blink 1s steps(2) infinite;
  cursor: pointer;
  padding: 12px 24px;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.press-start:hover {
  border-color: var(--c-gold);
  background: rgba(245,200,66,0.1);
}

@keyframes blink {
  50% { opacity: 0.3; }
}

.copyright {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--c-gray);
}

/* ===================== 剧情屏（分镜改造） ===================== */
#story-screen {
  background: var(--c-black);
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.story-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-image:
    radial-gradient(ellipse at 50% 20%, rgba(245,200,66,0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 70%, rgba(154,77,208,0.35) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(154,77,208,0.25) 0%, transparent 50%),
    linear-gradient(180deg, #0a0612 0%, #1a0628 30%, #2a0a4a 70%, #100818 100%);
  filter: brightness(0.8) contrast(1.1);
  z-index: 1;
}

.story-bg::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(180deg, transparent, #1a3a1a 60%, #0a200a);
  opacity: 0.5;
}

/* 剧情立绘（左右两侧） */
.story-portrait {
  position: absolute;
  bottom: 28%;
  width: clamp(320px, 40vw, 560px);
  height: clamp(320px, 40vw, 560px);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom;
  z-index: 3;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.1);
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.8));
  opacity: 0;
  transform: translateY(40px) scale(0.95);
}

.story-portrait.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: drop-shadow(0 10px 30px rgba(245,200,66,0.4)) drop-shadow(0 0 20px rgba(154,77,208,0.3));
}

.story-portrait.inactive {
  opacity: 0.35;
  filter: grayscale(0.6) brightness(0.5) drop-shadow(0 10px 20px rgba(0,0,0,0.8));
}

.story-portrait.left { left: 3%; }
.story-portrait.right { right: 3%; }

/* 闪光+摇晃（关键台词） */
.story-portrait.emphasize {
  animation: portraitEmphasize 0.6s ease;
}
@keyframes portraitEmphasize {
  0%,100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-10px) scale(1.05); filter: drop-shadow(0 10px 30px rgba(245,200,66,0.8)) brightness(1.3); }
}

.story-rain {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(105deg, transparent 0, transparent 8px, rgba(154,77,208,0.15) 8px, rgba(154,77,208,0.15) 9px);
  animation: rainFall 0.5s linear infinite;
  opacity: 0.5;
}

@keyframes rainFall {
  from { background-position: 0 0; }
  to { background-position: 30px 100px; }
}

/* 闪电 */
.lightning {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: white;
  opacity: 0;
  pointer-events: none;
}
.lightning.flash { animation: lightningFlash 0.5s; }
@keyframes lightningFlash {
  0%,100% { opacity: 0; }
  10% { opacity: 0.8; }
  20% { opacity: 0.1; }
  30% { opacity: 0.6; }
  40% { opacity: 0; }
}

.dialog-box {
  position: relative;
  z-index: 6;
  margin: 16px;
  padding: 20px 28px;
  background: linear-gradient(180deg, rgba(26,10,42,0.95) 0%, rgba(42,10,74,0.95) 100%);
  border: 4px solid var(--c-gold);
  border-radius: 4px;
  min-height: 130px;
  box-shadow:
    inset 0 0 0 2px var(--c-purple-deep),
    0 0 30px rgba(0,0,0,0.9);
  backdrop-filter: blur(4px);
}

.dialog-name {
  display: inline-block;
  position: absolute;
  top: -16px;
  left: 24px;
  background: var(--c-gold);
  color: var(--c-purple-deep);
  font-weight: bold;
  padding: 4px 16px;
  font-size: 16px;
  letter-spacing: 0.1em;
  font-family: var(--impact-font);
  box-shadow: 2px 2px 0 var(--c-red);
}

.dialog-text {
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.8;
  color: var(--c-white);
  min-height: 70px;
  letter-spacing: 0.05em;
}

.dialog-next {
  position: absolute;
  bottom: 8px;
  right: 16px;
  color: var(--c-gold);
  animation: blink 0.8s steps(2) infinite;
  font-size: 16px;
}

/* ===================== 战斗屏 ===================== */
#battle-screen {
  flex-direction: column;
  background:
    linear-gradient(180deg, #0a0612 0%, #2a0a4a 60%, #1a0a2a 100%);
  position: relative;
}

.battle-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(245,200,66,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(26,80,26,0.3) 0%, transparent 70%),
    repeating-linear-gradient(90deg, transparent 0, transparent 40px, rgba(154,77,208,0.05) 40px, rgba(154,77,208,0.05) 41px);
  z-index: 0;
}

/* 草坪 */
.battle-bg::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20%;
  background:
    linear-gradient(180deg, transparent, #1a4a1a 30%, #0a200a),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 30px, transparent 30px 60px);
}

/* 看台灯光 */
.battle-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background:
    radial-gradient(circle at 20% 0%, rgba(245,200,66,0.3) 0%, transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(245,200,66,0.3) 0%, transparent 30%),
    radial-gradient(circle at 50% 0%, rgba(245,200,66,0.2) 0%, transparent 40%);
}

.battle-stage {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 30px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.battle-fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 280px;
  animation: fighterIn 0.6s ease;
}

.battle-fighter.left { animation-name: fighterInLeft; }
.battle-fighter.right { animation-name: fighterInRight; }

@keyframes fighterInLeft {
  from { opacity: 0; transform: translateX(-100px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fighterInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

.fighter-portrait {
  width: 240px;
  height: 240px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border: 4px solid var(--c-gold);
  background-color: rgba(0,0,0,0.4);
  box-shadow:
    inset 0 0 20px rgba(0,0,0,0.6),
    0 0 20px rgba(245,200,66,0.3);
  margin-bottom: 12px;
  position: relative;
  transition: transform 0.2s;
}

.fighter-portrait.shake { animation: shake 0.4s; }
.fighter-portrait.hit { animation: hit 0.5s; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-10px); }
  40%,80% { transform: translateX(10px); }
}
@keyframes hit {
  0%,100% { filter: brightness(1); }
  30% { filter: brightness(3) hue-rotate(0deg); }
  60% { filter: brightness(0.5); }
}

.fighter-name {
  font-size: 22px;
  color: var(--c-white);
  text-shadow: 2px 2px 0 var(--c-black);
  margin-bottom: 8px;
  letter-spacing: 0.1em;
  font-family: var(--impact-font);
}

.fighter-hp, .fighter-energy {
  width: 240px;
  margin-bottom: 6px;
}

.hp-label, .energy-label {
  font-size: 12px;
  color: var(--c-purple-light);
  display: block;
  margin-bottom: 2px;
}

.hp-bar {
  height: 16px;
  background: var(--c-black);
  border: 2px solid var(--c-purple-light);
  position: relative;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-gold) 0%, #ffeb3b 100%);
  width: 100%;
  transition: width 0.5s ease;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3);
}

.hp-fill.enemy-fill {
  background: linear-gradient(90deg, var(--c-red) 0%, #ff5722 100%);
}

.energy-dots {
  display: flex;
  gap: 4px;
}

.energy-dot {
  width: 16px;
  height: 16px;
  background: var(--c-black);
  border: 2px solid var(--c-purple-light);
  position: relative;
}
.energy-dot.filled {
  background: radial-gradient(circle, var(--c-gold) 30%, var(--c-red) 100%);
  animation: energyPulse 1s infinite;
  box-shadow: 0 0 8px var(--c-gold);
}

@keyframes energyPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.battle-vs {
  font-family: var(--pixel-font);
  font-size: 48px;
  color: var(--c-red);
  text-shadow:
    3px 3px 0 var(--c-gold),
    6px 6px 0 var(--c-black);
  animation: vsThrob 1.5s ease-in-out infinite;
}

@keyframes vsThrob {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.1) rotate(-3deg); }
}

.battle-message {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: 22px;
  color: var(--c-gold);
  text-shadow: 2px 2px 0 var(--c-black);
  min-height: 40px;
  margin: 8px 0;
  letter-spacing: 0.1em;
  font-family: var(--cn-font);
}

.battle-message.critical {
  color: var(--c-red);
  font-size: 32px;
  animation: criticalIn 0.4s;
  font-family: var(--impact-font);
}
@keyframes criticalIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===================== CUT-IN 系统（核心）===================== */
#cutInOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: none;
}
#cutInOverlay.active { display: block; }

/* 全屏黑幕 */
.cutin-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  opacity: 0;
  animation: cutinFadeIn 0.15s ease forwards;
}
@keyframes cutinFadeIn {
  to { opacity: 1; }
}

/* 斜切色带（足球小将招牌）*/
.cutin-band {
  position: absolute;
  left: -20%;
  right: -20%;
  height: 55vh;
  top: 22%;
  transform: skewY(-12deg);
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(154,77,208,0.8) 15%,
    rgba(42,10,74,0.95) 30%,
    rgba(42,10,74,0.95) 70%,
    rgba(154,77,208,0.8) 85%,
    transparent 100%);
  box-shadow:
    0 -6px 0 var(--c-gold),
    0 6px 0 var(--c-gold);
  animation: cutinBandIn 0.4s cubic-bezier(.15,.7,.25,1.2);
}
@keyframes cutinBandIn {
  from { transform: skewY(-12deg) translateX(-120%); opacity: 0; }
  to { transform: skewY(-12deg) translateX(0); opacity: 1; }
}

/* 特写立绘 */
.cutin-portrait {
  position: absolute;
  right: 5%;
  top: 10%;
  height: 80vh;
  width: auto;
  max-width: 55vw;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  filter: drop-shadow(8px 8px 0 var(--c-black)) drop-shadow(-4px 0 0 var(--c-gold));
  animation: cutinPortraitIn 0.5s cubic-bezier(.2,.8,.3,1.1);
}
@keyframes cutinPortraitIn {
  0% { transform: translateX(80vw) scale(0.8) rotate(8deg); opacity: 0; }
  60% { transform: translateX(-30px) scale(1.05) rotate(-2deg); opacity: 1; }
  100% { transform: translateX(0) scale(1) rotate(0); opacity: 1; }
}
.cutin-portrait.left {
  right: auto;
  left: 5%;
  filter: drop-shadow(-8px 8px 0 var(--c-black)) drop-shadow(4px 0 0 var(--c-gold));
}
.cutin-portrait.left.in {
  animation: cutinPortraitInLeft 0.5s cubic-bezier(.2,.8,.3,1.1);
}
@keyframes cutinPortraitInLeft {
  0% { transform: translateX(-80vw) scale(0.8) rotate(-8deg); opacity: 0; }
  60% { transform: translateX(30px) scale(1.05) rotate(2deg); opacity: 1; }
  100% { transform: translateX(0) scale(1) rotate(0); opacity: 1; }
}

/* 技能名大字 */
.cutin-skillname {
  position: absolute;
  left: 8%;
  top: 40%;
  font-family: var(--impact-font);
  font-size: clamp(48px, 8vw, 120px);
  font-weight: bold;
  color: var(--c-gold);
  -webkit-text-stroke: 3px var(--c-black);
  text-shadow:
    0 0 20px var(--c-gold),
    6px 6px 0 var(--c-red),
    12px 12px 0 var(--c-purple-deep);
  letter-spacing: 0.05em;
  line-height: 0.9;
  animation: cutinTextIn 0.5s cubic-bezier(.2,.8,.3,1.2) 0.2s both;
  transform-origin: left center;
  z-index: 3;
}
.cutin-skillname .sub {
  display: block;
  font-size: 0.5em;
  color: var(--c-white);
  letter-spacing: 0.3em;
  margin-top: 8px;
  text-shadow: 3px 3px 0 var(--c-black);
}
@keyframes cutinTextIn {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(-4deg); opacity: 1; }
}

/* 速度线 */
.speedlines {
  position: absolute;
  inset: 0;
  background:
    repeating-conic-gradient(from 0deg at 50% 50%,
      rgba(255,255,255,0.5) 0deg 1deg,
      transparent 1deg 8deg);
  animation: speedlinesSpin 0.6s linear infinite;
  opacity: 0.4;
  mix-blend-mode: screen;
}
@keyframes speedlinesSpin {
  to { transform: rotate(15deg); }
}

/* 冲击闪光 */
.cutin-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, white 0%, rgba(245,200,66,0.6) 20%, transparent 60%);
  opacity: 0;
  animation: cutinFlash 0.4s ease;
}
@keyframes cutinFlash {
  0%,100% { opacity: 0; }
  40% { opacity: 1; }
}

/* 粒子 */
.cutin-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cutin-particles span {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--c-gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--c-gold);
  animation: particleFly 1s ease-out forwards;
}
@keyframes particleFly {
  0% { transform: translate(0,0) scale(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.5); opacity: 0; }
}

/* ===== 射门→球动画 ===== */
.ball-fly {
  position: absolute;
  left: 15%;
  top: 55%;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #ccc 50%, #000 70%, #333 100%);
  border-radius: 50%;
  box-shadow:
    0 0 20px rgba(255,255,255,0.8),
    inset -5px -5px 10px rgba(0,0,0,0.5);
  z-index: 5;
  animation: ballFly 0.6s ease-out;
}
.ball-fly::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  height: 8px;
  background: linear-gradient(90deg, transparent 0%, rgba(245,200,66,0.8) 40%, white 100%);
  filter: blur(2px);
}
@keyframes ballFly {
  0% { left: 15%; transform: scale(0.5) rotate(0); }
  60% { transform: scale(1.2) rotate(720deg); }
  100% { left: 75%; transform: scale(0.8) rotate(1440deg); }
}

/* 技能释放时镜头震动 */
#game.shake { animation: screenShake 0.4s; }
@keyframes screenShake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-12px, -8px); }
  40% { transform: translate(10px, 6px); }
  60% { transform: translate(-8px, 10px); }
  80% { transform: translate(6px, -4px); }
}

/* ===================== 指令面板 ===================== */
.command-panel {
  position: relative;
  z-index: 5;
  background: linear-gradient(180deg, #1a0a2a 0%, #2a0a4a 100%);
  border-top: 4px solid var(--c-gold);
  padding: 16px 32px 24px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.6);
}

.command-title {
  text-align: center;
  font-size: 14px;
  color: var(--c-gold);
  margin-bottom: 12px;
  letter-spacing: 0.3em;
  animation: blink 1s steps(2) infinite;
}

.command-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
}

.command-btn {
  padding: 14px 18px;
  background: linear-gradient(180deg, #3a1a5a 0%, #1a0a2a 100%);
  border: 3px solid var(--c-purple-light);
  color: var(--c-white);
  font-family: var(--cn-font);
  font-size: 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  position: relative;
  letter-spacing: 0.05em;
}

.command-btn::before {
  content: '▶';
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-gold);
  opacity: 0;
  transition: opacity 0.15s;
}

.command-btn:hover {
  background: linear-gradient(180deg, var(--c-purple) 0%, var(--c-purple-deep) 100%);
  border-color: var(--c-gold);
  color: var(--c-gold);
  transform: translateX(8px);
}
.command-btn:hover::before { opacity: 1; }

.command-btn.special {
  border-color: var(--c-gold);
  background: linear-gradient(180deg, #5a3a1a 0%, #2a1a0a 100%);
}
.command-btn.special::after {
  content: '⚡';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-gold);
  font-size: 24px;
  animation: energyPulse 1s infinite;
}

.command-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.cmd-name { font-weight: bold; display: block; }
.cmd-desc { font-size: 12px; color: var(--c-purple-light); display: block; margin-top: 4px; }

/* ===================== 结算屏 ===================== */
#result-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(245,200,66,0.1) 0%, transparent 60%),
    linear-gradient(180deg, #0a0612 0%, #2a0a4a 100%);
}

.result-content {
  text-align: center;
  padding: 40px;
  max-width: 700px;
  background: rgba(26,10,42,0.9);
  border: 4px solid var(--c-gold);
  animation: resultIn 0.8s ease;
}

@keyframes resultIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

#resultTitle {
  font-family: var(--impact-font);
  font-size: 44px;
  color: var(--c-gold);
  text-shadow: 3px 3px 0 var(--c-purple-deep), 6px 6px 0 var(--c-red);
  margin-bottom: 24px;
  letter-spacing: 0.1em;
}

#resultStats {
  font-size: 18px;
  margin-bottom: 24px;
  line-height: 2;
  color: var(--c-purple-light);
}

#resultStory {
  font-size: 18px;
  line-height: 2;
  color: var(--c-white);
  margin-bottom: 30px;
  text-align: left;
  padding: 20px;
  border: 2px solid var(--c-purple);
  background: rgba(10,6,18,0.5);
}

.next-chapter-btn {
  font-family: var(--cn-font);
  font-size: 20px;
  padding: 14px 40px;
  background: linear-gradient(180deg, var(--c-gold) 0%, #c89c2a 100%);
  color: var(--c-purple-deep);
  border: 3px solid var(--c-purple-deep);
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 0.2em;
  transition: all 0.2s;
}
.next-chapter-btn:hover {
  background: linear-gradient(180deg, #ffeb3b 0%, var(--c-gold) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245,200,66,0.5);
}

/* ===================== 浮动伤害数字 ===================== */
.float-damage {
  position: absolute;
  font-family: var(--pixel-font);
  font-size: 32px;
  color: var(--c-gold);
  text-shadow: 3px 3px 0 var(--c-black);
  pointer-events: none;
  z-index: 200;
  animation: floatUp 1.2s ease-out forwards;
}
.float-damage.miss { color: var(--c-gray); }
.float-damage.crit { color: var(--c-red); font-size: 48px; }

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(20px) scale(0.5); }
  20% { opacity: 1; transform: translateY(0) scale(1.2); }
  80% { opacity: 1; transform: translateY(-60px) scale(1); }
  100% { opacity: 0; transform: translateY(-100px) scale(0.8); }
}

/* ===================== 响应式 ===================== */
@media (max-width: 900px) {
  .battle-stage { flex-direction: column; gap: 20px; padding: 16px; }
  .battle-vs { font-size: 32px; }
  .fighter-portrait { width: 160px; height: 160px; }
  .fighter-hp, .fighter-energy { width: 200px; }
  .game-title { font-size: 36px; }
  .story-portrait { width: 240px; height: 240px; bottom: 25%; }
  .cutin-portrait { height: 60vh; }

  /* ⚠️ 移动端 PK 指令面板修复（2026-04-27）
     原 bug：battle-stage 吃光高度，command-panel 被挤到屏幕外，用户找不到行动按钮 */
  #battle-screen {
    /* 让战斗屏内部滚动，但底部固定指令面板 */
    overflow: hidden;
    position: relative;
  }
  .battle-stage {
    /* 不抢光高度，给 command-panel 留位置 */
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
  }
  .command-panel {
    /* 钉在战斗屏底部，永远可见 */
    flex: 0 0 auto;
    padding: 12px 16px 18px;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* 强化视觉分隔 */
    box-shadow: 0 -4px 16px rgba(0,0,0,0.7), 0 -1px 0 var(--c-gold);
    /* 视觉提示：上方有抽屉感 */
    border-top-width: 3px;
  }
  .command-title {
    margin-bottom: 8px;
    font-size: 12px;
    /* 加箭头提示用户这是可选项 */
    position: relative;
  }
  .command-list {
    grid-template-columns: 1fr 1fr;  /* 移动端 2 列布局 */
    gap: 8px;
  }
  .command-btn {
    padding: 10px 12px;
    font-size: 14px;
    /* 移动端不需要 hover 位移 */
    min-height: 56px;  /* 触控目标 ≥44pt */
    line-height: 1.3;
  }
  .command-btn:hover {
    transform: none;
  }
  .command-btn .cmd-desc {
    font-size: 11px;
  }
  /* 战斗消息也压缩一下，腾出空间 */
  .battle-message {
    font-size: 18px;
    padding: 8px 12px;
  }
}

/* 极窄屏（≤480px，单列指令） */
@media (max-width: 480px) {
  .command-list {
    grid-template-columns: 1fr;
  }
  .fighter-portrait { width: 120px; height: 120px; }
  .battle-stage { padding: 12px; gap: 12px; }
}

/* ============================================
   ⚽ 射门 sprite 演员系统（来自 shoot-action-test 集成）
   ============================================ */
:root {
  --sprite-frame-w: 316;
  --sprite-frame-h: 424;
  --sprite-scale: 0.7;
}

/* sprite 演员舞台（覆盖整个 battle-screen） */
#shootActorStage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  display: none;
}
#shootActorStage.active { display: block; }

#shootActorStage .stage-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(42,10,74,0.85) 0%, rgba(26,58,26,0.7) 60%, rgba(10,32,10,0.85) 100%);
}

/* 远端球门 */
#shootActorStage .goal-net {
  position: absolute;
  right: 8%;
  top: 45%;
  width: 160px;
  height: 110px;
  border: 4px solid white;
  border-right-width: 2px;
  background: repeating-linear-gradient(45deg,
    rgba(255,255,255,0.1) 0 4px, transparent 4px 12px);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* 角色 sprite 演员 */
.shoot-actor {
  position: absolute;
  left: 8%;
  bottom: 18%;
  width: calc(var(--sprite-frame-w) * var(--sprite-scale) * 1px);
  height: calc(var(--sprite-frame-h) * var(--sprite-scale) * 1px);
  background-repeat: no-repeat;
  background-size: calc(var(--sprite-frame-w) * 4 * var(--sprite-scale) * 1px) calc(var(--sprite-frame-h) * 2 * var(--sprite-scale) * 1px);
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: left 0.3s ease-out;
}

.shoot-actor.run-in {
  animation: actorWalk 0.6s steps(4) 2, actorRunIn 1.2s ease-out forwards;
}
.shoot-actor.shoot {
  animation: actorShoot 0.6s steps(4) forwards;
}
.shoot-actor.celebrate {
  animation: actorCelebrate 0.8s steps(4) 2;
}

@keyframes actorWalk {
  from { background-position: 0 0; }
  to   { background-position: calc(-4 * var(--sprite-frame-w) * var(--sprite-scale) * 1px) 0; }
}
@keyframes actorRunIn {
  from { left: 8%; }
  to   { left: 38%; }
}
@keyframes actorShoot {
  0%   { background-position: 0 0; }
  25%  { background-position: calc(-1 * var(--sprite-frame-w) * var(--sprite-scale) * 1px) 0; }
  50%  { background-position: calc(-2 * var(--sprite-frame-w) * var(--sprite-scale) * 1px) 0;
         filter: brightness(1.5) drop-shadow(0 0 12px var(--c-gold)); }
  75%  { background-position: calc(-3 * var(--sprite-frame-w) * var(--sprite-scale) * 1px) 0; }
  100% { background-position: calc(-3 * var(--sprite-frame-w) * var(--sprite-scale) * 1px) 0; }
}
@keyframes actorCelebrate {
  from { background-position: 0 0; }
  to   { background-position: calc(-4 * var(--sprite-frame-w) * var(--sprite-scale) * 1px) 0; }
}

/* 飞球 */
#shootActorStage .actor-ball {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, white 0%, #ccc 50%, #444 100%);
  box-shadow: 0 0 14px white, inset -4px -4px 8px rgba(0,0,0,0.5);
  left: 38%;
  bottom: 22%;
  display: none;
}
#shootActorStage .actor-ball.fly {
  display: block;
  animation: actorBallFly 1.0s 1.4s forwards;
}
@keyframes actorBallFly {
  0%   { left: 38%; bottom: 22%; transform: scale(1) rotate(0); }
  100% { left: 80%; bottom: 60%; transform: scale(0.7) rotate(2880deg); }
}

/* GOAL 大字 */
#shootActorStage .actor-goal-text {
  position: absolute;
  left: 50%; top: 25%;
  transform: translate(-50%,-50%) scale(0);
  font-family: 'Helvetica Neue', sans-serif;
  font-size: 96px; font-weight: 900; font-style: italic;
  color: var(--c-gold);
  text-shadow:
    5px 5px 0 var(--c-purple-deep),
    -2px -2px 0 white,
    0 0 30px var(--c-gold),
    0 0 60px #ff6;
  letter-spacing: 8px;
  opacity: 0;
  z-index: 12;
}
#shootActorStage .actor-goal-text.flash {
  animation: actorGoalText 1.6s 2.4s;
}
@keyframes actorGoalText {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0) rotate(-30deg); }
  20%  { opacity: 1; transform: translate(-50%,-50%) scale(1.4) rotate(5deg); }
  40%  { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-3deg); }
  80%  { opacity: 1; transform: translate(-50%,-50%) scale(1.05) rotate(0); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.3) rotate(0); }
}

/* 进球瞬间金光 */
#shootActorStage .actor-goal-flash {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 50%, white 0%, var(--c-gold) 30%, transparent 60%);
  opacity: 0;
}
#shootActorStage .actor-goal-flash.flash {
  animation: actorFlash 0.5s 2.4s;
}
@keyframes actorFlash {
  0%,100% { opacity: 0; }
  50%     { opacity: 1; }
}

/* 庆祝光环 */
#shootActorStage .actor-aura {
  position: absolute;
  left: 50%; bottom: 18%;
  width: 360px; height: 360px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(245,200,66,0.6) 0%, transparent 60%);
  opacity: 0;
}
#shootActorStage .actor-aura.flash {
  animation: actorAura 1.6s 4.0s;
}
@keyframes actorAura {
  0%,100% { opacity: 0; transform: translateX(-50%) scale(0.5); }
  50%     { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

/* 金箔粒子 */
#shootActorStage .actor-particles {
  position: absolute; inset: 0;
  overflow: hidden;
  opacity: 0;
}
#shootActorStage .actor-particles.flash {
  animation: actorParticles 2.5s 4.0s;
}
@keyframes actorParticles {
  0% { opacity: 0; }
  20%,80% { opacity: 1; }
  100% { opacity: 0; }
}
#shootActorStage .actor-particles span {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--c-gold);
  box-shadow: 0 0 6px var(--c-gold);
  animation: actorParticleFall linear infinite;
}
@keyframes actorParticleFall {
  0%   { transform: translateY(-30px) rotate(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* 庆祝标语 */
#shootActorStage .actor-celeb-name {
  position: absolute;
  left: 50%; top: 78%;
  transform: translate(-50%,-50%) translateX(-200%);
  font-size: 48px; font-weight: 900; font-style: italic;
  color: white;
  text-shadow:
    3px 3px 0 var(--c-purple-deep),
    0 0 18px var(--c-gold);
  letter-spacing: 4px;
  opacity: 0;
  white-space: nowrap;
  z-index: 11;
}
#shootActorStage .actor-celeb-name.flash {
  animation: actorNameSlide 1.6s 4.2s;
}
@keyframes actorNameSlide {
  0%   { opacity: 0; transform: translate(-50%,-50%) translateX(-200%); }
  25%  { opacity: 1; transform: translate(-50%,-50%) translateX(0); }
  75%  { opacity: 1; transform: translate(-50%,-50%) translateX(0); }
  100% { opacity: 0; transform: translate(-50%,-50%) translateX(200%); }
}

/* 助跑速度线 */
#shootActorStage .actor-speed-lines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg,
    rgba(255,255,255,0.5) 0 2px, transparent 2px 14px);
  opacity: 0;
}
#shootActorStage .actor-speed-lines.flash {
  animation: actorSpeed 0.5s 1.0s;
}
@keyframes actorSpeed {
  0%,100% { opacity: 0; }
  50%     { opacity: 0.8; }
}

/* ============================================
   📚 动作图鉴屏（Gallery）
   ============================================ */
.title-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.gallery-btn {
  font-family: var(--cn-font);
  font-size: 18px;
  color: var(--c-purple-light);
  cursor: pointer;
  padding: 8px 22px;
  border: 2px solid var(--c-purple-light);
  background: rgba(154, 77, 208, 0.1);
  transition: all 0.2s;
  letter-spacing: 0.1em;
}
.gallery-btn:hover {
  color: var(--c-gold);
  border-color: var(--c-gold);
  background: rgba(245, 200, 66, 0.15);
  transform: scale(1.05);
}

#gallery-screen {
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(154,77,208,0.25) 0%, transparent 60%),
    linear-gradient(180deg, #0a0612 0%, #1a0828 50%, #0a0612 100%);
  overflow: hidden;
}

.gallery-header {
  position: relative;
  padding: 18px 24px 10px;
  text-align: center;
  border-bottom: 2px solid var(--c-purple);
  background: rgba(42, 10, 74, 0.5);
  flex-shrink: 0;
}
.gallery-title {
  font-family: var(--cn-font);
  font-size: 28px;
  color: var(--c-gold);
  text-shadow: 2px 2px 0 var(--c-purple-deep), 0 0 16px rgba(245,200,66,0.5);
  letter-spacing: 0.15em;
}
.gallery-sub {
  font-size: 13px;
  color: var(--c-purple-light);
  margin-top: 6px;
  letter-spacing: 0.05em;
}
.gallery-back {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--cn-font);
  font-size: 14px;
  color: var(--c-white);
  background: var(--c-purple);
  border: 2px solid var(--c-gold);
  padding: 8px 16px;
  cursor: pointer;
  letter-spacing: 0.05em;
}
.gallery-back:hover { background: var(--c-purple-light); }

.gallery-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.gallery-card {
  background: linear-gradient(180deg, #160826, #0f0420);
  border: 2px solid var(--c-purple);
  border-radius: 4px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--c-gold);
  box-shadow: 0 6px 18px rgba(245, 200, 66, 0.25);
}
.gallery-card .cat-tag {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--c-purple-deep);
  color: var(--c-gold);
  border: 1px solid var(--c-gold);
  letter-spacing: 0.1em;
}
.gallery-card .g-title {
  font-family: var(--cn-font);
  font-size: 17px;
  color: var(--c-gold);
  margin-bottom: 2px;
}
.gallery-card .g-en {
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--c-purple-light);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

/* 图鉴 sprite 预览器 */
.gallery-sprite {
  width: calc(var(--sprite-frame-w) * 0.5 * 1px);
  height: calc(var(--sprite-frame-h) * 0.5 * 1px);
  margin: 0 auto 10px;
  background-repeat: no-repeat;
  background-size: calc(var(--sprite-frame-w) * 4 * 0.5 * 1px) calc(var(--sprite-frame-h) * 2 * 0.5 * 1px);
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: rgba(26, 58, 26, 0.4);
  border: 1px solid var(--c-purple);
}
.gallery-sprite.playing {
  animation: galleryPlay 0.8s steps(4) infinite;
  border-color: var(--c-gold);
  box-shadow: inset 0 0 12px rgba(245, 200, 66, 0.3);
}
@keyframes galleryPlay {
  from { background-position: 0 0; }
  to   { background-position: calc(-4 * var(--sprite-frame-w) * 0.5 * 1px) 0; }
}

.gallery-card .g-play-hint {
  font-size: 11px;
  color: var(--c-purple-light);
  margin-top: 4px;
  letter-spacing: 0.1em;
}
.gallery-card.is-playing .g-play-hint {
  color: var(--c-gold);
}

.gallery-footer {
  flex-shrink: 0;
  padding: 16px 24px;
  text-align: center;
  border-top: 2px solid var(--c-purple);
  background: rgba(42, 10, 74, 0.7);
}
.gallery-cta {
  font-family: var(--cn-font);
  font-size: 18px;
  color: var(--c-purple-deep);
  background: linear-gradient(180deg, var(--c-gold), #c79a20);
  border: 3px solid var(--c-gold);
  padding: 12px 32px;
  cursor: pointer;
  letter-spacing: 0.15em;
  font-weight: bold;
  transition: transform 0.15s;
}
.gallery-cta:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--c-gold);
}

/* ============================================
   战斗指令·动作预览条
   ============================================ */
.command-preview {
  margin-top: 10px;
  padding: 8px;
  background: rgba(10, 6, 18, 0.6);
  border: 1px dashed var(--c-purple);
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(var(--sprite-frame-h) * 0.3 * 1px + 16px);
  transition: border-color 0.2s;
}
.command-preview.active {
  border-color: var(--c-gold);
  border-style: solid;
  background: rgba(42, 10, 74, 0.4);
}
.command-preview-sprite {
  width: calc(var(--sprite-frame-w) * 0.3 * 1px);
  height: calc(var(--sprite-frame-h) * 0.3 * 1px);
  background-repeat: no-repeat;
  background-size: calc(var(--sprite-frame-w) * 4 * 0.3 * 1px) calc(var(--sprite-frame-h) * 2 * 0.3 * 1px);
  background-position: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.command-preview.active .command-preview-sprite {
  opacity: 1;
  animation: previewPlay 0.7s steps(4) infinite;
}
@keyframes previewPlay {
  from { background-position: 0 0; }
  to   { background-position: calc(-4 * var(--sprite-frame-w) * 0.3 * 1px) 0; }
}
.command-preview-label {
  font-family: var(--cn-font);
  font-size: 13px;
  color: var(--c-purple-light);
  letter-spacing: 0.05em;
  line-height: 1.5;
}
.command-preview.active .command-preview-label {
  color: var(--c-gold);
}
.command-preview-label .flavor {
  display: block;
  font-size: 11px;
  color: var(--c-white);
  opacity: 0.8;
  margin-top: 2px;
}
