/* 教程页面CSS变量 - 支持亮色和暗色主题 */
:root {
  /* 教程页面特有的色彩 */
  --primary-color: #483d8b;
  --secondary-color: #9b59b6;
  --accent-color: #d4af37;
  --bg-light: #f2f0f7;
  --text-color: #333;
  --tutorial-bg: rgba(242, 240, 247, 0.9);
  --section-bg: white;
  --section-border: rgba(212, 175, 55, 0.1);
  --section-title-color: #483d8b;
  --section-text-color: #333;
  --tip-box-bg: rgba(212, 175, 55, 0.08);
  --tip-box-border: #d4af37;
  --transition-fast: 0.3s;
  --transition-medium: 0.5s;
  --shadow-light: 0 6px 16px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 10px 30px rgba(72, 61, 139, 0.15);
}

/* 暗色主题样式 */
[data-theme="dark"] {
  --primary-color: #9370DB; /* 比亮色主题还要亮一点的紫色 */
  --secondary-color: #b66ad4;
  --accent-color: #ffd700; /* 增强金色对比度 */
  --bg-light: #2d2925;
  --text-color: #e9e2d0;
  --tutorial-bg: rgba(45, 41, 37, 0.95);
  --section-bg: #1a1a2e; /* 深色背景 */
  --section-border: rgba(212, 175, 55, 0.2);
  --section-title-color: #9b85ff; /* 浅紫色标题 */
  --section-text-color: #e9e2d0; /* 浅色文本提高可读性 */
  --tip-box-bg: rgba(212, 175, 55, 0.1);
  --tip-box-border: #d4af37;
  --shadow-light: 0 6px 16px rgba(0, 0, 0, 0.2);
  --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* 添加页面性能优化CSS类 */
.ping-value {
  transition: color 0.3s ease;
}

.ping-excellent { color: #4CAF50; }
.ping-good { color: #2196F3; }
.ping-average { color: #FF9800; }
.ping-poor { color: #F44336; }

.tutorial-container {
  max-width: 900px;
  margin: 30px auto;
  padding: 30px;
  background: var(--tutorial-bg);
  border-radius: 15px;
  box-shadow: var(--shadow-medium);
  position: relative;
  overflow: hidden;
  /* 移除可能导致显示问题的contain属性 */
  color: var(--section-text-color); /* 确保文字颜色跟随主题 */
}

.tutorial-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
  will-change: transform; /* 提示浏览器优化变换 */
}

.tutorial-header {
  text-align: center;
  margin-bottom: 40px;
}

.tutorial-title-container {
  position: relative;
  display: inline-block;
  padding: 25px 50px;
  margin: 0 auto;
  background: rgba(72, 61, 139, 0.03);
  border-radius: 8px;
}

.tutorial-title {
  color: var(--primary-color);
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 2.2rem;
  margin: 0;
  letter-spacing: 1px;
}

/* 仅在非移动端应用更高级的样式效果 */
@media (min-width: 769px) {
  .tutorial-title {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
}

/* 在移动端使用纯色文字 */
@media (max-width: 768px) {
  .tutorial-title {
    color: var(--primary-color);
  }
}

.corner-decoration {
  position: absolute;
  width: 25px;
  height: 25px;
  border: 2px solid #d4af37;
  transition: all 0.3s ease;
}

.top-left {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}

.top-right {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}

.bottom-left {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}

.bottom-right {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

.tutorial-section {
  margin-bottom: 40px;
  padding: 25px;
  background: var(--section-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-light);
  position: relative;
  border: 1px solid var(--section-border);
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
  /* 移除可能导致显示问题的contain属性 */
  color: var(--section-text-color); /* 文字颜色跟随主题 */
}

/* 仅在非触摸设备上应用悬停效果 */
@media (hover: hover) {
  .tutorial-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(72, 61, 139, 0.1);
  }
}

/* 触摸设备上使用active状态替代hover */
.tutorial-section:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(72, 61, 139, 0.08);
}

.tutorial-section h2 {
  color: var(--section-title-color);
  font-family: 'Noto Serif SC', serif;
  font-size: 1.7rem;
  margin-top: 0;
  margin-bottom: 15px;
  position: relative;
  padding-bottom: 10px;
  display: inline-block;
}

.section-decoration {
  height: 3px;
  width: 120px;
  background: linear-gradient(to right, #d4af37, #9b59b6, transparent);
  margin-bottom: 25px;
  border-radius: 3px;
}

.tutorial-section p {
  color: var(--section-text-color);
  line-height: 1.8; /* 增加行高以便阅读歌诀 */
  margin-bottom: 15px;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
}

.tutorial-section .hexagram-list li {
    margin-bottom: 18px; /* 增加列表项间距 */
}

.hexagram-list, .note-list {
  padding-left: 5px;
  list-style-type: none;
}

.hexagram-list li, .note-list li {
  margin-bottom: 12px;
  line-height: 1.7;
  position: relative;
  padding-left: 25px;
}

.hexagram-list li::before, .note-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-size: 1.5em;
  top: -0.2em;
}

.note-list li::before {
  content: '✧';
  color: var(--secondary-color);
}

.hexagram-list li strong {
    font-size: 1.1em; /* 略微增大六神名称字号 */
}

.step-guide {
  margin: 30px 0;
}

.step {
  display: flex;
  margin-bottom: 25px;
  align-items: flex-start;
}

.step-number {
  background: linear-gradient(135deg, #483d8b, #9b59b6);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.3rem;
  margin-right: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 8px rgba(155, 89, 182, 0.4);
  position: relative;
  z-index: 1;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.step-number::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #d4af37, #9b59b6);
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.step:hover .step-number::after {
  opacity: 1;
}

.step-content {
  flex: 1;
}

.step-content h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--section-title-color);
  font-size: 1.4rem;
  font-weight: 600;
  position: relative;
  display: inline-block;
}

.step-content h3::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, #d4af37, transparent);
  transition: width 0.3s ease;
}

.step:hover .step-content h3::after {
  width: 100%;
}

.tip-box {
  background-color: var(--tip-box-bg);
  border-left: 4px solid var(--tip-box-border);
  padding: 18px;
  margin: 20px 0;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.1);
  color: var(--section-text-color);
}

.tip-box::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, transparent 50%, rgba(212, 175, 55, 0.1) 50%);
  border-top-right-radius: 8px;
}

.tip-box p {
  margin: 0;
}

.action-buttons {
  text-align: center;
  margin: 50px 0 20px;
  position: relative;
}

.action-buttons::before, .action-buttons::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 100px;
  height: 1px;
  background: linear-gradient(to right, #d4af37, transparent);
}

.action-buttons::before {
  left: 20%;
}

.action-buttons::after {
  right: 20%;
  background: linear-gradient(to left, #d4af37, transparent);
}

.tutorial-button {
  display: inline-block;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  touch-action: manipulation; /* 优化触摸操作 */
}

/* 防止暗色主题下按钮文字不可见 */
[data-theme="dark"] .tutorial-button {
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 5px 15px rgba(155, 89, 182, 0.6);
}

/* 简化按钮渐变，避免伪元素和复杂效果 */
.tutorial-button:hover, .tutorial-button:focus {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(155, 89, 182, 0.5);
}

/* 移动端触摸设备使用简化效果 */
@media (hover: none) {
  .tutorial-button:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(155, 89, 182, 0.3);
  }
}

/* 移动端优化 - 修复显示问题 */
@media (max-width: 768px) {
  .tutorial-container {
    padding: 15px;
    margin: 20px 10px;
    border-radius: 10px; /* 减小圆角 */
    /* 移除导致显示问题的contain属性 */
    display: block; /* 确保正确显示 */
  }

  .tutorial-title {
    font-size: 1.8rem;
  }

  .tutorial-title-container {
    padding: 15px 20px; /* 缩小内边距 */
  }

  .tutorial-section {
    padding: 15px;
    margin-bottom: 25px; /* 减小间距 */
    border-radius: 8px; /* 减小圆角 */
  }

  .step {
    flex-direction: column;
    margin-bottom: 20px; /* 减小间距 */
  }

  .step-number {
    margin-bottom: 10px;
    width: 35px; /* 缩小尺寸 */
    height: 35px;
  }
  
  /* 减少不必要的动画和效果 */
  .corner-decoration {
    width: 20px; /* 缩小装饰 */
    height: 20px;
  }
  
  /* 优化移动端的触摸区域 */
  .tutorial-button {
    padding: 12px 20px;
    display: block; /* 全宽按钮 */
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    font-size: 1.1rem;
  }
  
  /* 减少不必要的装饰 */
  .action-buttons::before, .action-buttons::after {
    width: 50px; /* 缩短装饰线 */
  }
  
  /* 优化文本和间距 */
  .step-content h3 {
    font-size: 1.3rem;
  }
}
