/**
     * PrismJS 1.30.0 - 深色主题优化版
 * 基于 Prism Dark 主题修改，适配深色背景的代码高亮显示
 * 包含行号、工具栏和复制到剪贴板功能
 */

/* ===== 基础代码样式 ===== */
code[class*="language-"],
pre[class*="language-"] {
    /* 文字和背景设置 */
    color: #e8e8e8;                    /* 主文字颜色 - 浅灰色 */
    background: #1a1a1a;               /* 主背景色 - 深灰色 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* 文字阴影增强可读性 */

    /* 字体设置 */
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 1em;
    text-align: left;

    /* 排版设置 */
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;

    /* 制表符和连字符 */
    -moz-tab-size: 4;
    -o-tab-size: 4;
    tab-size: 4;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    hyphens: none;
}

/* 打印样式 - 移除阴影效果 */
@media print {
    code[class*="language-"],
    pre[class*="language-"] {
        text-shadow: none;
    }
}

/* ===== 代码块容器样式 ===== */

/* 代码块和行内代码的背景色 */
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
    background: #2d2d2d;               /* 代码块背景色 - 中灰色 */
}

/* 代码块特定样式 */
pre[class*="language-"] {
    padding: 1.2em;                    /* 内边距 */
    margin: 0.8em 0;                   /* 外边距 */
    overflow: auto;                    /* 溢出时显示滚动条 */
    border: 1px solid #444;            /* 边框颜色 */
    border-radius: 8px;                /* 圆角边框 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); /* 阴影效果 */
}

/* 行内代码样式 */
:not(pre) > code[class*="language-"] {
    padding: 0.2em 0.4em;              /* 内边距 */
    border-radius: 4px;                /* 小圆角 */
    border: 1px solid #555;            /* 边框 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* 小阴影 */
    white-space: normal;               /* 允许换行 */
    background: #2d2d2d;               /* 背景色 */
}

/* ===== 语法高亮颜色定义 ===== */

/* 注释类 - 绿色 */
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog {
    color: #6a9955;                    /* 注释绿色 */
}

/* 标点符号 - 半透明 */
.token.punctuation {
    opacity: 0.7;                      /* 降低不透明度 */
}

/* 命名空间 - 半透明 */
.token.namespace {
    opacity: 0.7;
}

/* 布尔值、常量、数字、属性、符号、标签 - 浅绿色 */
.token.boolean,
.token.constant,
.token.number,
.token.property,
.token.symbol,
.token.tag {
    color: #b5cea8;                    /* 浅绿色 */
}

/* 属性名、内置函数、字符、插入内容、选择器、字符串 - 橙色 */
.token.attr-name,
.token.builtin,
.token.char,
.token.inserted,
.token.selector,
.token.string {
    color: #ce9178;                    /* 橙色 */
}

/* CSS字符串、实体、操作符、URL、变量 - 浅灰色 */
.language-css .token.string,
.style .token.string,
.token.entity,
.token.operator,
.token.url,
.token.variable {
    color: #d4d4d4;                    /* 浅灰色 */
}

/* @规则、属性值、关键字 - 紫色 */
.token.atrule,
.token.attr-value,
.token.keyword {
    color: #c586c0;                    /* 紫色 */
}

/* 重要标识、正则表达式 - 红色 */
.token.important,
.token.regex {
    color: #d16969;                    /* 红色 */
}

/* 文本修饰 */
.token.bold,
.token.important {
    font-weight: 700;                  /* 粗体 */
}

.token.italic {
    font-style: italic;                /* 斜体 */
}

/* 实体 - 显示帮助光标 */
.token.entity {
    cursor: help;
}

/* 删除内容 - 橙色 */
.token.deleted {
    color: #ce9178;
}

/* ===== 行号功能样式 ===== */

/* 行号容器 */
pre[class*="language-"].line-numbers {
    position: relative;
    padding-left: 3.8em;               /* 为行号留出左边距 */
    counter-reset: linenumber;         /* 重置行号计数器 */
    background: #2d2d2d;               /* 添加：与代码块背景色一致 */
}

pre[class*="language-"].line-numbers > code {
    position: relative;
    white-space: inherit;
    background: transparent;           /* 添加：透明背景 */
}

/* 行号列样式 */
.line-numbers .line-numbers-rows {
    position: absolute;
    pointer-events: none;              /* 禁止鼠标事件 */
    top: 0;
    font-size: 100%;
    left: -3.8em;                      /* 定位到左侧 */
    width: 3em;                        /* 固定宽度 */
    letter-spacing: -1px;              /* 字母间距 */
    border-right: 1px solid #444;      /* 右侧分隔线 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;                 /* 禁止文本选择 */
    background: #2d2d2d;               /* 修改：与代码块背景色一致 */
}

/* 单个行号项 */
.line-numbers-rows > span {
    display: block;
    counter-increment: linenumber;     /* 递增行号 */
    background: #2d2d2d;               /* 添加：每个行号项背景色 */
}

/* 行号数字显示 */
.line-numbers-rows > span:before {
    content: counter(linenumber);      /* 显示行号 */
    color: #6c6c6c;                    /* 行号颜色 - 深灰色 */
    display: block;
    padding-right: 0.8em;              /* 右内边距 */
    text-align: right;                 /* 右对齐 */
    background: #2d2d2d;               /* 添加：行号数字背景色 */
}

/* ===== 工具栏功能样式 ===== */

/* 工具栏容器 */
div.code-toolbar {
    position: relative;
}

/* 工具栏主体 */
div.code-toolbar > .toolbar {
    position: absolute;
    z-index: 10;                       /* 确保在最上层 */
    top: 0.5em;                        /* 顶部定位 */
    right: 0.5em;                      /* 右侧定位 */
    transition: opacity 0.3s ease-in-out; /* 透明度过渡动画 */
    opacity: 0;                        /* 默认隐藏 */
}

/* 悬停时显示工具栏 */
div.code-toolbar:hover > .toolbar {
    opacity: 1;
}

/* 获得焦点时显示工具栏 */
div.code-toolbar:focus-within > .toolbar {
    opacity: 1;
}

/* 工具栏项容器 */
div.code-toolbar > .toolbar > .toolbar-item {
    display: inline-block;
}

/* 工具栏链接 */
div.code-toolbar > .toolbar > .toolbar-item > a {
    cursor: pointer;
}

/* 工具栏按钮重置 */
div.code-toolbar > .toolbar > .toolbar-item > button {
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    line-height: normal;
    overflow: visible;
    padding: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 工具栏按钮和链接通用样式 */
div.code-toolbar > .toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar > .toolbar-item > span {
    color: #ccc;                       /* 文字颜色 */
    font-size: 0.8em;                  /* 较小字体 */
    padding: 0.4em 0.8em;              /* 内边距 */
    background: #3d3d3d;               /* 背景色 */
    border: 1px solid #555;            /* 边框 */
    border-radius: 4px;                /* 圆角 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* 阴影 */
}

/* 工具栏项交互状态 */
div.code-toolbar > .toolbar > .toolbar-item > a:focus,
div.code-toolbar > .toolbar > .toolbar-item > a:hover,
div.code-toolbar > .toolbar > .toolbar-item > button:focus,
div.code-toolbar > .toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar > .toolbar-item > span:focus,
div.code-toolbar > .toolbar > .toolbar-item > span:hover {
    color: #fff;                       /* 悬停文字颜色 */
    background: #4d4d4d;               /* 悬停背景色 */
    border-color: #666;                /* 悬停边框色 */
    text-decoration: none;
}

/* ===== 复制按钮特殊样式 ===== */

.copy-to-clipboard-button {
    background: #3d3d3d !important;    /* 背景色 */
    border: 1px solid #555 !important; /* 边框 */
    color: #ccc !important;            /* 文字颜色 */
    transition: all 0.2s ease;         /* 过渡动画 */
}

.copy-to-clipboard-button:hover {
    background: #4d4d4d !important;    /* 悬停背景色 */
    border-color: #666 !important;     /* 悬停边框色 */
    color: #fff !important;            /* 悬停文字颜色 */
}

/* ===== 文章内容适配样式 ===== */

/* 确保在文章内容中代码块正确显示 */
.article-content pre[class*="language-"] {
    background: #2d2d2d !important;    /* 代码块背景 */
    border: 1px solid #444 !important; /* 代码块边框 */
}

/* 行内代码在文章中的样式 */
.article-content code:not(pre code) {
    background: #3d3d3d !important;    /* 行内代码背景 */
    border: 1px solid #555 !important; /* 行内代码边框 */
    color: #ce9178 !important;         /* 行内代码文字颜色 */
}