/* Sejarah ChronoBlade - 2D Action RPG Battle Stage & Combat Style */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Cinzel:wght@600;800&display=swap');

:root {
  --bg-dark: #080C14;
  --panel-bg: rgba(15, 23, 42, 0.88);
  --border-color: rgba(255, 255, 255, 0.12);
  --gold: #F59E0B;
  --gold-glow: rgba(245, 158, 11, 0.45);
  --cyan: #38BDF8;
  --hp-green: #10B981;
  --hp-red: #EF4444;
  --mp-blue: #3B82F6;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(30, 58, 138, 0.28) 0%, transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(239, 68, 68, 0.08) 0%, transparent 40%);
  color: #F3F4F6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 顶部导航控制条 */
.top-nav {
  background: rgba(10, 15, 26, 0.95);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
}

.brand-title {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
}

/* ===================================================
   2D 横版 RPG 战斗舞台 (Battle Stage Arena)
   =================================================== */
.rpg-battle-stage {
  position: relative;
  width: 100%;
  height: 290px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(0, 0, 0, 0.5);
  background-color: #0B1120;
}

.stage-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  filter: brightness(0.9) contrast(1.05);
  transform: scale(1.02);
  transition: transform 0.5s ease;
}

/* 舞台顶部 HUD 状态栏 */
.stage-hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.85) 0%, rgba(8, 12, 20, 0.4) 65%, transparent 100%);
  z-index: 20;
  pointer-events: none;
}

/* 角色与血条 HUD 容器 */
.hud-fighter-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  max-width: 260px;
}

.hud-name-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* 血条与能量槽 */
.hud-bar-shell {
  height: 14px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.hud-bar-fill {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-player-hp {
  background: linear-gradient(90deg, #10B981, #34D399);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.hud-enemy-hp {
  background: linear-gradient(90deg, #A855F7, #EC4899);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}

.hud-mp-shell {
  height: 7px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-mp-fill {
  height: 100%;
  background: linear-gradient(90deg, #38BDF8, #2563EB);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  transition: width 0.3s ease;
}

/* 中央战况与倒计时 */
.hud-center-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.vs-text {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 0.95rem;
  color: #F59E0B;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.8), 1px 1px 0 #000;
  letter-spacing: 0.1em;
}

.round-pill {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  color: #38BDF8;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 9999px;
}

/* 终极奥义蓄力指示灯 */
.ultimate-meter-box {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ultimate-slot {
  width: 18px;
  height: 11px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ultimate-slot.charged {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  border-color: #FBBF24;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

.ultimate-slot.ready-glow {
  animation: pulseGlow 0.8s infinite alternate;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 4px #F59E0B; }
  100% { box-shadow: 0 0 12px #EF4444, 0 0 20px #FBBF24; }
}

/* ===================================================
   2D 战斗角色精灵 (Fighter Sprites & Actions)
   =================================================== */
.fighter-wrapper {
  position: absolute;
  bottom: 24px;
  width: 125px;
  height: 125px;
  z-index: 10;
  pointer-events: none;
  transform-origin: bottom center;
  transition: filter 0.2s ease;
}

#player-fighter {
  left: 45px;
}

#enemy-fighter {
  right: 45px;
}

.fighter-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
}

/* 角色脚底椭圆阴影 */
.fighter-shadow {
  position: absolute;
  bottom: -4px;
  left: 20%;
  width: 60%;
  height: 12px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.65) 0%, transparent 72%);
  border-radius: 50%;
  z-index: -1;
  transform-origin: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* 待机呼吸微动 */
.idle-breath {
  animation: spriteBreathe 2.4s ease-in-out infinite;
}

@keyframes spriteBreathe {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-5px) scale(0.98, 1.02); }
}

/* 玩家出招突进飞斩 (Dash, Jump & Slash Animation) */
.hero-dash-attack {
  animation: heroLungeSlash 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes heroLungeSlash {
  0% {
    transform: translate(0, 0) scale(1);
  }
  20% {
    /* 蓄力后撤一步 */
    transform: translate(-25px, 0) rotate(-6deg) scale(0.96);
  }
  45% {
    /* 狂飙突刺至敌方面前 */
    transform: translate(calc(var(--dash-dist, 360px)), -22px) rotate(12deg) scale(1.18);
  }
  65% {
    /* 挥剑斩击收尾与空翻回弹 */
    transform: translate(calc(var(--dash-dist, 360px) * 0.7), -35px) rotate(-15deg) scale(1.08);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* 敌人反击突进 (Enemy Attack Animation) */
.boss-dash-attack {
  animation: bossLungeSlash 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes bossLungeSlash {
  0% {
    transform: translate(0, 0) scale(1);
  }
  20% {
    transform: translate(25px, 0) rotate(6deg) scale(0.96);
  }
  45% {
    transform: translate(calc(var(--dash-dist-boss, -360px)), -22px) rotate(-12deg) scale(1.18);
  }
  65% {
    transform: translate(calc(var(--dash-dist-boss, -360px) * 0.7), -35px) rotate(15deg) scale(1.08);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* 受击硬直后退与闪白 (Hit Recoil) */
.sprite-hit-recoil {
  animation: hitRecoil 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

@keyframes hitRecoil {
  0% {
    transform: translate(0, 0);
    filter: brightness(1);
  }
  15% {
    transform: translate(18px, -4px) scale(0.92);
    filter: brightness(3.5) drop-shadow(0 0 18px red);
  }
  35% {
    transform: translate(-12px, 0) scale(0.95);
    filter: brightness(2) drop-shadow(0 0 10px red);
  }
  65% {
    transform: translate(6px, 0) scale(0.98);
    filter: brightness(1.4);
  }
  100% {
    transform: translate(0, 0) scale(1);
    filter: brightness(1);
  }
}

/* 终极大招连招狂暴动画 (Ultimate Combo Dance) */
.hero-ultimate-rush {
  animation: heroUltDance 1.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroUltDance {
  0% { transform: translate(0, 0) scale(1); }
  15% { transform: translate(120px, -55px) scale(1.35) rotate(10deg); filter: drop-shadow(0 0 25px #FBBF24); }
  35% { transform: translate(calc(var(--dash-dist, 360px)), -20px) scale(1.4) rotate(35deg); filter: drop-shadow(0 0 35px #EF4444); }
  55% { transform: translate(calc(var(--dash-dist, 360px)), 15px) scale(1.35) rotate(-30deg); }
  75% { transform: translate(calc(var(--dash-dist, 360px) * 0.6), -45px) scale(1.2) rotate(180deg); }
  100% { transform: translate(0, 0) scale(1); filter: brightness(1); }
}

/* 挥剑光弧特效 (Slash Arc Effect) */
.slash-fx-container {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  pointer-events: none;
  z-index: 30;
  display: none;
}

.slash-fx-container.active {
  display: block;
  animation: slashBurst 0.38s ease-out forwards;
}

@keyframes slashBurst {
  0% { transform: translate(-50%, -50%) scale(0.4) rotate(-30deg); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.25) rotate(15deg); opacity: 1; filter: drop-shadow(0 0 20px #38BDF8); }
  100% { transform: translate(-50%, -50%) scale(1.55) rotate(45deg); opacity: 0; }
}

/* ===================================================
   浮空伤害飘字 (Floating Damage Numbers 仿参考图)
   =================================================== */
.stage-dmg-tag {
  position: absolute;
  top: 35%;
  font-family: 'Plus Jakarta Sans', monospace, sans-serif;
  font-weight: 900;
  font-size: 1.55rem;
  padding: 2px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 60;
  pointer-events: none;
  animation: floatDmgTag 0.95s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.dmg-normal {
  background: #FDE047;
  color: #854D0E;
  border: 1px solid #CA8A04;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

.dmg-crit {
  background: linear-gradient(135deg, #F43F5E, #BE123C);
  color: #FFFFFF;
  border: 1px solid #FFE4E6;
  font-size: 1.85rem;
  text-shadow: 0 0 12px rgba(244, 63, 94, 0.9), 1px 1px 0 #000;
}

.dmg-ult {
  background: linear-gradient(135deg, #FFDD00, #EA580C);
  color: #000;
  border: 2px solid #FFFBEB;
  font-size: 2.15rem;
  box-shadow: 0 0 25px rgba(255, 221, 0, 0.9);
}

.dmg-enemy-hit {
  background: #EF4444;
  color: #FFFFFF;
  border: 1px solid #B91C1C;
}

@keyframes floatDmgTag {
  0% { opacity: 0; transform: translateY(20px) scale(0.6); }
  25% { opacity: 1; transform: translateY(-8px) scale(1.18); }
  75% { opacity: 1; transform: translateY(-26px) scale(1); }
  100% { opacity: 0; transform: translateY(-48px) scale(0.9); }
}

/* 全屏震屏 */
.screen-shake {
  animation: screenVibrate 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes screenVibrate {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ===================================================
   答题反馈横幅 (参考图底部状态)
   =================================================== */
.feedback-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.feedback-status-bar.correct-state {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34D399;
}

.feedback-status-bar.wrong-state {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #F87171;
}

/* 题目卡片 */
.question-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* 选项按钮 */
.option-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.95rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  color: #E2E8F0;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  line-height: 1.45;
  width: 100%;
}

.option-btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.85);
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.2);
}

.option-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
  flex-shrink: 0;
}

.option-btn.correct-choice {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #10B981 !important;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}

.option-btn.wrong-choice {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #EF4444 !important;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.4);
}

.option-btn.correct-reveal {
  border-color: #10B981 !important;
  background: rgba(16, 185, 129, 0.15) !important;
}

.option-btn.eliminated {
  opacity: 0.25;
  filter: grayscale(1);
  cursor: not-allowed;
  text-decoration: line-through;
}

/* 技能按钮 */
.skill-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #94A3B8;
  flex: 1;
  min-width: 78px;
}

.skill-btn.skill-ready {
  border-color: var(--cyan);
  background: rgba(14, 116, 144, 0.2);
  color: #E2E8F0;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.skill-btn.skill-ready:hover {
  transform: translateY(-2px);
  background: rgba(14, 116, 144, 0.35);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

.skill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.skill-icon-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.skill-icon {
  font-size: 1.25rem;
}

.skill-key {
  font-size: 0.65rem;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
}

.skill-name {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 2px;
}

.skill-cost {
  font-size: 0.65rem;
  color: var(--cyan);
  margin-top: 2px;
}

/* 终极奥义全屏 Cut-in 动画 */
.ultimate-cutin-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.4) 0%, rgba(0, 0, 0, 0.88) 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ultimateBannerAnim 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}

@keyframes ultimateBannerAnim {
  0% { opacity: 0; transform: scale(1.15); }
  15% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.95); }
}

.ultimate-banner-box {
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.25), rgba(239, 68, 68, 0.4), rgba(245, 158, 11, 0.25), transparent);
  border-top: 2px solid #F59E0B;
  border-bottom: 2px solid #EF4444;
  padding: 2.5rem 1rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 50px rgba(245, 158, 11, 0.6);
}

/* 战报滚动日志 */
.battle-log-box {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.75rem;
  max-height: 80px;
  overflow-y: auto;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.log-line {
  color: #94A3B8;
  margin-bottom: 2px;
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  padding: 1.75rem;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}