/* ==========================================
   MDUI 官网风格样式
   完全模仿 https://www.mdui.org/zh-cn/docs/2/
   ========================================== */

/* 全局变量 */
:root {
  --sidebar-width: 280px;
  --topbar-height: 56px;
  --content-bg: #ffffff;
  --text-primary: rgba(0, 0, 0, 0.87);
  --text-secondary: rgba(0, 0, 0, 0.6);
  --text-hint: rgba(0, 0, 0, 0.38);
  --border-color: rgba(0, 0, 0, 0.12);
  --primary-color: #1976d2;
  --surface-color: #ffffff;
  
  /* 覆盖MDUI navigation-drawer的默认宽度 */
  --mdui-comp-navigation-drawer-width: 280px;
}

/* 暗色主题 */
.mdui-theme-dark {
  --content-bg: #121212;
  --surface-color: #1e1e1e;
  --text-primary: rgba(255, 255, 255, 0.87);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-hint: rgba(255, 255, 255, 0.38);
  --border-color: rgba(255, 255, 255, 0.12);
}

/* 基础样式 */
* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  background-color: var(--content-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* ==========================================
   顶部工具栏 - 白色背景
   ========================================== */
mdui-top-app-bar {
  background-color: var(--surface-color) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12) !important;
  height: var(--topbar-height) !important;
}

mdui-top-app-bar mdui-top-app-bar-title {
  color: var(--text-primary) !important;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
}

mdui-top-app-bar mdui-button-icon {
  width: 40px;
  height: 40px;
  --mdui-comp-button-icon-color: var(--text-secondary);
}

mdui-top-app-bar mdui-button-icon::part(button) {
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

mdui-top-app-bar mdui-button-icon:hover {
  --mdui-comp-button-icon-container-color: rgba(0, 0, 0, 0.04);
}

.mdui-theme-dark mdui-top-app-bar mdui-button-icon:hover {
  --mdui-comp-button-icon-container-color: rgba(255, 255, 255, 0.08);
}

mdui-top-app-bar mdui-button-icon mdui-icon {
  font-size: 24px;
}

/* 搜索框 */
.search-container {
  margin: 0 16px;
}

#search-input {
  width: 240px;
  height: 36px;
  --mdui-comp-text-field-container-color: rgba(0, 0, 0, 0.04);
  --mdui-comp-text-field-container-shape: 4px;
  --mdui-comp-text-field-label-text-size: 14px;
  --mdui-comp-text-field-input-text-size: 14px;
}

.mdui-theme-dark #search-input {
  --mdui-comp-text-field-container-color: rgba(255, 255, 255, 0.08);
}

#search-input::part(container) {
  border-radius: 4px;
}

/* ==========================================
   左侧导航栏 - 浅色背景（和顶部一致）
   ========================================== */
mdui-navigation-drawer.doc-drawer {
  /* 使用MDUI的CSS变量来控制宽度 */
  --mdui-comp-navigation-drawer-width: 280px;
  width: 280px !important;
  max-width: none !important;
  min-width: 280px !important;
  background-color: var(--surface-color) !important;
  border-right: 1px solid var(--border-color);
  box-shadow: none;
}

/* 尝试使用::part穿透Shadow DOM */
mdui-navigation-drawer.doc-drawer::part(panel) {
  width: 280px !important;
  max-width: none !important;
  min-width: 280px !important;
}

mdui-navigation-drawer.doc-drawer::part(container) {
  width: 280px !important;
  max-width: none !important;
  min-width: 280px !important;
}

/* 侧边栏调整大小手柄 */
.drawer-resize-handle {
  position: fixed;
  top: 0;
  left: calc(var(--sidebar-width) - 4px);
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 999;
  transition: left 0.1s ease, background-color 0.2s ease;
  display: none;
}

.drawer-resize-handle:hover,
.drawer-resize-handle.resizing {
  background-color: var(--primary-color);
}

.drawer-resize-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 40px;
  background: transparent;
}

/* 侧边栏头部 */
.drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background-color: var(--surface-color);
}

.drawer-header .logo-text {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-primary);
}

/* 侧边栏列表 */
.doc-drawer mdui-list {
  padding: 8px 0;
  background: transparent !important;
}

/* 侧边栏子标题 */
.doc-drawer mdui-list-subheader {
  color: var(--text-hint) !important;
  font-weight: 500 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  padding: 16px 16px 8px !important;
  line-height: 1;
}

/* 侧边栏菜单项 - 使用 CSS Parts */
.doc-drawer mdui-list-item {
  margin: 0 8px !important;
  border-radius: 4px !important;
  height: 40px !important;
  --mdui-comp-list-item-container-color: transparent;
  --mdui-comp-list-item-label-text-color: var(--text-secondary);
  --mdui-comp-list-item-label-text-size: 14px;
  --mdui-comp-list-item-label-text-weight: 400;
  --mdui-comp-list-item-label-text-line-height: 1.43;
  display: flex !important;
  align-items: center !important;
  position: relative;
  gap: 0 !important;
}

.doc-drawer mdui-list-item::part(container) {
  border-radius: 4px;
  transition: background-color 0.2s ease;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  height: 100%;
  width: 100%;
  gap: 0 !important;
}

/* 菜单项文本包装器 */
.menu-text-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  margin-right: 4px;
  display: block;
}

.menu-text-wrapper .menu-text {
  display: inline-block;
  white-space: nowrap;
  transition: transform 0.3s ease;
  will-change: transform;
  max-width: fit-content;
}

/* 悬停时只滚动超长文本 */
.doc-drawer mdui-list-item.has-long-text:hover .menu-text-wrapper .menu-text.is-long {
  animation: menu-text-scroll 4s linear infinite;
  animation-delay: 0.5s;
}

/* 菜单文本滚动动画 - 平滑滚动 */
@keyframes menu-text-scroll {
  0%, 15% {
    transform: translateX(0);
  }
  85%, 100% {
    transform: translateX(calc(-100% + 120px));
  }
}

.doc-drawer mdui-list-item:hover {
  --mdui-comp-list-item-container-color: rgba(0, 0, 0, 0.04);
  --mdui-comp-list-item-label-text-color: var(--text-primary);
}

.mdui-theme-dark .doc-drawer mdui-list-item:hover {
  --mdui-comp-list-item-container-color: rgba(255, 255, 255, 0.08);
}

.doc-drawer mdui-list-item[active] {
  --mdui-comp-list-item-container-color: rgba(25, 118, 210, 0.12);
  --mdui-comp-list-item-label-text-color: var(--primary-color);
  --mdui-comp-list-item-label-text-weight: 500;
}

/* 折叠组件样式 */
.doc-drawer mdui-collapse {
  margin: 0 8px;
}

.doc-drawer mdui-collapse-item {
  border-radius: 4px;
  overflow: hidden;
}

.doc-drawer mdui-collapse-item mdui-list-item[slot="header"] {
  margin: 0 !important;
  --mdui-comp-list-item-container-color: transparent;
  --mdui-comp-list-item-label-text-color: var(--text-secondary);
  --mdui-comp-list-item-label-text-size: 14px;
  --mdui-comp-list-item-label-text-weight: 500;
  display: flex !important;
  align-items: center !important;
  position: relative;
}

.doc-drawer mdui-collapse-item mdui-list-item[slot="header"]::part(container) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.doc-drawer mdui-collapse-item mdui-list-item[slot="header"]:hover {
  --mdui-comp-list-item-container-color: rgba(0, 0, 0, 0.04);
  --mdui-comp-list-item-label-text-color: var(--text-primary);
}

.mdui-theme-dark .doc-drawer mdui-collapse-item mdui-list-item[slot="header"]:hover {
  --mdui-comp-list-item-container-color: rgba(255, 255, 255, 0.08);
}

/* 子菜单项样式 */
.doc-drawer mdui-collapse-item div mdui-list-item {
  margin: 0 !important;
  height: 36px !important;
  --mdui-comp-list-item-container-color: transparent;
  --mdui-comp-list-item-label-text-size: 13px;
  --mdui-comp-list-item-label-text-color: var(--text-hint);
  display: flex !important;
  align-items: center !important;
  position: relative;
}

.doc-drawer mdui-collapse-item div mdui-list-item::part(container) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
}

.doc-drawer mdui-collapse-item div mdui-list-item:hover {
  --mdui-comp-list-item-container-color: rgba(0, 0, 0, 0.04);
  --mdui-comp-list-item-label-text-color: var(--text-secondary);
}

.mdui-theme-dark .doc-drawer mdui-collapse-item div mdui-list-item:hover {
  --mdui-comp-list-item-container-color: rgba(255, 255, 255, 0.08);
}


/* ==========================================
   主内容区
   ========================================== */
.doc-container {
  display: flex;
  /* margin-top: var(--topbar-height); */
  /* margin-left: var(--sidebar-width); */
  min-height: calc(100vh - var(--topbar-height));
}

.doc-content {
  flex: 1;
  max-width: 1040px;
  padding: 0px 45px;
  background-color: var(--content-bg);
}

/* 面包屑 */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 13px;
}

.breadcrumb mdui-icon {
  font-size: 16px;
}

/* ==========================================
   Markdown 内容样式
   ========================================== */
.markdown-body {
  line-height: 1.6;
  font-size: 14px;
  color: var(--text-primary);
}

.markdown-body h1 {
  font-size: 32px;
  font-weight: 400;
  margin: 0 0 24px 0;
  color: var(--text-primary);
  line-height: 1.25;
}

.markdown-body h2 {
  font-size: 24px;
  font-weight: 400;
  margin: 48px 0 16px 0;
  color: var(--text-primary);
  line-height: 1.33;
}

.markdown-body h3 {
  font-size: 20px;
  font-weight: 500;
  margin: 32px 0 16px 0;
  color: var(--text-primary);
  line-height: 1.4;
}

.markdown-body h4 {
  font-size: 16px;
  font-weight: 500;
  margin: 24px 0 12px 0;
  color: var(--text-primary);
  line-height: 1.5;
}

.markdown-body p {
  margin: 16px 0;
  line-height: 1.6;
}

.markdown-body a {
  color: var(--primary-color);
  text-decoration: none;
  transition: opacity 0.2s;
}

.markdown-body a:hover {
  opacity: 0.8;
}

.markdown-body code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.875em;
  color: #e83e8c;
}

.mdui-theme-dark .markdown-body code {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ff79c6;
}

.markdown-body pre {
  background-color: #282a36;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.markdown-body pre code {
  background-color: transparent;
  padding: 0;
  color: #f8f8f2;
}

.markdown-body blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2rem;
  margin: 1rem 0;
}

.markdown-body li {
  margin: 0.5rem 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

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

.markdown-body table th {
  background-color: rgba(0, 0, 0, 0.02);
  font-weight: 500;
}

.mdui-theme-dark .markdown-body table th {
  background-color: rgba(255, 255, 255, 0.05);
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1rem 0;
}

/* 文档描述 */
.doc-description {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 16px 0 32px 0;
  line-height: 1.5;
}

/* ==========================================
   右侧目录
   ========================================== */
.doc-toc {
  width: 240px;
  padding: 2rem 1rem;
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
  height: fit-content;
  max-height: calc(100vh - var(--topbar-height) - 40px);
  overflow-y: auto;
  border-left: 1px solid var(--border-color);
}

.toc-title {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toc-nav {
  display: flex;
  flex-direction: column;
}

.toc-item {
  display: block;
  padding: 0.4rem 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: color 0.2s;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
}

.toc-item:hover {
  color: var(--primary-color);
}

.toc-item.active {
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

.toc-level-3 {
  padding-left: 1.5rem;
}

.toc-level-4 {
  padding-left: 2.25rem;
}

/* ==========================================
   页脚
   ========================================== */
.doc-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.doc-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.doc-footer a:hover {
  color: var(--primary-color);
}

/* ==========================================
   搜索对话框
   ========================================== */
#search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-result-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.mdui-theme-dark .search-result-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.search-result-title {
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.search-result-snippet {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================
   回到顶部按钮 - 纯净小火箭设计
   ========================================== */
.rocket-button {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 1000;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  border: none;
  outline: none;
  user-select: none;
}

.rocket-button mdui-icon {
  font-size: 32px;
  color: var(--primary-color);
  transition: all 0.3s ease;
  animation: rocket-float 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(25, 118, 210, 0.3));
  transform: rotate(-45deg);
}

.mdui-theme-dark .rocket-button mdui-icon {
  color: #64b5f6;
}

.rocket-button:hover {
  transform: translateY(-8px) scale(1.1);
}

.rocket-button:hover mdui-icon {
  color: #1565c0;
  animation: rocket-launch 0.6s ease-out;
  filter: drop-shadow(0 4px 8px rgba(25, 118, 210, 0.5));
}

.mdui-theme-dark .rocket-button:hover mdui-icon {
  color: #90caf9;
}

.rocket-button:active {
  transform: translateY(-4px) scale(1.05);
  transition: all 0.1s ease;
}

/* 小火箭浮动动画 */
@keyframes rocket-float {
  0%, 100% {
    transform: translateY(0) rotate(-45deg);
  }
  50% {
    transform: translateY(-6px) rotate(-45deg);
  }
}

/* 小火箭发射动画 */
@keyframes rocket-launch {
  0% {
    transform: translateY(0) rotate(-45deg);
  }
  50% {
    transform: translateY(-12px) rotate(-45deg) scale(1.1);
  }
  100% {
    transform: translateY(0) rotate(-45deg);
  }
}

/* ==========================================
   响应式设计
   ========================================== */
@media (max-width: 1200px) {
  .doc-toc {
    display: none;
  }
}

@media (max-width: 960px) {


  .doc-container {
    margin-left: 0;
    overflow-x: hidden;
  }

  mdui-navigation-drawer.doc-drawer {
    --mdui-comp-navigation-drawer-width: 280px;
    position: fixed !important;
    width: 280px !important;
    max-width: none !important;
    min-width: 280px !important;
  }
  
  mdui-navigation-drawer.doc-drawer::part(panel),
  mdui-navigation-drawer.doc-drawer::part(container) {
    width: 280px !important;
    max-width: none !important;
    min-width: 280px !important;
  }

  .search-container {
    display: none;
  }

  .doc-content {
    padding: 1.5rem 1rem;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* 移动端确保隐藏调整手柄 */
  .drawer-resize-handle {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  
  /* 移动端内容防溢出 */
  .markdown-body {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* 移动端代码块防溢出 */
  .markdown-body pre[class*="language-"] {
    max-width: 100%;
    overflow-x: auto;
    margin-left: 0;
    margin-right: 0;
  }
  
  .markdown-body pre[class*="language-"].line-numbers {
    padding-left: 3.5rem !important;
  }
  
  /* 移动端表格防溢出 */
  .markdown-body table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 移动端图片防溢出 */
  .markdown-body img {
    max-width: 100%;
    height: auto;
  }
  
  /* 移动端隐藏编辑器按钮 */
  .editor-btn {
    display: none !important;
  }
}

@media (max-width: 600px) {
  mdui-navigation-drawer.doc-drawer {
    --mdui-comp-navigation-drawer-width: 280px;
    width: 280px !important;
    max-width: none !important;
    min-width: 280px !important;
  }
  
  mdui-navigation-drawer.doc-drawer::part(panel),
  mdui-navigation-drawer.doc-drawer::part(container) {
    width: 280px !important;
    max-width: none !important;
    min-width: 280px !important;
  }
  
  /* 小屏幕内容调整 */
  .doc-content {
    padding: 0px 0.75rem;
  }

  .markdown-body h1 {
    font-size: 1.75rem;
  }

  .markdown-body h2 {
    font-size: 1.4rem;
  }

  .markdown-body h3 {
    font-size: 1.2rem;
  }
  
  /* 小屏幕代码块调整 */
  .markdown-body pre[class*="language-"] {
    font-size: 13px;
    padding: 2.5rem 0.75rem 0.75rem 0.75rem;
  }
  
  .markdown-body pre[class*="language-"].line-numbers {
    padding-left: 3rem !important;
  }
  
  .markdown-body pre[class*="language-"] code {
    font-size: 13px;
  }
}

/* ==========================================
   滚动条样式
   ========================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.mdui-theme-dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.mdui-theme-dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   密码保护图标
   ========================================== */
.password-lock-icon {
  font-size: 16px !important;
  color: var(--text-hint) !important;
  opacity: 0.6;
  margin-left: 4px;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.doc-drawer mdui-list-item:hover .password-lock-icon {
  opacity: 1;
  color: var(--text-secondary) !important;
}

.doc-drawer mdui-list-item[active] .password-lock-icon {
  color: var(--primary-color) !important;
  opacity: 0.8;
}

/* 确保图标不被文本覆盖 */
.doc-drawer mdui-list-item mdui-icon[slot="icon"] {
  flex-shrink: 0;
  margin-right: 12px;
}

.doc-drawer mdui-list-item mdui-icon[slot="end-icon"] {
  flex-shrink: 0;
  margin-left: 4px;
}

/* ==========================================
   代码块深度美化样式 - Okaidia 主题 + macOS 风格
   ========================================== */

/* 代码块容器 - macOS 窗口风格 */
.markdown-body pre[class*="language-"] {
  position: relative;
  background: #272822;
  border-radius: 8px;
  padding: 2.8rem 1.5rem 1.5rem 1.5rem;
  margin: 2rem 0;
  box-shadow: none;
  overflow-x: auto;
  border: 1px solid var(--mdui-color-outline-variant);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.markdown-body pre[class*="language-"]:hover {
  border-color: var(--mdui-color-primary);
}

.markdown-body pre[class*="language-"]:hover .code-copy-btn {
  opacity: 1;
}

/* 暗色主题优化 */
.mdui-theme-dark .markdown-body pre[class*="language-"] {
  background: #1e1e1e;
  border-color: var(--mdui-color-outline-variant);
}

.mdui-theme-dark .markdown-body pre[class*="language-"]:hover {
  border-color: var(--mdui-color-primary);
}

/* macOS 风格标题栏 - 透明 */
.markdown-body pre[class*="language-"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.3rem;
  background: transparent;
  border-bottom: 1px solid var(--mdui-color-outline-variant);
  border-radius: 8px 8px 0 0;
  pointer-events: none;
}

/* macOS 风格圆点 - 红黄绿 */
.markdown-body pre[class*="language-"]::after {
  content: '';
  position: absolute;
  top: 0.85rem;
  left: 1rem;
  width: 12px;
  height: 12px;
  background: #ff5f56;
  border-radius: 50%;
  box-shadow: 
    0 0 0 0.5px rgba(0, 0, 0, 0.15),
    20px 0 0 0 #ffbd2e,
    20px 0 0 0.5px rgba(0, 0, 0, 0.15),
    40px 0 0 0 #27c93f,
    40px 0 0 0.5px rgba(0, 0, 0, 0.15);
  z-index: 2;
  pointer-events: none;
}

/* 自定义复制按钮 - 右上角 */
.code-copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 1rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--mdui-color-surface-container-highest);
  color: var(--mdui-color-on-surface-variant);
  border: 1px solid var(--mdui-color-outline-variant);
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: "Roboto", sans-serif;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.code-copy-btn:hover {
  background-color: var(--mdui-color-surface-container-high);
  color: var(--mdui-color-on-surface);
  border-color: var(--mdui-color-primary);
  transform: translateY(-1px);
}

.code-copy-btn:active {
  transform: translateY(0);
}

.code-copy-btn.copied {
  background-color: var(--mdui-color-tertiary-container);
  color: var(--mdui-color-on-tertiary-container);
  border-color: var(--mdui-color-tertiary-container);
}

/* 代码内容样式 */
.markdown-body pre[class*="language-"] code {
  font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.7;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* 代码内容区域 */
.markdown-body pre[class*="language-"] > code {
  display: block;
}

/* 行号样式 - 覆盖 Prism 默认样式 */
.markdown-body pre[class*="language-"].line-numbers {
  counter-reset: linenumber 0;
  padding-left: 4.5rem !important;
  position: relative;
}

.markdown-body pre[class*="language-"].line-numbers > code {
  position: relative;
  white-space: inherit;
}

/* 使用更高优先级选择器覆盖 Prism 插件样式 */
.markdown-body pre.line-numbers .line-numbers-rows,
.markdown-body .line-numbers .line-numbers-rows {
  position: absolute !important;
  pointer-events: none;
  letter-spacing: -1px;
  user-select: none;
  border-right: 1px solid rgba(102, 217, 239, 0.15) !important;
  padding: 0 !important;
  padding-right: 0.75rem !important;
  text-align: right;
  box-sizing: border-box;
}

.line-numbers-rows > span {
  display: block;
  counter-increment: linenumber;
}

.line-numbers-rows > span:before {
  content: counter(linenumber);
  color: rgba(117, 113, 94, 0.8);
  display: block;
  text-align: right;
  font-size: 12px;
  line-height: 23.8px;
  transition: color 0.2s ease;
}

.markdown-body pre[class*="language-"].line-numbers:hover .line-numbers-rows > span:before {
  color: rgba(166, 226, 46, 0.6);
}

/* 代码块滚动条美化 - Okaidia 配色 */
.markdown-body pre[class*="language-"]::-webkit-scrollbar {
  height: 10px;
}

.markdown-body pre[class*="language-"]::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0 0 10px 0;
}

.markdown-body pre[class*="language-"]::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(102, 217, 239, 0.5), rgba(166, 226, 46, 0.5));
  border-radius: 5px;
  transition: background 0.3s ease;
}

.markdown-body pre[class*="language-"]::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, rgba(102, 217, 239, 0.7), rgba(166, 226, 46, 0.7));
}

/* 行高亮效果 */
.markdown-body pre[class*="language-"] .line-highlight {
  background: rgba(102, 217, 239, 0.1);
  border-left: 3px solid #66d9ef;
  margin-top: 0;
  margin-left: -1.5rem;
  padding-left: calc(1.5rem - 3px);
}

/* 内联代码优化 - Okaidia 配色 */
.markdown-body code:not([class*="language-"]) {
  background: linear-gradient(135deg, rgba(102, 217, 239, 0.15), rgba(166, 226, 46, 0.15));
  color: #f92672;
  padding: 0.25em 0.5em;
  border-radius: 4px;
  font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
  font-weight: 500;
  border: 1px solid rgba(249, 38, 114, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.markdown-body code:not([class*="language-"]):hover {
  background: linear-gradient(135deg, rgba(102, 217, 239, 0.22), rgba(166, 226, 46, 0.22));
  border-color: rgba(249, 38, 114, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.mdui-theme-dark .markdown-body code:not([class*="language-"]) {
  background: linear-gradient(135deg, rgba(102, 217, 239, 0.18), rgba(166, 226, 46, 0.18));
  color: #fd971f;
  border-color: rgba(253, 151, 31, 0.3);
}

.mdui-theme-dark .markdown-body code:not([class*="language-"]):hover {
  background: linear-gradient(135deg, rgba(102, 217, 239, 0.25), rgba(166, 226, 46, 0.25));
  border-color: rgba(253, 151, 31, 0.45);
}

/* 移动端优化 */
@media (max-width: 600px) {
  .markdown-body pre[class*="language-"] {
    padding: 2.8rem 1rem 1rem;
    border-radius: 6px;
    margin: 1.5rem 0;
  }
  
  .markdown-body pre[class*="language-"] code {
    font-size: 13px;
    line-height: 1.6;
  }
  
  .markdown-body pre[class*="language-"].line-numbers {
    padding-left: 3.5rem !important;
  }
  
  .markdown-body pre.line-numbers .line-numbers-rows,
  .markdown-body .line-numbers .line-numbers-rows {
    padding: 0 !important;
    padding-right: 0.5rem !important;
  }
  
  .markdown-body .line-numbers-rows > span:before {
    line-height: 20.8px !important;
  }
  
  /* 移动端圆点稍小 */
  .markdown-body pre[class*="language-"]::after {
    width: 10px;
    height: 10px;
    top: 0.9rem;
    box-shadow: 
      0 0 0 0.5px rgba(0, 0, 0, 0.15),
      16px 0 0 0 #ffbd2e,
      16px 0 0 0.5px rgba(0, 0, 0, 0.15),
      32px 0 0 0 #27c93f,
      32px 0 0 0.5px rgba(0, 0, 0, 0.15);
  }
  
  /* 移动端复制按钮始终显示 */
  .code-copy-btn {
    opacity: 1;
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
  }
}
