/**
 * 代码块样式：完全对齐 yolos.cn（handsome 主题 mac_light 模式 + vditor 行号 + highlight.js github 配色）
 * 对齐依据（抓取自 yolos.cn 实测 computed style）：
 *   pre  : class="mac_light mac_pre"  padding 0  border-radius 5px  background #eee  box-shadow 0 2px 6px rgba(0,0,0,.1)
 *   code : class="lang-xxx hljs vditor-linenumber"  padding 15px 15px 15px 52px  background #f3f3f3  color #333  font 13px Menlo
 *   行号 : .vditor-linenumber__rows{position:absolute;top:15px;left:0;width:3em} + span:before{counter, color hsla(0,4%,60.4%,.38), padding-right 1em, text-align right}
 *   复制 : .vditor-copy 悬停显示，剪贴板 SVG 图标
 */
.markdown pre {
  position: relative;
  margin: 1.5em 0;
  padding: 0 !important;
  border: none !important;
  border-radius: 5px !important;
  background: #eee !important;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .10);
}

/* macOS 三色圆点（对应 .mac_pre:before） */
.markdown pre.mac_pre:before {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff0800;
  background-size: 40px;
  margin: 8px 0 8px 8px;
  box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
}

/* 代码区（对应 .mac_light code） */
.markdown pre code {
  display: block;
  position: relative;
  overflow-x: auto;
  margin: 0 !important;
  padding: 15px !important;
  border: none !important;
  border-radius: 0 !important;
  background: #f3f3f3 !important;
  color: #333 !important;
  font-size: 13px !important;
  line-height: 1.4285714 !important;
  white-space: pre !important;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace !important;
}

.markdown pre code.hljs {
  background: #f3f3f3 !important;
  padding: 15px !important;
}

/* 行号（与 vditor 完全一致） */
.markdown pre code.vditor-linenumber {
  padding: 15px !important;
  padding-left: 4em !important;
  position: relative;
}
.markdown pre code .vditor-linenumber__rows {
  position: absolute;
  pointer-events: none;
  top: 15px;
  left: 0;
  width: 3em;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  counter-reset: linenumber;
}
.markdown pre code .vditor-linenumber__rows > span {
  display: block;
  counter-increment: linenumber;
}
.markdown pre code .vditor-linenumber__rows > span:before {
  content: counter(linenumber);
  color: hsla(0, 4%, 60.4%, .38);
  display: block;
  padding-right: 1em;
  text-align: right;
}

/* 复制按钮（对应 .vditor-copy，悬停显示） */
.markdown pre .vditor-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  z-index: 2;
}
.markdown pre:hover .vditor-copy { display: block; }
.markdown pre .vditor-copy textarea {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.markdown pre .vditor-copy > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .85);
  color: #555;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  transition: background .2s, color .2s;
}
.markdown pre .vditor-copy > span:hover {
  background: #fff;
  color: #22a06b;
}
.markdown pre .vditor-copy svg {
  width: 15px;
  height: 15px;
}

/* 滚动条 */
.markdown pre code::-webkit-scrollbar { height: 8px; }
.markdown pre code::-webkit-scrollbar-track { background: transparent; }
.markdown pre code::-webkit-scrollbar-thumb { background: #c9c9c9; border-radius: 4px; }
.markdown pre code::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }

/* 触屏设备常显复制按钮 */
@media (hover: none) {
  .markdown pre .vditor-copy { display: block; }
}
