/* ============================================================
   代码高亮主题 - 王灏新视野工作室
   支持 C-like 语言 / Python / Bash
   ============================================================ */

/* --- 代码块容器 --- */
pre {
  position: relative;
  background: #1e2430;
  color: #abb2bf;
  border-radius: 8px;
  padding: 2.2em 1.4em 1.2em; /* 顶部加高，给语言标签和复制按钮留出空间 */
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
  font-size: .875rem;
  line-height: 1.7;
  margin: 1.2em 0;
  border: 1px solid rgba(255,255,255,.06);
}

/* 语言标签 — 左上角 */
pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 7px;
  left: 12px;
  font-size: .7rem;
  color: rgba(171,178,191,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
  pointer-events: none;
  user-select: none;
}

pre code {
  background: none !important;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  white-space: pre;
}

/* 行内代码 */
:not(pre) > code {
  background: rgba(37, 99, 235, .08);
  color: #d97706;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .875em;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  border: 1px solid rgba(37, 99, 235, .12);
}

/* --- Token 颜色 --- */
.hl-keyword   { color: #c678dd; }          /* 关键字：if/for/class/def */
.hl-builtin   { color: #e5c07b; }          /* 内置函数/类型 */
.hl-type      { color: #e5c07b; }          /* 类型名 */
.hl-string    { color: #98c379; }          /* 字符串 */
.hl-comment   { color: #5c6370; font-style: italic; }  /* 注释 */
.hl-number    { color: #d19a66; }          /* 数字 */
.hl-operator  { color: #56b6c2; }          /* 运算符 */
.hl-function  { color: #61afef; }          /* 函数名 */
.hl-variable  { color: #e06c75; }          /* 变量名（$var）*/
.hl-decorator { color: #c678dd; }          /* 装饰器 @xxx */
.hl-bash-cmd  { color: #61afef; }          /* shell 命令 */
.hl-bash-flag { color: #d19a66; }          /* shell 参数 -x */
.hl-bash-var  { color: #e5c07b; }          /* shell 变量 $VAR */

/* 暗色主题下代码块不做额外处理（本身已是暗色背景） */

/* --- 代码复制按钮 --- */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(171,178,191,.7);
  border-radius: 4px;
  padding: 3px 9px;
  font-size: .72rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  z-index: 2;
  line-height: 1.6;
}
.code-copy-btn:hover {
  background: rgba(255,255,255,.15);
  color: #abb2bf;
}
.code-copy-btn.copied {
  color: #98c379;
  border-color: #98c379;
}

/* pre 须是 relative 才能定位复制按钮（已在上方声明） */
