/* 响应式样式表 - 简约风格 */
:root {
  --primary-color: #4a90e2;
  --text-color: #333333;
  --background-color: #ffffff;
  --secondary-background: #f5f7fa;
  --border-color: #e0e0e0;
  --link-color: #4a90e2;
  --link-hover-color: #2a6fc9;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 基础样式重置 */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  line-height: 1.5;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--background-color);
  overflow-x: hidden;
  max-width: 100%;
}

/* 响应式图片 */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
}

/* 响应式视频 */
video {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
  background-color: #000;
}

/* 视频容器样式 */
.video-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 的宽高比 */
  height: 0;
  overflow: hidden;
  margin: 1rem auto;
}

.video-responsive video,
.video-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* 响应式排版 */
p, ul, ol, blockquote {
  margin-bottom: 1rem;
  padding: 0 1rem;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding: 0 1rem;
  line-height: 1.3;
}

/* 列表样式优化 */
ul, ol {
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* 链接样式 */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover, a:focus {
  color: var(--link-hover-color);
  text-decoration: underline;
}

/* 响应式表格 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  overflow-x: auto;
  display: block;
}

th, td {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

th {
  background-color: var(--secondary-background);
}

/* 代码块样式 */
pre, code {
  background-color: var(--secondary-background);
  border-radius: 3px;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  padding: 0.2rem 0.4rem;
  overflow-x: auto;
}

pre {
  padding: 1rem;
  margin: 1rem 0;
}

pre code {
  padding: 0;
  background-color: transparent;
}

/* 引用块样式 */
blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
  margin-left: 0;
  color: #666;
  font-style: italic;
}

/* 响应式布局 - 移动优先 */
.container {
  width: 100%;
  padding: 0 1rem;
  margin: 0 auto;
}

/* 评论区iframe响应式 */
iframe {
  width: 100%;
  max-width: 100%;
  border: none;
}

/* 媒体查询 - 平板设备 */
@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
  
  h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote {
    padding: 0;
  }
  
  /* 平板设备视频大小 */
  video:not(.video-responsive video) {
    max-width: 90%;
  }
}

/* 媒体查询 - 桌面设备 */
@media (min-width: 1024px) {
  .container {
    max-width: 960px;
    padding: 0;
  }
  
  html {
    font-size: 18px;
  }
  
  /* 桌面设备视频大小 */
  video:not(.video-responsive video) {
    max-width: 80%;
  }
}

/* 媒体查询 - 大屏设备 */
@media (min-width: 1280px) {
  .container {
    max-width: 1140px;
  }
  
  /* 大屏设备视频大小 */
  video:not(.video-responsive video) {
    max-width: 70%;
  }
}

/* 导航菜单样式 - 移动端汉堡菜单 */
.nav-toggle {
  display: block;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 0.5rem;
  cursor: pointer;
}

.nav-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 80%;
  height: 100%;
  background: var(--background-color);
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  transition: left 0.3s ease;
  z-index: 999;
  overflow-y: auto;
  padding: 1rem;
}

.nav-menu.active {
  left: 0;
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  display: none;
}

.nav-overlay.active {
  display: block;
}

/* 媒体查询 - 桌面导航 */
@media (min-width: 1024px) {
  .nav-toggle {
    display: none;
  }
  
  .nav-menu {
    position: static;
    width: auto;
    height: auto;
    box-shadow: none;
    background: transparent;
    padding: 0;
    overflow: visible;
  }
}

/* 辅助类 */
.text-center {
  text-align: center;
}

.hidden {
  display: none;
}

.visible-mobile {
  display: block;
}

.visible-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .visible-mobile {
    display: none;
  }
  
  .visible-desktop {
    display: block;
  }
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary-color);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 99;
}

.back-to-top.visible {
  opacity: 1;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #f0f0f0;
    --background-color: #121212;
    --secondary-background: #1e1e1e;
    --border-color: #333333;
  }
}

.back-to-previous {
  position: fixed;
  bottom: 60px;
  right: 20px;
  display: none;
  background-color: #007bff;
  color: white;
  padding: 10px 14px;
  border-radius: 50%;
  text-decoration: none;
  font-size: 20px;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.back-to-previous.visible {
  display: block;
}

