@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

/* 性能優化：使用 CSS 變量統一管理 */
:root {
  --primary-bg: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
  --accent-color: #00ffff;
  --boss-color: #ff4500;
  --animation-duration: 20s;
  --blur-radius: 8px;
  --shadow-light: 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 6px 12px rgba(0, 0, 0, 0.4);
}

* { 
  box-sizing: border-box; 
}

body {
  font-family: 'Orbitron', sans-serif;
  padding: 0;
  margin: 0;
  background: var(--primary-bg);
  color: #fff;
  overflow-x: hidden;
}

/* 優化：簡化背景效果，減少 GPU 負擔 */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 50%, 
    rgba(120, 119, 198, 0.15) 0%, 
    transparent 60%);
  /*animation: backgroundFlowOptimized var(--animation-duration) ease-in-out infinite;*/
  z-index: -2;
  will-change: transform;
}

/* 優化：簡化動畫，減少複雜度 */
@keyframes backgroundFlowOptimized {
  0%, 100% { 
    transform: rotate(0deg); 
    opacity: 0.8;
  }
  50% { 
    transform: rotate(180deg); 
    opacity: 1;
  }
}

/* BOSS模式：優化背景效果 */
body.boss-mode::before {
  background: radial-gradient(circle at 50% 50%, 
    rgba(255, 50, 50, 0.2) 0%, 
    transparent 60%);
  animation: bossBackgroundOptimized 4s ease-in-out infinite;
}

@keyframes bossBackgroundOptimized {
  0%, 100% { 
    opacity: 0.6; 
  }
  50% { 
    opacity: 0.9; 
  }
}

/* 優化：移除 backdrop-filter，改用透明度 */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(15, 15, 35, 0.95);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(0, 255, 255, 0.3);
  box-shadow: var(--shadow-light);
  font-size: 0.95em;
  z-index: 1000;
}

#topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-color);
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

#topbar .controls {
  display: flex;
  gap: 10px;
}

#topbar button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  color: white;
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#topbar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 主要內容區域優化 */
#content {
  display: flex;
  padding: 30px 20px;
  gap: 30px;
  margin-top: 2.5px;
}

.section {
  flex: 1;
  background: rgba(15, 15, 35, 0.85);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow-medium);
  position: relative;
  overflow: hidden;
}

/* 優化：簡化閃光效果 */
.section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(45deg, 
    transparent 40%, 
    rgba(0, 255, 255, 0.03) 50%, 
    transparent 60%);
  animation: sectionShineOptimized 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sectionShineOptimized {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* BOSS模式優化 */
body.boss-mode .section {
  background: rgba(50, 15, 15, 0.85);
  border: 1px solid rgba(255, 50, 50, 0.3);
  box-shadow: 0 4px 16px rgba(255, 0, 0, 0.2);
}

body.boss-mode .section::before {
  background: linear-gradient(45deg, 
    transparent 40%, 
    rgba(255, 50, 50, 0.05) 50%, 
    transparent 60%);
}

/* 優化：簡化 BOSS 區域效果 */
#monsterInfo {
  position: relative;
}

#monsterInfo.boss {
  background: rgba(139, 0, 0, 0.8);
  border: 2px solid rgba(255, 69, 0, 0.5);
  box-shadow: 0 0 15px rgba(255, 69, 0, 0.3);
}

.boss-title {
  position: relative;
  text-align: center;
  font-size: 2em;
  font-weight: 900;
  color: var(--boss-color);
  text-shadow: 0 0 10px rgba(255, 69, 0, 0.6);
  margin-bottom: 20px;
  animation: bossTextGlowOptimized 2s ease-in-out infinite alternate;
}

@keyframes bossTextGlowOptimized {
  from { text-shadow: 0 0 10px rgba(255, 69, 0, 0.6); }
  to { text-shadow: 0 0 20px rgba(255, 69, 0, 0.8); }
}

/* 優化：簡化皇冠動畫 */
.boss-title::before,
.boss-title::after {
  content: '👑';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2em;
  animation: crownSpinOptimized 4s linear infinite;
}

.boss-title::before { left: -50px; }
.boss-title::after { 
  right: -50px; 
  animation-direction: reverse;
}

@keyframes crownSpinOptimized {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* 戰鬥紀錄區域 */
#logArea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 10px;
  padding: 15px;
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
}

body.boss-mode #logArea {
  border-color: rgba(255, 50, 50, 0.3);
  background: rgba(50, 0, 0, 0.3);
}

/* 按鈕區域優化 */
#footer {
  padding: 2.5px 30px 30px 30px;
  text-align: center;
}

#footer button {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.15) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 2px solid rgba(0, 255, 255, 0.5);
  padding: 15px 30px;
  margin: 10px;
  border-radius: 25px;
  color: #00ffff;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

/* 優化：簡化按鈕 hover 效果 */
#footer button::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

#footer button:hover::before {
  left: 100%;
}

#footer button:hover {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.25) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(0, 255, 255, 0.8);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 255, 255, 0.3);
}

#footer button:disabled {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.2) 0%, rgba(90, 98, 104, 0.1) 100%);
  border-color: rgba(108, 117, 125, 0.4);
  color: rgba(108, 117, 125, 0.8);
  cursor: not-allowed;
  box-shadow: none;
}

#battleBtn {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.2) 0%, rgba(238, 90, 36, 0.15) 100%);
  border: 2px solid rgba(255, 107, 107, 0.6);
  color: #ff6b6b;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
  font-size: 1.3em;
  padding: 18px 40px;
}

#battleBtn:hover {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.3) 0%, rgba(238, 90, 36, 0.25) 100%);
  border-color: rgba(255, 107, 107, 0.9);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

#resetBtn {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.15) 100%);
  border: 2px solid rgba(255, 193, 7, 0.6);
  color: #ffc107;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
}

#resetBtn:hover {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.3) 0%, rgba(255, 152, 0, 0.25) 100%);
  border-color: rgba(255, 193, 7, 0.9);
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
}

/* 優化：簡化 BOSS 按鈕動畫 */
body.boss-mode #battleBtn {
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.25) 0%, rgba(220, 20, 60, 0.2) 100%);
  border-color: rgba(255, 69, 0, 0.7);
  color: #ff6347;
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
  animation: bossBattleButtonOptimized 3s ease-in-out infinite;
}

@keyframes bossBattleButtonOptimized {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
  }
  50% {
    box-shadow: 0 6px 20px rgba(255, 69, 0, 0.5);
  }
}

/* 載入遮罩優化 */
#loadingOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #2d1b69, #11998e, #38ef7d);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: white;
  font-family: 'Orbitron', sans-serif;
  overflow: hidden;
}

#loadingOverlay::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 30% 40%, rgba(56, 239, 125, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(17, 153, 142, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 20%, rgba(45, 27, 105, 0.15) 0%, transparent 50%);
  animation: pageGlowOptimized 4s ease-in-out infinite;
}

@keyframes pageGlowOptimized {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* BOSS戰鬥載入遮罩 */
#battleLoadingOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  color: white;
  font-family: 'Orbitron', sans-serif;
  overflow: hidden;
}

#battleLoadingOverlay.boss-battle {
  background: linear-gradient(135deg, #2d1b69, #8b0000, #ff4500);
}

#battleLoadingOverlay.boss-battle::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 25% 25%, rgba(255, 0, 0, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(255, 69, 0, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(139, 0, 0, 0.25) 0%, transparent 50%);
  animation: bossBattleGlowOptimized 3s ease-in-out infinite;
}

@keyframes bossBattleGlowOptimized {
  0%, 100% { 
    opacity: 0.7; 
    transform: scale(1); 
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1); 
  }
}

#battleLoadingOverlay::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 100, 100, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(100, 100, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(255, 255, 100, 0.08) 0%, transparent 50%);
  animation: bgPulseOptimized 5s ease-in-out infinite;
}

@keyframes bgPulseOptimized {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.battle-loading-container {
  text-align: center;
  position: relative;
  z-index: 1;
}

.battle-title {
  font-size: 3em;
  font-weight: 900;
  color: #ff6b6b;
  text-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
  margin-bottom: 30px;
  animation: titleGlowOptimized 2s ease-in-out infinite alternate;
}

.normal-title {
  font-size: 2em;
  font-weight: 700;
  color: #00caca;
  text-shadow: 0 0 6px rgba(0, 202, 202, 0.3);
  margin-bottom: 20px;
  animation: normalTitleGlowOptimized 2s ease-in-out infinite alternate;
}

.battle-title.boss {
  color: var(--boss-color);
  text-shadow: 0 0 25px rgba(255, 69, 0, 0.8);
  animation: bossTitleGlowOptimized 1.5s ease-in-out infinite alternate;
}

@keyframes titleGlowOptimized {
  from { text-shadow: 0 0 15px rgba(255, 107, 107, 0.6); }
  to { text-shadow: 0 0 25px rgba(255, 107, 107, 0.8); }
}

@keyframes normalTitleGlowOptimized {
  from { text-shadow: 0 0 6px rgba(0, 202, 202, 0.3); }
  to { text-shadow: 0 0 15px rgba(0, 202, 202, 0.6); }
}

@keyframes bossTitleGlowOptimized {
  from { 
    text-shadow: 0 0 25px rgba(255, 69, 0, 0.8);
    transform: scale(1);
  }
  to { 
    text-shadow: 0 0 40px rgba(255, 69, 0, 1);
    transform: scale(1.03);
  }
}

.battle-icon {
  font-size: 4em;
  margin-bottom: 15px;
  animation: iconBounceOptimized 2s ease-in-out infinite;
}

.battle-icon.boss {
  animation: bossIconPulseOptimized 1.5s ease-in-out infinite;
}

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

@keyframes bossIconPulseOptimized {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 15px rgba(255, 69, 0, 0.6));
  }
  50% { 
    transform: scale(1.1);
    filter: drop-shadow(0 0 25px rgba(255, 69, 0, 0.9));
  }
}

.loading-text {
  font-size: 1.1em;
  margin-bottom: 20px;
  color: #ffd93d;
  animation: textFadeOptimized 2s ease-in-out infinite alternate;
  font-weight: 600;
}

.loading-text.boss {
  color: var(--boss-color);
  font-weight: 700;
  animation: bossTextPulseOptimized 1.5s ease-in-out infinite alternate;
}

@keyframes textFadeOptimized {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

@keyframes bossTextPulseOptimized {
  from { 
    opacity: 0.8;
    transform: scale(1);
  }
  to { 
    opacity: 1;
    transform: scale(1.02);
  }
}

/* 優化：簡化進度條動畫 */
.progress-container {
  width: 500px;
  max-width: 80vw;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  margin: 15px auto;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-container.boss {
  border: 2px solid rgba(255, 69, 0, 0.4);
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ffd93d, #4ecdc4);
  background-size: 200% 100%;
  border-radius: 25px;
  width: 0%;
  transition: width 0.3s ease;
  animation: gradientShiftOptimized 3s linear infinite;
  position: relative;
}

.progress-bar.boss {
  background: linear-gradient(90deg, var(--boss-color), #dc143c, #b22222);
  animation: bossGradientShiftOptimized 2s linear infinite;
}

@keyframes gradientShiftOptimized {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes bossGradientShiftOptimized {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shineOptimized 2s ease-in-out infinite;
}

@keyframes shineOptimized {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  font-size: 1.2em;
  margin-top: 15px;
  color: #b8e6ff;
  font-weight: bold;
}

.progress-text.boss {
  color: var(--boss-color);
  text-shadow: 0 0 8px rgba(255, 69, 0, 0.4);
}

.battle-tips {
  margin-top: 25px;
  font-size: 0.95em;
  color: #ffffcc;
  line-height: 1.6;
  font-weight: 400;
}

.battle-tips.boss {
  color: #b8e6ff;
  font-weight: 600;
  animation: tipsPulseOptimized 3s ease-in-out infinite;
}

@keyframes tipsPulseOptimized {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* 優化：簡化粒子效果 */
.particles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: floatOptimized 8s linear infinite;
  will-change: transform;
}

.particle.normal {
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
}

.particle.boss {
  width: 4px;
  height: 4px;
  background: rgba(255, 69, 0, 0.6);
  box-shadow: 0 0 6px rgba(255, 69, 0, 0.4);
}

@keyframes floatOptimized {
  0% {
    transform: translate3d(0, 100vh, 0);
    opacity: 0;
  }
  10%, 90% {
    opacity: 1;
  }
  100% {
    transform: translate3d(50px, -100px, 0);
    opacity: 0;
  }
}

/* ===== 電影輪播載入模式 ===== */

/* 輪播層 — 預設隱藏 */
.carousel-layer {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.cinema-bar-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: clamp(36px, 6vh, 56px);
  background: #000;
  z-index: 3;
}

.carousel-img {
  position: absolute;
  top: clamp(36px, 6vh, 56px);
  left: 0; right: 0;
  bottom: calc(100px + var(--cinema-bottom-inset, 0px));
  width: 100%;
  height: auto;
  max-height: calc(100% - clamp(36px, 6vh, 56px) - 100px - var(--cinema-bottom-inset, 0px));
  object-fit: contain;
  -webkit-user-drag: none;
  pointer-events: none;
}

.cinema-gradient {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 30%,
    rgba(0, 0, 0, 0.5) 65%,
    #000 100%
  );
  z-index: 2;
  pointer-events: none;
}

.cinema-message {
  display: none;
  position: absolute;
  bottom: calc(clamp(100px, 15vh, 160px) + var(--cinema-bottom-inset, 0px));
  left: 24px; right: 24px;
  font-size: 1.4em;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
  z-index: 4;
  line-height: 1.6;
  font-family: 'Orbitron', sans-serif;
}

/* --- cinema-active 切換 --- */

#loadingOverlay.cinema-active {
  background: var(--cinema-fallback-bg, #0a0a1a) !important;
}

#loadingOverlay.cinema-active::before {
  display: none;
}

#loadingOverlay.cinema-active .carousel-layer {
  display: block;
}

/* 隱藏經典模式的居中元素 */
#loadingOverlay.cinema-active .particles,
#loadingOverlay.cinema-active .battle-icon,
#loadingOverlay.cinema-active .normal-title,
#loadingOverlay.cinema-active .battle-tips {
  display: none !important;
}

/* 底部資訊列 — flexbox + order 排列：進度條(1) → 文字(2) + 百分比(3) */
#loadingOverlay.cinema-active .battle-loading-container {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 0 28px;
  padding-bottom: calc(max(36px, env(safe-area-inset-bottom, 12px)) + var(--cinema-bottom-inset, 0px));
  z-index: 10;
}

#loadingOverlay.cinema-active .progress-container {
  order: 1;
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  height: 4px;
  border-radius: 2px;
  margin: 0 0 10px 0;
  border: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.15);
}

#loadingOverlay.cinema-active .progress-bar {
  border-radius: 2px;
}

#loadingOverlay.cinema-active .progress-bar::after {
  display: none;
}

#loadingOverlay.cinema-active .loading-text {
  order: 2;
  flex: 1;
  font-size: 1em;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  animation: none;
  font-weight: 400;
}

#loadingOverlay.cinema-active .progress-text {
  order: 3;
  margin: 0 0 0 auto;
  font-size: 1em;
  color: rgba(255, 255, 255, 0.7);
}

/* 手機適配 */
@media (max-width: 768px) {
  .cinema-bar-top {
    height: clamp(28px, 4vh, 40px);
  }
  .carousel-img {
    top: clamp(28px, 4vh, 40px);
    bottom: calc(90px + var(--cinema-bottom-inset, 0px));
    max-height: calc(100% - clamp(28px, 4vh, 40px) - 90px - var(--cinema-bottom-inset, 0px));
  }
  .cinema-message {
    left: 16px; right: 16px;
    font-size: 1.15em;
    bottom: calc(clamp(90px, 14vh, 140px) + var(--cinema-bottom-inset, 0px));
  }
  #loadingOverlay.cinema-active .battle-loading-container {
    padding: 0 16px;
    padding-bottom: calc(max(28px, env(safe-area-inset-bottom, 8px)) + var(--cinema-bottom-inset, 0px));
  }
}

/* 通用標題樣式優化 */
.fancy-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2em;
  color: var(--accent-color);
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
  text-align: center;
  margin-bottom: 20px;
  animation: titlePulseOptimized 3s infinite alternate;
}

.fancy-subtitle {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5em;
  color: #ffd93d;
  margin-top: 30px;
  margin-bottom: 10px;
  text-shadow: 0 0 4px rgba(255, 217, 61, 0.3);
}

@keyframes titlePulseOptimized {
  from { text-shadow: 0 0 8px rgba(0, 255, 255, 0.4); }
  to { text-shadow: 0 0 15px rgba(0, 255, 255, 0.7); }
}

/* 初始遮罩樣式 */
#initialOverlay {
  position: fixed;
  z-index: 9999;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  color: white;
  font-family: sans-serif;
  font-size: 1.5em;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* pre 標籤樣式 */
pre {
  white-space: pre-wrap;
}

/* 響應式設計優化 */
@media (max-width: 768px) {
  /* 移動設備性能優化 */
  body::before {
    animation: none;
    opacity: 0.5;
  }
  
  .section::before {
    animation: none;
  }
  
  .boss-title::before,
  .boss-title::after {
    animation: none;
  }
  
  #content {
    flex-direction: column;
    padding: 20px 10px;
  }
  
  .battle-title {
    font-size: 2em;
  }
  
  .battle-icon {
    font-size: 3em;
  }
  
  .progress-container {
    width: 300px;
  }
}

/* 電量友善模式 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1s !important;
  }
  
  body::before {
    animation: none;
  }
}

/* 性能優化類別 */
.performance-optimized {
  will-change: auto;
}

.performance-optimized.animating {
  will-change: transform;
}

/* 高對比模式支持 */
@media (prefers-contrast: high) {
  :root {
    --accent-color: #ffffff;
    --boss-color: #ff0000;
  }
}


/* ==================== 全局滾軸樣式 ==================== */
/* 主要滾軸樣式 - 應用於 html 和 body */
html, body {
    scrollbar-width: thin;
    scrollbar-color: #00ffff #202038;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 12px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffff 0%, #0099cc 100%);
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(0,255,255,0.2);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00e0ff 0%, #0077aa 100%);
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: #202038;
    border-radius: 8px;
}

/* 通用容器滾軸樣式 */
.container::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.modal-footer::-webkit-scrollbar {
    width: 10px;
}

.container::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.modal-footer::-webkit-scrollbar-track {
    background: rgba(0, 255, 255, 0.04);
    border-radius: 8px;
}

.container::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.modal-footer::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffff 0%, #0099cc 100%);
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(0,255,255,0.2);
}

.container::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.modal-footer::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00e0ff 0%, #0077aa 100%);
}

/* 列表專用滾軸樣式 */
.list-container::-webkit-scrollbar,
.mail-list::-webkit-scrollbar {
    width: 8px;
}

.list-container::-webkit-scrollbar-track,
.mail-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.list-container::-webkit-scrollbar-thumb,
.mail-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00ffff, #0099cc);
    border-radius: 4px;
}

.list-container::-webkit-scrollbar-thumb:hover,
.mail-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00ccff, #0077aa);
}

/* Firefox 滾軸支援 */
.container,
.modal-content,
.modal-body, 
.modal-footer,
.list-container,
.mail-list {
    scrollbar-width: thin;
    scrollbar-color: #00ffff #202038;
}
