/* AI prose layer: article typography and content presentation rules. */
/* Localized words and paths must wrap without widening the reading panel. */
.ai-prose-body {
  overflow-wrap: anywhere;
}
.ai-section-actions {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.ai-section-status {
  color: #9cd8eb;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  white-space: nowrap;
}
.ai-section-status:not(:empty) {
  margin-inline-start: 0.25rem;
}
.ai-prose-body .ai-section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  margin-inline-start: 0.25em;
  vertical-align: middle;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #8dcde2;
  text-decoration: none;
  opacity: 0;
  transition: opacity 150ms ease;
}
.ai-prose-body :is(h2, h3):hover .ai-section-link,
.ai-prose-body :is(h2, h3):focus-within .ai-section-link {
  opacity: 1;
}
.ai-prose-body .ai-section-link:hover {
  color: #b3efff;
  background: rgba(108, 207, 255, 0.07);
  text-shadow: none;
}
.ai-prose-body .ai-section-link:focus-visible {
  outline: 1px solid #8edfff;
  outline-offset: 2px;
}
.ai-section-feedback {
  display: block;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #9cd8eb;
}
.ai-section-feedback:empty {
  display: none;
}
.ai-section-feedback input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-block: 0.4rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(140, 210, 242, 0.4);
  background: #101820;
  color: #c4e5ee;
  font: inherit;
}
@media (hover: none), (pointer: coarse) {
  .ai-prose-body .ai-section-link {
    opacity: 0.8;
    min-width: 36px;
    min-height: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-prose-body .ai-section-link {
    transition: none;
  }
}

/* Desktop prose remains content-box: reserve both 2em paddings and the 1px borders. */
@media (min-width: 721px) {
  body.ai-page .ai-content .prose {
    max-width: calc(100% - 4em - 2px);
  }
}

@media (max-width: 720px) {
  body.ai-page .ai-content .prose {
    box-sizing: border-box;
    max-width: 100%;
  }
}
/* GPU 风格：散热鳍片 + PCB 底 + 金属边框 */
body.ai-page .ai-content .prose {
  position: relative;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 19px,
      rgba(50, 90, 70, 0.03) 19px,
      rgba(50, 90, 70, 0.03) 20px
    ),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 2px,
      rgba(55, 65, 80, 0.14) 2px,
      rgba(55, 65, 80, 0.14) 4px
    ),
    linear-gradient(
      135deg,
      rgba(14, 18, 24, 0.97) 0%,
      rgba(10, 14, 20, 0.95) 50%,
      rgba(6, 10, 16, 0.97) 100%
    ),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(70, 110, 150, 0.06), transparent 60%);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-radius: 8px;
  padding: 2em;
  border: 1px solid rgba(140, 155, 175, 0.35);
  box-shadow:
    0 0 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(200, 210, 225, 0.12),
    inset 0 -1px 0 rgba(40, 50, 65, 0.4),
    inset 0 0 0 1px rgba(100, 120, 150, 0.15);
}
/* 加载扫描线 */
.ai-load-scan {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(100, 255, 180, 0.6),
    rgba(120, 180, 255, 0.6),
    transparent
  );
  box-shadow: 0 0 12px rgba(100, 255, 180, 0.5);
  animation: ai-scan 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 20;
  will-change: transform, opacity;
}
@keyframes ai-scan {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0.2;
  }
}
/* 标题/正文区光晕 */
body.ai-page .ai-content .prose .ai-title {
  text-shadow:
    0 0 20px rgba(132, 214, 255, 0.18),
    0 0 36px rgba(160, 224, 255, 0.16);
}
body.ai-page .ai-content .prose .ai-prose-body {
  box-shadow: inset 0 0 80px rgba(124, 206, 255, 0.035);
}
/* GPU 金属边框：铝银质感 */
body.ai-page .ai-content .prose::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(200, 210, 225, 0.4) 0%,
    rgba(140, 155, 180, 0.25) 25%,
    rgba(100, 115, 140, 0.2) 50%,
    rgba(140, 155, 180, 0.28) 75%,
    rgba(180, 195, 215, 0.35) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
body.ai-page .ai-content .prose:hover::before {
  opacity: 1.3;
}
/* 链接 hover 光晕/脉冲 */
body.ai-page .ai-content .prose a {
  color: rgba(142, 220, 248, 0.96);
  text-decoration: none;
  padding: 0 2px;
  border-radius: 2px;
  text-shadow:
    0 0 8px rgba(110, 198, 238, 0.24),
    0 0 16px rgba(95, 184, 226, 0.14);
  transition:
    box-shadow 0.25s ease,
    text-shadow 0.25s ease,
    color 0.25s ease;
}
body.ai-page .ai-content .prose a:visited {
  color: rgba(156, 210, 255, 0.94);
}
body.ai-page .ai-content .prose a:hover {
  box-shadow:
    0 0 12px rgba(140, 210, 242, 0.4),
    0 0 24px rgba(132, 214, 255, 0.28);
  text-shadow:
    0 0 10px rgba(162, 222, 248, 0.56),
    0 0 20px rgba(138, 214, 255, 0.3);
  color: rgba(190, 236, 255, 0.98);
}
/* 代码块：输出窗口风格 */
.ai-prose-body .code-block {
  position: relative;
  min-width: 0;
  margin: 1.5em 0;
}
body.ai-page .ai-content .prose .code-block pre {
  margin: 0;
  padding-top: 3.5rem;
  overflow-x: auto;
}
.ai-prose-body .code-copy {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(8, 16, 28, 0.92);
  color: #9bc9df;
  cursor: pointer;
}
.ai-prose-body .code-copy:hover,
.ai-prose-body .code-copy:focus-visible {
  color: #d2efff;
  border-color: #81b6d0;
}
.ai-prose-body .code-copy:focus-visible {
  outline: 2px solid #81b6d0;
  outline-offset: 2px;
}
.code-copy .copy-check,
.code-copy.is-copied .copy-icon {
  display: none;
}
.code-copy.is-copied .copy-check {
  display: inline;
}
.code-copy-status {
  position: absolute;
  right: 3.5rem;
  top: 0.65rem;
  z-index: 3;
  max-width: calc(100% - 4.5rem);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: #c9e8f6;
  background: #102130;
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.code-copy-status:empty {
  display: none;
}
body.ai-page .ai-content .prose code {
  background: rgba(10, 18, 30, 0.72);
  border: 1px solid rgba(126, 192, 224, 0.26);
  color: rgba(196, 232, 248, 0.92);
}
body.ai-page .ai-content .prose pre {
  background: rgba(8, 12, 22, 0.88);
  border: 1px solid rgba(142, 218, 255, 0.2);
  box-shadow:
    inset 0 0 34px rgba(14, 34, 54, 0.44),
    0 0 20px rgba(132, 214, 255, 0.08),
    0 0 0 1px rgba(146, 214, 244, 0.14);
  border-radius: 6px;
  overflow: hidden;
}
body.ai-page .ai-content .prose pre code {
  background: transparent;
  border: none;
  color: inherit;
}
/* 引用块：输出窗口风格 + 命令提示符 */
body.ai-page .ai-content .prose blockquote {
  position: relative;
  background: rgba(12, 18, 30, 0.64);
  border: 1px solid rgba(126, 192, 224, 0.22);
  border-left: 3px solid rgba(146, 214, 244, 0.56);
  padding: 1em 1.25em 1em 2.5em;
  border-radius: 4px;
  box-shadow:
    0 0 16px rgba(136, 206, 238, 0.1),
    inset 0 0 20px rgba(8, 28, 44, 0.26);
}
body.ai-page .ai-content .prose blockquote::before {
  content: '>';
  position: absolute;
  left: 0.6em;
  top: 1em;
  color: rgba(156, 220, 246, 0.8);
  font-family: monospace;
  font-weight: bold;
}
/* 代码块命令提示符 */
body.ai-page .ai-content .prose pre {
  position: relative;
  padding-left: 2.5em;
  padding-top: 2.2em;
}
body.ai-page .ai-content .prose pre::before {
  content: '●  ●  ●   runtime';
  position: absolute;
  left: 1em;
  top: 0.9em;
  color: rgba(168, 226, 248, 0.72);
  font-family: monospace;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(124, 206, 246, 0.28);
}
body.ai-page .ai-content .prose pre::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    rgba(132, 214, 255, 0) 0%,
    rgba(132, 214, 255, 0.18) 48%,
    rgba(132, 214, 255, 0) 100%
  );
  transform: translateX(-130%);
  transition: transform 0.5s ease;
}
body.ai-page .ai-content .prose pre:hover::after {
  transform: translateX(130%);
}
body.ai-page .ai-content .prose blockquote::after {
  content: 'reference';
  position: absolute;
  right: 1em;
  top: 0.9em;
  color: rgba(172, 230, 252, 0.64);
  font-family: ui-monospace, monospace;
  font-size: 0.66em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body.ai-page header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
body.ai-page .ai-content {
  padding-top: calc(3em + 56px);
}
@media (max-width: 720px) {
  body.ai-page .ai-content {
    padding-top: calc(1em + 56px);
  }
}
