/* ========= 全局重置 ========= */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
#app { width: 100%; height: 100%; background: #1a1035; }

/* ========= 屏幕切换 ========= */
.screen { display: none; width: 100%; height: 100%; flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; }

/* ========= 加载界面 ========= */
#screen-loading { background: linear-gradient(160deg, #1a1035 0%, #3D2070 100%); }
.loading-logo { font-size: 80px; margin-bottom: 12px; animation: float 2s ease-in-out infinite; }
.loading-title { font-size: 28px; font-weight: bold; color: #FFD700; margin-bottom: 30px; letter-spacing: 4px; }
.loading-bar-wrap { width: 60%; height: 10px; background: rgba(255,255,255,0.15); border-radius: 5px; overflow: hidden; margin-bottom: 16px; }
.loading-bar { height: 100%; background: linear-gradient(90deg, #6B4EFF, #FFD700); border-radius: 5px; width: 0%; transition: width 0.3s; }
.loading-tip { color: rgba(255,255,255,0.6); font-size: 14px; }

/* ========= 战斗界面 ========= */
#screen-battle {
  background: linear-gradient(180deg, #0D2137 0%, #1B3A5C 40%, #2D5A3D 70%, #1A6B2E 100%);
  justify-content: flex-start;
  padding: 0;
}
.battle-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}
.hero-hp-area, .monster-hp-area { flex: 1; }
.monster-hp-area { text-align: right; }
.role-name { font-size: 12px; color: rgba(255,255,255,0.7); margin-bottom: 4px; }
.hp-bar-wrap { width: 100%; height: 8px; background: rgba(0,0,0,0.4); border-radius: 4px; overflow: hidden; }
.hp-bar { height: 100%; background: linear-gradient(90deg, #52C41A, #7CFF6B); border-radius: 4px; transition: width 0.4s; }
.hp-bar.monster { background: linear-gradient(90deg, #FF4444, #FF8080); }
.hp-text { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.level-info { text-align: center; padding: 0 12px; }
.level-text { font-size: 13px; color: #FFD700; font-weight: bold; }
.question-progress { font-size: 11px; color: rgba(255,255,255,0.6); }

/* 战斗场景 */
.battle-scene {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  flex: 1;
  padding: 10px 20px;
  min-height: 0;
}
.hero-area, .monster-area { position: relative; display: flex; flex-direction: column; align-items: center; }
.sprite { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)); transition: transform 0.1s; }
.hero-sprite { animation: heroIdle 3s ease-in-out infinite; }
.monster-sprite { animation: monsterIdle 2.5s ease-in-out infinite; }
.vs-text { font-size: 24px; color: rgba(255,255,255,0.5); }
.attack-effect {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  pointer-events: none;
  opacity: 0;
}

/* 连击 */
.combo-area {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combo-badge {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #fff;
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 14px;
  font-weight: bold;
  animation: pop 0.3s ease;
}

/* 题目区域 */
.question-area {
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
}
.question-text {
  font-size: 32px;
  font-weight: bold;
  color: #fff;
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.timer-bar-wrap { width: 100%; height: 6px; background: rgba(0,0,0,0.3); border-radius: 3px; overflow: hidden; }
.timer-bar { height: 100%; background: linear-gradient(90deg, #52C41A, #FFD700); border-radius: 3px; transition: width linear; }

/* 选项按钮 */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: calc(100% - 32px);
  margin: 0 16px 16px;
}
.option-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 16px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.option-btn:active { transform: scale(0.95); }
.option-btn.correct { background: rgba(82,196,26,0.35); border-color: #52C41A; animation: flash-green 0.4s; }
.option-btn.wrong { background: rgba(255,68,68,0.35); border-color: #FF4444; animation: shake 0.4s; }

/* 结果 toast */
.result-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 48px;
  pointer-events: none;
  transition: transform 0.2s;
  z-index: 100;
}
.result-toast.show { transform: translate(-50%, -50%) scale(1); }

/* ========= 胜利/失败界面 ========= */
#screen-win { background: linear-gradient(160deg, #0A2A0A, #1A6B2E); }
#screen-lose { background: linear-gradient(160deg, #1A0505, #5C1818); }
.win-content, .lose-content {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 30px; gap: 16px; width: 100%; max-width: 360px;
}
.win-emoji, .lose-emoji { font-size: 64px; }
.win-title { font-size: 32px; font-weight: bold; color: #FFD700; }
.lose-title { font-size: 32px; font-weight: bold; color: #FF8080; }
.stars-display { font-size: 44px; letter-spacing: 8px; }
.win-stats, .lose-stats, .win-reward {
  background: rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px 24px;
  width: 100%;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  line-height: 2;
}
.win-reward { background: rgba(255,215,0,0.15); border: 1px solid rgba(255,215,0,0.3); }

/* 按钮 */
.btn-green, .btn-purple, .btn-gray {
  width: 100%; padding: 16px; border-radius: 50px;
  font-size: 18px; font-weight: bold; border: none; cursor: pointer;
  color: #fff; transition: opacity 0.2s;
}
.btn-green { background: linear-gradient(135deg, #52C41A, #7CFF6B); color: #1A3A0A; }
.btn-purple { background: linear-gradient(135deg, #6B4EFF, #9B7AFF); }
.btn-gray { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); }
.btn-green:active, .btn-purple:active, .btn-gray:active { opacity: 0.8; }

/* ========= 动画 ========= */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes heroIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.02); }
}
@keyframes monsterIdle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(2deg); }
  75% { transform: translateY(-3px) rotate(-2deg); }
}
@keyframes flash-green {
  0%, 100% { background: rgba(255,255,255,0.12); }
  50% { background: rgba(82,196,26,0.5); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes heroAttack {
  0% { transform: translateX(0); }
  30% { transform: translateX(40px) scale(1.1); }
  60% { transform: translateX(0); }
}
@keyframes monsterHit {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(10px); }
  75% { transform: translateX(-10px); }
}
@keyframes monsterAttack {
  0% { transform: translateX(0); }
  30% { transform: translateX(-40px) scale(1.1); }
  60% { transform: translateX(0); }
}
