/* ============================================================
   hexo-theme-p5 — Persona 5 style for Game Life
   视觉体系移植自 p5-ui:红黑白主色 / 阿里妈妈数黑体 / skew 剪切 / 故障动画
   ============================================================ */

/* ---------- tokens ---------- */
@font-face {
  font-family: "AliMaMaShuHei";
  font-weight: 700;
  src: url("/font/q-ADVcvSQqAACBZEk73Le.woff2") format("woff2"),
       url("/font/q-ADVcvSQqAACBZEk73Le.woff") format("woff");
  font-display: swap;
}

:root {
  --p5-red: #ff0022;
  --p5-red-deep: #cc001b;
  --p5-cyan: #1cfeff;
  --p5-purple: #8360c3;
  --p5-font: "AliMaMaShuHei", "PingFang SC", "Microsoft YaHei", sans-serif;
  --p5-mono: ui-monospace, "SF Mono", Menlo, Consolas, "JetBrains Mono", monospace;

  --bg: #0a0a0c;
  --bg-soft: #121216;
  --panel: #101014;
  --panel-2: #16161c;
  --fg: #ffffff;
  --fg-soft: #c8c8d0;
  --muted: #8a8a94;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --chip-bg: rgba(255, 255, 255, 0.06);
  --code-bg: #08080a;
  --nav-bg: rgba(8, 8, 10, 0.92);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --star: url("/img/p5/icon-star-white.png");
}

html[data-theme="light"] {
  --bg: #f2efe9;
  --bg-soft: #e9e5dc;
  --panel: #ffffff;
  --panel-2: #f6f3ec;
  --fg: #0d0d10;
  --fg-soft: #33333a;
  --muted: #6d6d76;
  --line: rgba(10, 10, 12, 0.16);
  --line-strong: rgba(10, 10, 12, 0.34);
  --chip-bg: rgba(10, 10, 12, 0.05);
  --code-bg: #0a0a0c; /* 代码块永远保持 P5 黑 */
  --nav-bg: rgba(242, 239, 233, 0.94);
  --shadow: 0 12px 40px rgba(60, 40, 20, 0.18);
  --star: url("/img/p5/icon-star-black.png");
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg: #f2efe9;
    --bg-soft: #e9e5dc;
    --panel: #ffffff;
    --panel-2: #f6f3ec;
    --fg: #0d0d10;
    --fg-soft: #33333a;
    --muted: #6d6d76;
    --line: rgba(10, 10, 12, 0.16);
    --line-strong: rgba(10, 10, 12, 0.34);
    --chip-bg: rgba(10, 10, 12, 0.05);
    --nav-bg: rgba(242, 239, 233, 0.94);
    --shadow: 0 12px 40px rgba(60, 40, 20, 0.18);
    --star: url("/img/p5/icon-star-black.png");
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.85 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* P5 纸面斜向底纹 + 红色对角切角 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    repeating-linear-gradient(-45deg, transparent 0 22px, var(--bg-soft) 22px 23px);
  opacity: 0.5;
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 480px at 88% -8%, rgba(255, 0, 34, 0.10), transparent 60%),
    radial-gradient(820px 420px at -6% 104%, rgba(28, 254, 255, 0.06), transparent 60%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; }

::selection { background: var(--p5-red); color: #fff; }

/* p5-ui 滚动条移植 */
::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--p5-red); }
::-webkit-scrollbar-corner { display: none; }

.p5-stage { max-width: 1060px; margin: 0 auto; padding: 96px 24px 48px; }

/* ---------- P5 标题(逐字旋转 + 选中反色,JS 增强注入 span) ---------- */
[data-p5-title] {
  font-family: var(--p5-font);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
  margin: 0;
}
[data-p5-title] .p5-ch {
  display: inline-block;
  padding: 0 2px;
  will-change: transform;
}
[data-p5-title] .p5-ch.is-sel {
  background: var(--p5-sel-bg, #000);
  color: var(--p5-sel-fg, #fff);
}
[data-p5-title][data-bg="red"] { --p5-sel-bg: var(--p5-red); }
[data-p5-title][data-color="red"] { color: var(--p5-red); }
[data-p5-title][data-selected="true"] .p5-ch.is-sel { background: var(--p5-red); color: #fff; }

/* p5-ui 故障抖动 hover(bgBlue + bgRed 移植) */
.p5-glitch { position: relative; z-index: 1; display: inline-block; }
.p5-glitch::before,
.p5-glitch::after {
  content: "";
  position: absolute;
  top: -10%; left: -10%;
  width: 120%; height: 120%;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
}
.p5-glitch:hover::before { background: var(--p5-cyan); opacity: 1; animation: p5BgBlue 1s ease-in infinite; }
.p5-glitch:hover::after { background: var(--p5-red); opacity: 1; mix-blend-mode: screen; animation: p5BgRed 1s ease-out infinite; }

@keyframes p5BgBlue {
  0%   { top: 6%;  transform: skew(-30deg, -2deg) scale(0.7); }
  20%  { top: 3%;  transform: skew(45deg, 4deg)  scale(0.8); }
  40%  { top: -2%; transform: skew(-20deg, -2deg) scale(0.9); }
  60%  { top: -4%; transform: skew(20deg, 2deg)  scale(1); }
  80%  { top: 3%;  transform: skew(-45deg, -4deg) scale(0.85); }
  100% { top: 6%;  transform: skew(45deg, 4deg)  scale(0.7); }
}
@keyframes p5BgRed {
  0%   { top: -4%; transform: skew(45deg, 4deg)  scale(1); }
  20%  { top: -1%; transform: skew(-30deg, -3deg) scale(0.9); }
  40%  { top: 2%;  transform: skew(60deg, 6deg)  scale(0.75); }
  60%  { top: 3%;  transform: skew(-20deg, -2deg) scale(0.7); }
  80%  { top: -2%; transform: skew(30deg, 3deg)  scale(0.85); }
  100% { top: -4%; transform: skew(45deg, 4deg)  scale(1); }
}

/* ---------- 顶部导航 ---------- */
.p5-nav-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--p5-red);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.p5-nav {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.p5-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  transform: skewX(-6deg);
}
.p5-logo-star { width: 22px; height: 22px; animation: p5Spin 6s linear infinite; }
@keyframes p5Spin { to { transform: rotate(360deg); } }
.p5-logo-text { font-family: var(--p5-font); font-size: 22px; font-weight: 700; color: var(--fg); }

.p5-menu { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.p5-menu-item {
  display: inline-block;
  font-family: var(--p5-font);
  font-size: 15px;
  padding: 7px 14px;
  color: var(--fg-soft);
  position: relative;
  z-index: 1;
}
.p5-menu-item .p5-menu-skew {
  display: inline-block;
  transform: skewX(-8deg);
  transition: transform 0.15s ease;
}
.p5-menu-item:hover,
.p5-menu-item.active {
  background: var(--fg);
  color: var(--bg);
  transform: skewX(-8deg);
}
.p5-menu-item:hover .p5-menu-skew,
.p5-menu-item.active .p5-menu-skew { transform: skewX(0); }
.p5-menu-item.active { background: var(--p5-red); color: #fff; }

/* P5Switch 移植的主题开关 */
.p5-switch {
  position: relative;
  width: 64px; height: 30px;
  flex: 0 0 auto;
  border: 2px solid var(--fg);
  background: transparent;
  cursor: pointer;
  transform: skewX(4deg);
  transition: background 0.25s ease;
  padding: 0;
}
.p5-switch-knob {
  position: absolute;
  top: 1px; left: 3px;
  width: 24px; height: 22px;
  background: var(--fg);
  background-image: url("/img/p5/icon-star-white.png");
  background-size: 70%;
  background-position: center;
  background-repeat: no-repeat;
  transition: left 0.25s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
html[data-mode="light"] .p5-switch-knob { left: 33px; }
html[data-mode="light"] .p5-switch { background: var(--p5-red); }
.p5-switch-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--p5-font);
  font-size: 11px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.p5-switch:hover .p5-switch-state { opacity: 1; }
html[data-mode="dark"] .p5-switch-state::after { content: "NIGHT"; }
html[data-mode="light"] .p5-switch-state::after { content: "DAY"; }

.p5-nav-burger { display: none; }

/* ---------- 首页 HERO ---------- */
.p5-hero {
  position: relative;
  margin: 0 0 56px;
  min-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #060608;
  border: 3px solid var(--fg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow), 8px 8px 0 var(--p5-red);
}
.p5-hero-crowd {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.p5-hero-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(6,6,8,0.55) 0%, rgba(6,6,8,0.15) 45%, rgba(6,6,8,0.8) 100%),
    radial-gradient(600px 300px at 30% 40%, rgba(255,0,34,0.16), transparent 70%);
  pointer-events: none;
}
.p5-hero-body {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 64px 24px;
  color: #fff;
  transform: rotate(-1.5deg);
}
.p5-hero-label {
  font-family: var(--p5-font);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  font-size: 14px;
  color: var(--p5-cyan);
  margin-bottom: 18px;
}
.p5-hero-title {
  font-size: clamp(44px, 9vw, 96px);
  color: #fff;
  text-shadow: 5px 5px 0 var(--p5-red);
}
.p5-hero-slash {
  height: 6px;
  width: 240px;
  max-width: 60%;
  margin: 26px auto 20px;
  background: var(--p5-red);
  transform: skewX(-24deg) rotate(-1deg);
}
.p5-hero-tagline {
  font-family: var(--p5-font);
  color: #e8e8ee;
  font-size: 15px;
  letter-spacing: 0.12em;
  margin: 0;
}
.p5-hero-scroll {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--p5-font);
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--p5-cyan);
  animation: p5Bob 1.6s ease-in-out infinite;
}
@keyframes p5Bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* ---------- 区块标题 ---------- */
.p5-section { margin-bottom: 64px; }
.p5-section-title {
  display: inline-block;
  font-size: clamp(26px, 4vw, 36px);
  color: var(--fg);
  background: linear-gradient(transparent 62%, rgba(255, 0, 34, 0.35) 62%);
  transform: skewX(-6deg);
}

/* p5-ui P5Divider 移植 */
.p5-divider {
  height: 4px;
  border-radius: 2px;
  background: var(--p5-red);
  margin: 14px 0 30px;
  transform: skewX(-24deg);
}

/* ---------- 首页文章卡片 MISSION LIST ---------- */
.p5-card-list { display: flex; flex-direction: column; gap: 26px; }

.p5-card {
  position: relative;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.p5-card:hover {
  transform: translate(-3px, -3px) rotate(-0.4deg);
  border-color: var(--fg);
  box-shadow: 7px 7px 0 rgba(255, 0, 34, 0.35);
}
.p5-card-inner { display: flex; gap: 22px; padding: 26px 28px; }

.p5-card-no {
  flex: 0 0 auto;
  font-family: var(--p5-font);
  font-size: 34px;
  font-style: italic;
  color: var(--p5-red);
  opacity: 0.9;
  transform: skewX(-10deg) rotate(-3deg);
  line-height: 1.1;
  min-width: 58px;
  text-shadow: 3px 3px 0 rgba(255, 0, 34, 0.25);
}

.p5-card-main { min-width: 0; flex: 1; }
.p5-card-title { margin: 0 0 8px; font-size: 22px; line-height: 1.4; }
.p5-card-title a {
  font-family: var(--p5-font);
  color: var(--fg);
  background-image: linear-gradient(var(--p5-red), var(--p5-red));
  background-repeat: no-repeat;
  background-size: 0% 3px;
  background-position: 0 96%;
  transition: background-size 0.25s ease;
}
.p5-card-title a:hover { background-size: 100% 3px; }

.p5-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.p5-card-date { font-family: var(--p5-font); letter-spacing: 0.08em; }
.p5-card-chips { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* 贴纸 chip */
.p5-chip {
  display: inline-block;
  font-family: var(--p5-font);
  font-size: 12px;
  padding: 2px 10px;
  color: var(--fg-soft);
  background: var(--chip-bg);
  border: 1px solid var(--line);
  transform: skewX(-8deg) rotate(-1deg);
  transition: all 0.15s ease;
}
.p5-chip:hover { background: var(--fg); color: var(--bg); transform: skewX(-8deg) rotate(-1deg) scale(1.08); }
.p5-chip-cat { border-color: var(--p5-red); color: var(--p5-red); }
.p5-chip-cat:hover { background: var(--p5-red); color: #fff; }

.p5-card-excerpt {
  color: var(--fg-soft);
  font-size: 15px;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.p5-card-excerpt p { margin: 0; }
.p5-card-excerpt img { display: none; }

/* p5-ui P5Button 移植 */
.p5-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--p5-font);
  font-size: 14px;
  padding: 8px 18px;
  color: var(--fg);
  background: var(--code-bg);
  border: 2px solid var(--fg);
  transform: skewX(-6deg);
  transition: all 0.15s ease;
  cursor: pointer;
}
.p5-btn:hover {
  background: var(--p5-red);
  border-color: var(--p5-red);
  color: #fff;
  transform: skewX(-6deg) translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55);
}
html[data-theme="light"] .p5-btn { color: #fff; }

/* ---------- 文章页 ---------- */
.p5-article-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.p5-article-wrap.has-toc { grid-template-columns: minmax(0, 1fr) 220px; }

.p5-article {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 4.5vw, 52px);
  position: relative;
}
.p5-article::before {
  content: "";
  position: absolute;
  top: -2px; right: -2px;
  width: 84px; height: 30px;
  background: var(--p5-red);
  clip-path: polygon(30% 0, 100% 0, 100% 100%);
  pointer-events: none;
}

.p5-article-head { margin-bottom: 30px; }
.p5-article-mission {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  font-family: var(--p5-font);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.p5-mission-tag {
  background: var(--fg);
  color: var(--bg);
  padding: 3px 12px;
  transform: skewX(-10deg);
}
.p5-article-title {
  font-size: clamp(26px, 4.6vw, 40px);
  line-height: 1.35;
  margin: 0 0 16px;
  word-break: break-word;
}
.p5-article-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ---------- 正文排版 ---------- */
.p5-entry { font-size: 16.5px; color: var(--fg-soft); overflow-wrap: break-word; }
.p5-entry > *:first-child { margin-top: 0; }
.p5-entry > *:last-child { margin-bottom: 0; }
.p5-entry a {
  color: var(--fg);
  font-weight: 600;
  background-image: linear-gradient(var(--p5-red), var(--p5-red));
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: 0 100%;
  padding: 0 2px;
  transition: all 0.15s ease;
}
.p5-entry a:hover { background: var(--p5-red); color: #fff; }

.p5-entry h1, .p5-entry h2, .p5-entry h3,
.p5-entry h4, .p5-entry h5, .p5-entry h6 {
  font-family: var(--p5-font);
  color: var(--fg);
  margin: 1.6em 0 0.7em;
  line-height: 1.4;
  position: relative;
  scroll-margin-top: 100px;
}
.p5-entry h1 { font-size: 26px; }
.p5-entry h2 { font-size: 22px; }
.p5-entry h3 { font-size: 19px; }
.p5-entry h4 { font-size: 17px; }
.p5-entry h1::before, .p5-entry h2::before, .p5-entry h3::before {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 10px;
  background: var(--p5-red);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  transform: rotate(-8deg) translateY(1px);
}
.p5-entry h1, .p5-entry h2 { border-bottom: 2px solid var(--line); padding-bottom: 0.35em; }

.p5-entry p { margin: 1em 0; }

.p5-entry ul, .p5-entry ol { padding-left: 1.6em; margin: 1em 0; }
.p5-entry li { margin: 0.35em 0; }
.p5-entry ul { list-style: none; }
.p5-entry ul > li { position: relative; }
.p5-entry ul > li::before {
  content: "";
  position: absolute;
  left: -1.4em; top: 0.62em;
  width: 11px; height: 11px;
  background: var(--p5-red);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.p5-entry ul > li > ul > li::before { background: var(--fg); transform: scale(0.8); }
.p5-entry ol { list-style: decimal; }
.p5-entry ol > li::marker { color: var(--p5-red); font-family: var(--p5-font); }

/* 预告函 blockquote */
.p5-entry blockquote {
  position: relative;
  margin: 1.4em 0;
  padding: 18px 22px 18px 26px;
  background: var(--panel-2);
  border: 2px solid var(--fg);
  border-left: 8px solid var(--p5-red);
  border-radius: 4px;
  color: var(--fg);
  transform: rotate(-0.5deg);
}
.p5-entry blockquote::after {
  content: "";
  position: absolute;
  right: 12px; bottom: 10px;
  width: 18px; height: 18px;
  opacity: 0.85;
  background: var(--p5-red);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.p5-entry blockquote p { margin: 0.4em 0; }

/* 行内代码 */
.p5-entry code {
  font-family: var(--p5-mono);
  font-size: 0.86em;
  padding: 2px 7px;
  background: rgba(255, 0, 34, 0.12);
  border: 1px solid rgba(255, 0, 34, 0.3);
  border-radius: 3px;
  color: var(--fg);
  word-break: break-word;
}

/* 表格:P5Table 移植(只作用于正文 markdown 表格;代码块内部 table 见下方 figure 覆盖) */
.p5-entry table {
  width: 100%;
  margin: 1.5em 0;
  border: 2px solid var(--fg);
  border-collapse: collapse;
  font-size: 14.5px;
  display: block;
  overflow-x: auto;
}
.p5-entry thead { background: var(--fg); }
.p5-entry thead th {
  font-family: var(--p5-font);
  color: var(--bg);
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.p5-entry tbody td {
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: #eee;
}
.p5-entry tbody tr { transition: background 0.12s ease; }
.p5-entry tbody tr:nth-child(2n) td { background: #101018; }
/* hover 红温和化:半透明红,不整行反白 */
.p5-entry tbody tr:hover td { background: rgba(255, 0, 34, 0.18); }
.table-wrapper { overflow-x: auto; }
.table-wrapper > table { display: table; margin: 0; }

/* 代码块:p5-codebox(外层:边框+语言贴纸) > figure.highlight(横向滚动) > pre.highlight-code(计数器行号)
   结构由主题 after_post_render 过滤器生成,内部无 table */
.p5-codebox {
  position: relative;
  margin: 1.5em 0;
  background: var(--code-bg);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 6px 6px 0 rgba(255, 0, 34, 0.16);
}
.p5-codebox::before {
  content: attr(data-lang);
  position: absolute;
  top: -2px; right: -2px;
  z-index: 2;
  font-family: var(--p5-font);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #fff;
  background: var(--p5-red);
  padding: 3px 14px;
  border-radius: 0 6px;
  transform: skewX(-12deg);
}
.p5-codebox figure.highlight {
  margin: 0;
  border: 0;
  background: transparent;
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}
pre.highlight-code {
  counter-reset: p5line;
  display: block;
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 14px 18px 14px 0;
  font-family: var(--p5-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: #e8e8ee;
  white-space: pre;
  box-sizing: border-box;
}
pre.highlight-code code { font-family: inherit; background: transparent; padding: 0; border: 0; color: inherit; }
pre.highlight-code .line { display: block; padding-right: 18px; }
pre.highlight-code .line::before {
  counter-increment: p5line;
  content: counter(p5line);
  display: inline-block;
  min-width: 2em;
  margin-right: 1.2em;
  text-align: right;
  color: var(--p5-red);
  opacity: 0.8;
  user-select: none;
  -webkit-user-select: none;
}
.p5-entry pre {
  position: relative;
  margin: 1.5em 0;
  background: var(--code-bg);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 6px 6px 0 rgba(255, 0, 34, 0.16);
}
.p5-entry pre > code {
  display: block;
  padding: 18px 20px;
  background: transparent;
  border: 0;
  color: #e8e8ee;
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
}
/* 首页摘要中的代码块不展示(摘要有文字,代码块被裁剪很难看) */
.p5-card-excerpt .p5-codebox { display: none; }

/* 图片:拍立得 */
.p5-entry img {
  display: block;
  margin: 1.6em auto;
  max-width: 92%;
  padding: 10px 10px 26px;
  background: #fff;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.4);
  transform: rotate(-1.2deg);
  transition: transform 0.2s ease;
  border-radius: 2px;
}
.p5-entry img:hover { transform: rotate(0deg) scale(1.015); }
.p5-entry figcaption {
  text-align: center;
  font-family: var(--p5-font);
  font-size: 13px;
  color: var(--muted);
  margin-top: -1.2em;
  margin-bottom: 1.5em;
}

.p5-entry hr {
  height: 4px;
  border: 0;
  background: var(--p5-red);
  margin: 2.4em auto;
  width: 62%;
  transform: skewX(-24deg);
}

/* 表格包一层(由 toc.js 做,防御性样式) */
.table-wrapper { overflow-x: auto; }
.table-wrapper > table { display: table; }

/* ---------- 上一篇 / 下一篇 ---------- */
.p5-neighbor {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 44px;
  padding-top: 26px;
  border-top: 2px dashed var(--line-strong);
}
.p5-neighbor-btn {
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p5-neighbor-btn.is-next { margin-left: auto; }

/* ---------- TOC(TARGETS) ---------- */
.p5-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 18px 16px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
.p5-toc-title {
  font-family: var(--p5-font);
  font-size: 15px;
  letter-spacing: 0.28em;
  color: var(--fg);
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 3px solid var(--p5-red);
}
.p5-toc-list, .p5-toc-list ol {
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.p5-toc-list ol { padding-left: 14px; }
.p5-toc-item { margin: 2px 0; }
.p5-toc-link {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  padding: 3px 8px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}
.p5-toc-link:hover { color: var(--fg); }
.p5-toc-link.active {
  color: #fff;
  background: var(--p5-red);
  border-left-color: var(--fg);
  transform: skewX(-8deg);
}

/* ---------- 归档 BATTLE RECORD ---------- */
.p5-record-group { margin-bottom: 34px; }
.p5-record-year {
  font-family: var(--p5-font);
  font-size: 30px;
  color: var(--p5-red);
  margin: 0 0 14px;
  transform: skewX(-8deg);
  text-shadow: 3px 3px 0 rgba(255, 0, 34, 0.22);
}
.p5-record-list { list-style: none; margin: 0; padding: 0; }
.p5-record {
  border-bottom: 1px dashed var(--line-strong);
  transition: background 0.12s ease;
}
.p5-record-link {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 14px;
}
.p5-record:hover { background: var(--chip-bg); }
.p5-record:hover .p5-record-title { color: var(--p5-red); }
.p5-record-date {
  flex: 0 0 auto;
  font-family: var(--p5-font);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.p5-record-slash {
  flex: 0 0 auto;
  width: 14px; height: 3px;
  background: var(--p5-red);
  transform: skewX(-30deg) translateY(-4px);
}
.p5-record-title {
  font-family: var(--p5-font);
  color: var(--fg);
  transition: color 0.12s ease;
}

/* ---------- 分类/标签贴纸墙 ---------- */
.p5-cloud { display: flex; flex-wrap: wrap; gap: 18px 16px; padding: 6px 0 10px; }
.p5-sticker {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--p5-font);
  font-size: 17px;
  padding: 8px 18px;
  color: var(--fg);
  background: var(--panel);
  border: 2px solid var(--fg);
  transition: all 0.15s ease;
}
.p5-sticker:nth-child(3n+1) { transform: rotate(-2.4deg); }
.p5-sticker:nth-child(3n+2) { transform: rotate(1.6deg) skewX(-4deg); }
.p5-sticker:nth-child(3n)   { transform: rotate(-0.8deg); }
.p5-sticker:hover {
  background: var(--p5-red);
  border-color: var(--p5-red);
  color: #fff;
  transform: rotate(0deg) scale(1.07) !important;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.4);
  z-index: 2;
}
.p5-sticker-count {
  font-size: 12px;
  color: var(--p5-red);
}
.p5-sticker:hover .p5-sticker-count { color: #fff; }

/* ---------- 分页 ---------- */
.p5-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 44px;
}
.p5-pagination-info { font-family: var(--p5-font); color: var(--muted); letter-spacing: 0.2em; }

/* ---------- 页脚 ---------- */
.p5-footer {
  margin-top: 40px;
  border-top: 3px solid var(--p5-red);
  background: var(--panel);
}
.p5-footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 24px 44px;
  text-align: center;
}
.p5-footer-slogan {
  font-family: var(--p5-font);
  font-size: 24px;
  transform: rotate(-1.5deg);
}
.p5-footer .p5-divider { width: 120px; margin: 18px auto; }
.p5-footer-info { font-size: 13px; color: var(--muted); margin: 0; }
.p5-footer-sep { color: var(--p5-red); margin: 0 6px; }
.p5-footer-red { color: var(--p5-red); font-family: var(--p5-font); }

/* ---------- 返回顶部(P5BackTop 移植) ---------- */
.p5-backtop {
  position: fixed;
  right: 26px; bottom: 30px;
  z-index: 80;
  width: 72px; height: 88px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transform: translateY(24px) rotate(8deg);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}
.p5-backtop img { width: 100%; height: auto; }
.p5-backtop.show { opacity: 1; transform: translateY(0) rotate(8deg); pointer-events: auto; }
.p5-backtop:hover { transform: translateY(-3px) rotate(-4deg) scale(1.06); }

/* ---------- 开场动画 ---------- */
.p5-splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #060608;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: p5SplashOut 0.5s ease var(--splash-dur, 1.7s) forwards;
}
.p5-splash[hidden] { display: none; }
.p5-splash-card { position: relative; text-align: center; transform: rotate(-2deg); }
.p5-splash-title {
  font-family: var(--p5-font);
  font-size: clamp(40px, 10vw, 92px);
  color: #fff;
  letter-spacing: 0.06em;
}
.p5-splash-title .p5-ch {
  display: inline-block;
  opacity: 0;
  animation: p5ChIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(var(--i) * 0.07s);
}
.p5-splash-title .p5-ch.is-sel { background: var(--p5-red); color: #fff; }
@keyframes p5ChIn {
  0% { opacity: 0; transform: translateY(60px) rotate(20deg) scale(1.6); }
  100% { opacity: 1; transform: translateY(0) rotate(var(--r, 0deg)) scale(1); }
}
.p5-splash-sub {
  font-family: var(--p5-font);
  color: var(--p5-cyan);
  letter-spacing: 0.5em;
  font-size: 14px;
  margin-top: 18px;
  opacity: 0;
  animation: p5FadeIn 0.5s ease 0.8s forwards;
}
.p5-splash-slash {
  height: 6px;
  width: 200px;
  margin: 22px auto 0;
  background: var(--p5-red);
  transform: skewX(-24deg);
  transform-origin: left;
  animation: p5SlashIn 0.4s cubic-bezier(0.85, 0, 0.15, 1) 0.5s both;
}
@keyframes p5SlashIn { from { transform: scaleX(0) skewX(-24deg); } to { transform: scaleX(1) skewX(-24deg); } }
@keyframes p5FadeIn { to { opacity: 1; } }
@keyframes p5SplashOut {
  to { opacity: 0; visibility: hidden; }
}

/* ---------- 角色弹窗(P5Notification 移植) ---------- */
.p5-notification {
  position: fixed;
  left: 34px;
  bottom: 34px;
  z-index: 95;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  cursor: pointer;
  animation: p5NotiIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.p5-notification.out { opacity: 0; transform: translateY(24px); }
@keyframes p5NotiIn { from { opacity: 0; transform: translateX(-60px); } }
.p5-notification-portrait { height: 130px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45)); }
.p5-notification-box {
  position: relative;
  max-width: 320px;
  background: var(--panel);
  border: 2px solid var(--fg);
  box-shadow: 6px 6px 0 rgba(255, 0, 34, 0.5);
  padding: 12px 18px;
  transform: rotate(-1.2deg);
}
.p5-notification-box::before {
  content: "";
  position: absolute;
  top: -9px; left: 20px;
  width: 16px; height: 16px;
  background: var(--panel);
  border-left: 2px solid var(--fg);
  border-top: 2px solid var(--fg);
  transform: rotate(45deg);
}
.p5-notification-name {
  font-family: var(--p5-font);
  color: var(--p5-red);
  font-size: 13px;
  letter-spacing: 0.2em;
  margin-bottom: 4px;
}
.p5-notification-content { font-size: 14px; color: var(--fg); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .p5-article-wrap.has-toc { grid-template-columns: minmax(0, 1fr); }
  .p5-toc { position: static; max-height: none; margin-top: 0; }
  .p5-toc-list { display: none; }
  .p5-toc.expanded .p5-toc-list { display: block; }
  .p5-toc-title::after { content: " ▾"; }
}

@media (max-width: 768px) {
  .p5-entry table { font-size: 13px; }
  .p5-entry thead th { padding: 8px 10px; }
  .p5-entry tbody td { padding: 7px 10px; }
  pre.highlight-code { font-size: 12.5px; padding: 10px 14px 10px 0; }
  pre.highlight-code .line { padding-right: 14px; }
  .p5-stage { padding: 84px 14px 32px; }
  .p5-nav { padding: 0 14px; gap: 12px; height: 58px; }
  .p5-menu {
    position: fixed;
    top: 58px; right: 0;
    flex-direction: column;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border: 2px solid var(--p5-red);
    border-right: 0;
    padding: 18px 26px;
    gap: 4px;
    transform: translateX(110%);
    transition: transform 0.28s cubic-bezier(0.85, 0, 0.15, 1);
    margin-left: 0;
  }
  .p5-menu.open { transform: translateX(0); }
  .p5-menu-item { font-size: 17px; padding: 10px 16px; }
  .p5-nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px; height: 40px;
    background: transparent;
    border: 2px solid var(--fg);
    cursor: pointer;
    margin-left: 10px;
    padding: 6px;
  }
  .p5-nav-burger span {
    display: block;
    height: 3px;
    background: var(--fg);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .p5-nav-burger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .p5-nav-burger.open span:nth-child(2) { opacity: 0; }
  .p5-nav-burger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  .p5-card-inner { flex-direction: column; gap: 8px; padding: 20px; }
  .p5-card-no { font-size: 26px; min-width: 0; }
  .p5-hero { min-height: 56vh; box-shadow: 4px 4px 0 var(--p5-red); margin-bottom: 36px; }
  .p5-neighbor { flex-direction: column; }
  .p5-neighbor-btn { max-width: 100%; }
  .p5-neighbor-btn.is-next { margin-left: 0; }
  .p5-backtop { right: 12px; bottom: 18px; width: 54px; height: 66px; }
  .p5-notification { left: 14px; bottom: 14px; }
  .p5-notification-portrait { height: 92px; }
  .p5-notification-box { max-width: 220px; }
}

/* ---------- 动效节制 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  html { scroll-behavior: auto; }
}
