/* 工具卡片字体（仅用于 .sir-tool-card，避免影响全站/其它 Markdown） */
@font-face {
  font-family: "sir-toolcard-font";
  /* Seraphina:
   * 字体属于“跨域资源”，浏览器会按 CORS 规则拦截（即使 200 也会拒用）。
   * 解决方案：
   * 1) 推荐：把字体放到主题目录内同源加载（无需 CORS）：
   *    - 保存到：/wp-content/themes/scriptirc/assets/fonts/toolcard.woff2
   *    - CSS 这里用相对路径 ../fonts/toolcard.woff2
   * 2) 备用：若坚持用 OSS，请在 OSS 配置 CORS：允许 Origin（127.0.0.1 与正式域名）并允许 GET。
   */
  src:
    url("../fonts/toolcard.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

.sir-md {
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: #e5e7eb;
}

.sir-md p {
  margin: 0 0 .65rem 0;
  line-height: 1.8;
}

.sir-md a {
  color: #2d8cf0;
  text-decoration: none;
  position: relative;
}

.sir-md a:hover {
  text-decoration: underline;
}

.sir-md :not(pre)>code {
  color: #96d9a8;
  background: #15192229;
  border: 1px solid #1f2937;
  border-radius: 3px;
  padding: .15em .35em;
  font-family: Consolas, monospace;
  font-size: .875rem;
}

.sir-md pre {
  background: #0f1318;
  border-radius: 6px;
  padding: 0;
  margin: .75rem 0;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #1f2937;
}

.sir-md pre code {
  background: transparent;
  border: none;
  border-radius: 0;
  display: block;
  padding: 12px 14px;
  line-height: 1.6;
  font-family: Consolas, Monaco, Menlo, monospace;
}

.sir-md .sir-code {
  position: relative;
  margin: .75rem 0;
  border: 1px solid #1f2937;
  border-radius: 6px;
  overflow: hidden;
}

.sir-md .sir-code.sir-collapsed pre {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.sir-md .sir-code pre {
  margin: 0;
  padding-top: 36px;
  border-radius: 0;
  background: transparent;
  border: none;
  max-height: 560px;
  opacity: 1;
  transition: max-height .3s ease, opacity .3s ease;
}

/* 隐藏纵向滚动条但允许滚轮滚动 */
.sir-md pre {
  -ms-overflow-style: none; /* IE/Edge legacy */
  scrollbar-width: none; /* Firefox: 会同时隐藏横向滚动条外观 */
}
.sir-md pre::-webkit-scrollbar:vertical { width: 0; }
.sir-md pre::-webkit-scrollbar-thumb:vertical { background: transparent; }
.sir-md pre::-webkit-scrollbar-track:vertical { background: transparent; }
/* 保留横向滚动条外观（WebKit/Blink 可见，Firefox 被上面规则隐藏） */
.sir-md pre::-webkit-scrollbar:horizontal { height: 8px; }

.sir-md .sir-code-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  min-height: 36px;
  height: auto;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  z-index: 2;
  backdrop-filter: blur(6px);
}

.sir-md .sir-java-bar {
  gap: 8px;
}

.sir-md .sir-code.sir-collapsed .sir-java-meta {
  display: none;
}

.sir-md .sir-java-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.sir-md .sir-java-meta .sir-plugin {
  font-weight: 700;
  color: #e5e7eb;
}

.sir-md .sir-java-meta .sir-version {
  color: #9ca3af;
  font-size: 12px;
}

.sir-md .sir-java-meta .sir-author {
  color: #9ca3af;
  font-size: 12px;
}

.sir-md .sir-java-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.sir-md .sir-java-tools .sir-code-download {
  background: transparent;
  border: none;
  color: #e5e7eb;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

.sir-md .sir-java-tools .sir-code-download:hover { color: #ffffff; }
.sir-md .sir-java-tools .sir-code-download svg { width: 16px; height: 16px; display: block; pointer-events: none; }

.sir-md .sir-java-tools .sir-fold-toggle svg {
  transition: transform .15s ease;
}

.sir-md .sir-code:not(.sir-collapsed) .sir-java-tools .sir-fold-toggle svg {
  transform: rotate(180deg);
}

.sir-md .sir-plugin-bar {
  position: relative;
  background: #18181b;
  border-top: 1px solid rgb(255 255 255 / 1%);
  z-index: 1;
}

.sir-md .sir-plugin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sir-md .sir-plugin-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sir-md .sir-plugin-icon {
  background: rgba(16, 185, 129, .1);
  padding: 6px;
  border-radius: 10px;
  color: #34d399;
}

.sir-md .sir-plugin-title .sir-name {
  font-size: 14px;
  font-weight: 600;
  color: #e5e7eb;
}

.sir-md .sir-plugin-title .sir-sub {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.sir-md .sir-sub-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9ca3af;
}

.sir-md .sir-plugin-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sir-md .sir-chip {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 7px;
  padding: 0px 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #e5e7eb;
}

.sir-md .sir-plugin-desc {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sir-md .sir-desc-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #9ca3af;
}

.sir-md .sir-desc-row p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.sir-md .sir-plugin-perms {
  padding: 8px 12px;
}

.sir-md .sir-plugin-perms ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sir-md .sir-perm-node {
  font-family: Consolas, Monaco, Menlo, monospace;
  background: rgba(255, 255, 255, .06);
  padding: 2px 6px;
  border-radius: 6px;
  color: #e5e7eb;
  margin-right: 8px;
}

.sir-md .sir-perm-desc {
  font-size: 12px;
  color: #9ca3af;
}

.sir-md .sir-code-lang {
  font-size: 12px;
  color: #e5e7eb;
  opacity: .9;
}

.sir-md .sir-code-copy {
  background: transparent;
  border: none;
  color: #e5e7eb;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
}

.sir-md .sir-code-copy:hover {
  background: transparent;
  color: #ffffff;
}

.sir-md .sir-code-copy svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.sir-md .sir-code-copy[data-state="success"] {
  color: #10b981;
}

.sir-md .sir-code-copy[data-state="error"] {
  color: #ef4444;
}

.sir-md h1,
.sir-md h2,
.sir-md h3,
.sir-md h4,
.sir-md h5,
.sir-md h6 {
  color: #f3f4f6;
  margin: .6rem 0 .4rem 0;
  font-weight: 700;
}

.sir-md h1 {
  font-size: 1.25rem;
}

.sir-md h2 {
  font-size: 1.1rem;
}

.sir-md h3 {
  font-size: 1rem;
}

.sir-md ul,
.sir-md ol {
  margin: .5rem 0 .5rem 1.2rem;
}

/* 强制在 markdown 容器中显示列表的项目符号/编号，避免被全局样式重置 */
.sir-md ul { list-style: disc outside; padding-left: 1.2rem; }
.sir-md ol { list-style: decimal outside; padding-left: 1.2rem; }

/* 多级无序列表的标记样式优化 */
.sir-md ul ul { list-style-type: circle; }
.sir-md ul ul ul { list-style-type: square; }

/* 多级有序列表的标记样式优化 */
.sir-md ol ol { list-style-type: lower-alpha; }
.sir-md ol ol ol { list-style-type: lower-roman; }

.sir-md li {
  margin: .25rem 0;
}

.sir-md blockquote {
  margin: 12px 0;
  padding: 2px 14px;
  border-left: 4px solid #34d399;
  background: #1b1b1e;
  border-radius: 4px;
  color: #d1d5db;
}

.sir-md hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #1f2937, transparent);
  margin: 1rem 0;
}

.sir-md table {
  border-collapse: collapse;
  margin: .75rem 0;
  display: block;
  overflow-x: auto;
}

.sir-md th,
.sir-md td {
  border: 1px solid #374151;
  padding: 6px 10px;
  white-space: nowrap;
}

.sir-md img {
  max-width: 100%;
  border-radius: 6px;
  box-shadow: 0 1px 15px rgba(27, 31, 35, .15), 0 0 1px rgba(106, 115, 125, .35);
  display: block;
  margin: 12px auto;
}

/* 流式渲染：新片段淡入 */
.sir-md .sir-fade { animation: sir-fade-in .45s cubic-bezier(0.22,1,0.36,1); }
@keyframes sir-fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

/* 流式渲染：生成中最后一行“文字颜色光流”（贝壳渐变），避免盖在上层 */
.sir-md[data-generating="1"] .sir-stream-tail .sir-tail-inner,
.sir-md .sir-stream-tail[data-generating="1"] .sir-tail-inner {
  background: linear-gradient(90deg,
    #cbd5e1 0%,
    #e9d8fd 15%,
    #fbcfe8 30%,
    #fde68a 45%,
    #a7f3d0 60%,
    #bfdbfe 75%,
    #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 260% 100%;
  animation: sir-shimmer-text 2.6s linear infinite;
  text-shadow: none;
}
@keyframes sir-shimmer-text { to { background-position: 200% 0; } }

/* 工具执行卡片（全宽 + 半透明 + 高斯模糊背景） */
.sir-md .sir-tool-card {
  width: 100%;
  margin: 10px 0;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, .55);
  background: rgb(20 20 20 / 35%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  /* Seraphina: 工具卡片专用字体（来自 OSS woff2），仅影响卡片内部 */
  font-family: "sir-toolcard-font", Consolas, Monaco, monospace;
  font-synthesis: none;
}
.sir-md .sir-tool-card .sir-user-confirm-card {
  /* Seraphina: 用户确认卡片需要使用“对话正文风格”的字体，不受 sir-tool-card 专用字体影响 */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: auto;
}

/* Seraphina: 工具卡片处于“用户确认模式”时的专属布局 */
.sir-md .sir-tool-card[data-sir-user-confirm="1"] {
  /* 去掉工具卡原有的细边框与模糊背景，让确认卡片本身成为唯一视觉主角 */
  padding: 0;
  border: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sir-md .sir-tool-card[data-sir-user-confirm="1"] .sir-user-confirm-card {
  /* 让确认卡片在消息区域中看起来更“大块”：上下留白更明显，宽度全行铺满 */
  margin: 12px 0 14px;
  width: 100%;
  

  border-radius: 6px;
  border: 1px solid#165f3d;
}

.sir-md .sir-tool-inner {
  display: flex;
    align-items: center;
    gap: 5px;
}

/* 左侧动效（工具调用中）：
 * - 替代旧的 .sir-tool-loader 九宫格
 * - 全量使用 sir-tool-analyze-* 前缀，避免与主题/页面其它样式冲突
 * - 尺寸略小：通过 CSS 统一缩放显示（不改 SVG 内部 viewBox）
 */
.sir-md .sir-tool-analyze {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sir-md .sir-tool-analyze svg {
  /* 与 SVG 标注的 width/height(54) 保持一致，避免被 CSS 无意缩放 */
  width: 54px;
  height: 54px;
  display: block;
}
.sir-md .sir-tool-analyze svg path.sir-tool-analyze-stick {
  transform: translate(0);
  animation: sir-tool-analyze-stick 2s ease infinite;
}
.sir-md .sir-tool-analyze svg path.sir-tool-analyze-star-1 {
  fill: #ff4500; /* OrangeRed */
  animation: sir-tool-analyze-sparkles 2s ease infinite,
    sir-tool-analyze-scaleStars 2s ease infinite,
    sir-tool-analyze-colorChange 2s ease infinite;
  animation-delay: 150ms;
}
.sir-md .sir-tool-analyze svg path.sir-tool-analyze-star-2 {
  fill: #00ff00; /* Lime */
  animation: sir-tool-analyze-sparkles 2s ease infinite,
    sir-tool-analyze-scaleStars 2s ease infinite,
    sir-tool-analyze-colorChange 2s ease infinite;
}
.sir-md .sir-tool-analyze svg path.sir-tool-analyze-board {
  animation: sir-tool-analyze-bounce 2s ease infinite;
}

/* 左侧动效（工具调用完成）：
 * - 用户期望的结构为 minimal-loader + char 三段字符漂浮
 * - 为避免 .minimal-loader/.char 这种通用类名污染全局，这里全部命名空间化
 * - 视觉适配：按工具卡片左侧区域收敛到 54x54（避免 padding/大字号撑高卡片）
 */
.sir-md .sir-tool-done-miniloader {
  /* 默认隐藏：仅在 data-state="done" 时显示 */
  display: none;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  justify-content: center;
  align-items: center;
  gap: 1px; /* 稍微拉开一点，给发光留出空间 */
  padding: 6px; /* 原示例 15px：这里收敛以匹配 54x54 */
  background: transparent;
}

.sir-md .sir-tool-done-miniloader .sir-tool-done-char {
  position: relative; /* 为伪元素定位 */
  font-family: Consolas, Monaco, monospace;
  /* 原示例 3rem：这里收敛到卡片左侧区域可用尺寸 */
  font-size: 22px;
  line-height: 1;
  color: #ffffff;
  display: inline-block;
  font-weight: 200;
  -webkit-text-stroke: 0.9px #ffffff;
  /* 静止显示：移除位移动画，仅保留发光层动画 */
}

/* 呼吸发光层：利用伪元素单独做一个发光层 */
.sir-md .sir-tool-done-miniloader .sir-tool-done-char::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 1), 0 0 25px rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation: sir-tool-done-glowPulse 3s ease-in-out infinite;
}

/* 错落延迟（本体与伪元素同步） */
.sir-md .sir-tool-done-miniloader .sir-tool-done-char:nth-child(1),
.sir-md .sir-tool-done-miniloader .sir-tool-done-char:nth-child(1)::after { animation-delay: 0s; }
.sir-md .sir-tool-done-miniloader .sir-tool-done-char:nth-child(2),
.sir-md .sir-tool-done-miniloader .sir-tool-done-char:nth-child(2)::after { animation-delay: 0.15s; }
.sir-md .sir-tool-done-miniloader .sir-tool-done-char:nth-child(3),
.sir-md .sir-tool-done-miniloader .sir-tool-done-char:nth-child(3)::after { animation-delay: 0.3s; }

/* 2) 发光动画：只动透明度 */
@keyframes sir-tool-done-glowPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@keyframes sir-tool-analyze-sparkles {
  0% { opacity: 1; }
  35% { opacity: 1; }
  55% { opacity: 0; }
  75% { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes sir-tool-analyze-stick {
  0%   { transform: translate3d(0, 0, 0) rotate(0); }
  25%  { transform: translate3d(0, 0, 0) rotate(0); }
  50%  { transform: translate3d(3px, -2px, 0) rotate(8deg); }
  75%  { transform: translate3d(0, 0, 0) rotate(0); }
  100% { transform: translate3d(0, 0, 0) rotate(0); }
}

@keyframes sir-tool-analyze-scaleStars {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes sir-tool-analyze-bounce {
  0% { transform: translateY(0); }
  25% { transform: translateY(0); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-1px); }
  100% { transform: translateY(0); }
}

@keyframes sir-tool-analyze-colorChange {
  0% { fill: #ff4500; }  /* OrangeRed */
  25% { fill: #ffd700; } /* Gold */
  50% { fill: #00ff00; } /* Lime */
  75% { fill: #1e90ff; } /* DodgerBlue */
  100% { fill: #ff4500; } /* OrangeRed */
}

/* 右侧文案区域 */
.sir-md .sir-tool-text {
display: flex;
  flex-direction: row;
  gap: 10px;
  min-width: 0;
}
.sir-md .sir-tool-title {
  font-size: 1rem;
    font-weight: 600;
    color: #e5e7eb;
}
.sir-md .sir-tool-sub {
  font-size: 0.8rem;
    color: #9ca3af;
    margin: 0.5px;
}

/* 状态切换：运行中 / 已完成 */
.sir-md .sir-tool-card[data-state="running"] .sir-tool-title {
  color: #e5f9ff;
}
.sir-md .sir-tool-card[data-state="running"] .sir-tool-sub {
  color: #a5f3fc;
}
.sir-md .sir-tool-card[data-state="done"] {
  border-color: rgba(52, 211, 153, .5);
}
/* 工具完成后：隐藏左侧动效（避免占位、减少视觉干扰） */
.sir-md .sir-tool-card[data-state="done"] .sir-tool-analyze {
  display: none;
}
.sir-md .sir-tool-card[data-state="done"] .sir-tool-done-miniloader { display: flex; }
.sir-md .sir-tool-card[data-state="running"] .sir-tool-done-miniloader { display: none; }
.sir-md .sir-tool-card[data-state="done"] .sir-tool-title {
  color: #bbf7d0;
}
.sir-md .sir-tool-card[data-state="done"] .sir-tool-sub {
  color: #9ca3af;
}

/* WebCrawler 网页原文片段折叠卡片 */
.sir-md .sir-wc-card {
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, .45);
  background: rgba(15, 23, 42, .75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sir-md .sir-gui-layout-card {
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, .45);
  background: rgba(15, 23, 42, .78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sir-md .sir-gui-layout-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 6px;
}
.sir-md .sir-gui-grid {
  display: inline-block;
  padding: 4px;
  border-radius: 6px;
  background: rgba(15, 23, 42, .9);
}
.sir-md .sir-gui-row {
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
}
.sir-md .sir-gui-row:last-child {
  margin-bottom: 0;
}
.sir-md .sir-gui-cell {
  width: 28px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid rgba(55, 65, 81, .9);
  background: rgba(17, 24, 39, .9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sir-md .sir-gui-cell-inner {
  width: 100%;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sir-md .sir-gui-cell-icon {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.sir-md .sir-gui-cell-label {
  font-size: 0.55rem;
  line-height: 1;
  color: #9ca3af;
}
.sir-md .sir-gui-layout-summary {
  margin-top: 6px;
  font-size: 0.72rem;
  color: #9ca3af;
}
.sir-md .sir-wc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sir-md .sir-wc-title {
  font-size: 0.78rem;
  color: #cbd5f5;
}
.sir-md .sir-wc-toggle {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  background: rgba(15, 23, 42, .9);
  color: #e5e7eb;
  cursor: pointer;
}
.sir-md .sir-wc-toggle:hover {
  background: rgba(55, 65, 81, .95);
}
.sir-md .sir-wc-body {
  margin-top: 6px;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
.sir-md .sir-wc-card[data-collapsed="0"] .sir-wc-body {
  max-height: none;
}
.sir-md .sir-wc-body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32px;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.96), transparent);
  pointer-events: none;
}
.sir-md .sir-wc-card[data-collapsed="0"] .sir-wc-body::after {
  display: none;
}