.app-root {
  /* 整体占满屏幕，使用 flex 布局 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh; /* 确保在 iframe 中占满高度 */
  padding: 32px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #fdfcfb 0%, #f7f7f8 50%, #fdfcfb 100%);
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  margin: 0;
  overflow: hidden; /* 防止滚动条出现在子页面 */
}

/* 导航栏 iframe 容器 */
#navigationFrame {
  width: 100%;
  height: 80px; /* 固定导航栏高度 */
  border: none;
  flex-shrink: 0;
  display: block;
  background: #ffffff;
  margin-bottom: 24px; /* 与下方内容保持间距 */
  border-radius: 12px;
  overflow: hidden; /* 确保圆角生效 */
}

/* 标题区域 */
.app-header {
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 20px;
  padding: 20px 0 0 0;
}

.app-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.title-main {
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
  position: relative;
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.title-main::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  border-radius: 2px;
}

.title-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: #9ca3af;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Cover Flow 容器 */
.coverflow-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 32px;
  /* iTunes Cover Flow 风格的透视效果 */
  perspective: 2000px;
  perspective-origin: 50% 50%;
  pointer-events: auto; /* 确保容器可以接收点击事件 */
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
  border-radius: 20px;
}

.coverflow-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  pointer-events: auto; /* 确保包装器可以接收点击事件 */
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* 卡片信息显示（右下角） */
.card-info {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  pointer-events: none; /* 不拦截鼠标事件 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
}

.coverflow {
  position: relative;
  width: 100%;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  margin: 0 auto;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.coverflow-card {
  position: absolute;
  width: 300px;
  height: 400px;
  /* iTunes Cover Flow 风格的平滑动画 - 使用更自然的缓动函数 */
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer !important; /* 强制显示手型指针 */
  transform-style: preserve-3d;
  transform-origin: center center;
  pointer-events: auto; /* 确保所有卡片都可以点击 */
  /* 为遮罩层提供定位基准 */
  /* 注意：遮罩层不应该继承 3D 变换 */
  will-change: transform; /* 优化动画性能 */
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.coverflow-card.prev-2 {
  /* iTunes Cover Flow 风格：更自然的旋转角度和深度 */
  transform: translateX(-600px) translateZ(-400px) rotateY(60deg);
  opacity: 1; /* 完全可见，清晰显示 */
  z-index: 0;
  pointer-events: auto; /* 确保侧边卡片可以点击 */
  cursor: pointer !important; /* 强制显示手型指针 */
}

.coverflow-card.prev-1 {
  /* iTunes Cover Flow 风格：更自然的旋转角度和深度 */
  transform: translateX(-300px) translateZ(-200px) rotateY(45deg);
  opacity: 1; /* 完全可见，清晰显示 */
  z-index: 1;
  pointer-events: auto; /* 确保侧边卡片可以点击 */
  cursor: pointer !important; /* 强制显示手型指针 */
}

.coverflow-card.current {
  /* 中心卡片：完全可见，无旋转，在最前面 */
  transform: translateX(0) translateZ(0) rotateY(0deg) scale(1);
  opacity: 1;
  z-index: 3;
  pointer-events: auto; /* 确保中间卡片可以点击 */
  cursor: pointer !important; /* 强制显示手型指针 */
}

.coverflow-card.next-1 {
  /* iTunes Cover Flow 风格：更自然的旋转角度和深度 */
  transform: translateX(300px) translateZ(-200px) rotateY(-45deg);
  opacity: 1; /* 完全可见，清晰显示 */
  z-index: 1;
  pointer-events: auto; /* 确保侧边卡片可以点击 */
  cursor: pointer !important; /* 强制显示手型指针 */
}

.coverflow-card.next-2 {
  /* iTunes Cover Flow 风格：更自然的旋转角度和深度 */
  transform: translateX(600px) translateZ(-400px) rotateY(-60deg);
  opacity: 1; /* 完全可见，清晰显示 */
  z-index: 0;
  pointer-events: auto; /* 确保侧边卡片可以点击 */
  cursor: pointer !important; /* 强制显示手型指针 */
}

.coverflow-card.hidden {
  opacity: 0;
  pointer-events: none;
  /* 注意：不设置 display: none，因为由 JavaScript 的 style.display 控制 */
  /* 确保 hidden 类不会覆盖内联样式 */
  display: none !important;
}

.card-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(139, 92, 246, 0.1);
  overflow: hidden;
  transform-style: preserve-3d;
  backface-visibility: visible;
  pointer-events: auto;
  position: relative; /* 为遮罩层定位 */
  transition: all 0.3s ease;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.coverflow-card.current .card-content {
  border: 2px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 12px 48px rgba(139, 92, 246, 0.25), 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 透明交互遮罩层 - 避免3D形变干扰鼠标事件 */
.card-interaction-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer !important; /* 强制显示手型指针 */
  pointer-events: auto !important; /* 强制启用事件 */
  z-index: 9999; /* 确保在最上层 */
  background: transparent; /* 完全透明 */
  border-radius: 12px; /* 与卡片圆角一致 */
  /* 关键：不应用任何 3D 变换，保持平面 */
  transform: none !important;
  transform-style: flat !important;
  backface-visibility: visible;
}

.image-container {
  width: 100%;
  height: 85%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  pointer-events: auto;
  cursor: pointer; /* 确保图片容器也显示手型指针 */
}

.card-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  background: transparent;
  pointer-events: auto;
  user-select: none;
  cursor: pointer; /* 确保图片也显示手型指针 */
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 10;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.image-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 6px;
  font-size: 12px;
  z-index: 10;
  white-space: nowrap;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.card-label {
  height: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* 卡片下载按钮 */
.card-download-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transition: all 0.2s ease;
  z-index: 10000; /* 确保在遮罩层之上 */
  pointer-events: auto;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.card-download-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.6);
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

.card-download-btn:active {
  transform: scale(0.95);
}

/* 底部控制面板 */
.panel-card {
  flex-shrink: 0;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 32px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(229, 231, 235, 0.8);
  backdrop-filter: blur(10px);
}

.control-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.folder-label {
  font-size: 15px;
  color: #4b5563;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  /* 禁用文字选中 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.folder-input {
  width: 200px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s;
}

.folder-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 子页面容器 */
.page-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* 允许 flex 子元素收缩 */
}

#pageFrame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* SeqAniPlayer 页面专用样式 */

/* 控制行布局 */
.control-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 600px;
}

.control-row:not(:last-child) {
  margin-bottom: 0;
}

/* 滑动条容器 */
.slider-container {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

/* FPS 滑动条样式 */
.fps-slider {
  flex: 1;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #ddd6fe 0%, #a78bfa 50%, #8b5cf6 100%);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fps-slider:hover {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 8px rgba(139, 92, 246, 0.3);
}

/* 滑块轨道 - WebKit (Chrome, Safari, Edge) */
.fps-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: transparent;
}

/* 滑块按钮 - WebKit */
.fps-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(139, 92, 246, 0.5), 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  margin-top: -7px;
  border: 2px solid #ffffff;
}

.fps-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.fps-slider::-webkit-slider-thumb:active {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.8);
}

/* 滑块轨道 - Firefox */
.fps-slider::-moz-range-track {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(to right, #ddd6fe 0%, #a78bfa 50%, #8b5cf6 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 滑块按钮 - Firefox */
.fps-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(139, 92, 246, 0.5), 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.fps-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.fps-slider::-moz-range-thumb:active {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.8);
}

/* FPS 数值显示 */
.fps-value {
  min-width: 80px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  color: #ffffff;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.fps-value:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5), 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* 内容区域（用于子页面） */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 20px;
}

/* 基础样式 - 适用于主页面和子页面 */
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

html {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app-header {
    margin-bottom: 20px;
    padding: 15px 0;
  }

  .title-main {
    font-size: 28px;
    letter-spacing: 1px;
  }

  .title-subtitle {
    font-size: 12px;
  }

  .coverflow {
    height: 400px;
  }

  .coverflow-card {
    width: 250px;
    height: 350px;
  }
}

@media (max-width: 480px) {
  .app-root {
    padding: 15px;
  }

  .title-main {
    font-size: 24px;
  }

  .title-subtitle {
    font-size: 11px;
  }
}

/* ========================================
   全局 Loading 遮罩
   ======================================== */

.global-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.global-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.global-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 48px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.global-loading-spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 5px solid rgba(139, 92, 246, 0.15);
  border-top-color: #8b5cf6;
  border-bottom-color: #8b5cf6;
  animation: spin-global 0.9s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  position: relative;
}

.global-loading-spinner::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  animation: pulse-global 1.5s ease-in-out infinite;
}

.global-loading-text {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.5px;
}

@keyframes spin-global {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-global {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

/* ========================================
   全局文字提示 (Alert)
   ======================================== */

.global-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.global-alert.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.global-alert .alert-message {
  padding: 16px 32px;
  background: rgba(31, 41, 55, 0.95);
  color: white;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}