/* =========================================================
   通用状态栏美化 CSS · 璃华女子学院轻小说UI版
   适配范围：
   - 普通 Markdown 页面
   - Chat / AI 对话页面
   - 酒馆类 / 角色卡网站
   - details/summary 状态栏
   - 表格、论坛引用、记忆代码块、行动选项

   特点：
   - 不强依赖某个网站ID
   - 低侵入，不乱改全站布局
   - 手机端适配
   - 纯 CSS，无 JS
========================================================= */


/* ==================== 全局主题变量 ==================== */

:root {
  --lh-bg-main: #fff8f5;
  --lh-bg-soft: #fbf3ff;
  --lh-card: rgba(255, 255, 255, 0.82);
  --lh-card-strong: rgba(255, 252, 250, 0.96);

  --lh-text: #3f3547;
  --lh-text-soft: #776c82;
  --lh-title: #4d3d68;

  --lh-purple: #77619a;
  --lh-purple-dark: #4c3e68;
  --lh-pink: #d99ab3;
  --lh-rose: #b85f7f;
  --lh-gold: #b8955c;
  --lh-blue: #6b83aa;
  --lh-green: #7eaa8a;

  --lh-border: rgba(169, 128, 174, 0.32);
  --lh-border-gold: rgba(184, 149, 92, 0.32);

  --lh-shadow: 0 14px 38px rgba(91, 65, 110, 0.14);
  --lh-shadow-soft: 0 8px 22px rgba(91, 65, 110, 0.09);

  --lh-radius-lg: 22px;
  --lh-radius-md: 16px;
  --lh-radius-sm: 10px;
}


/* ==================== 通用正文容器识别 ==================== */

/*
  会自动命中大部分网站的正文区。
  如果某个网站无效，把你网站最外层容器 class/id 加进这里即可。
*/

:where(
  .markdown-body,
  .prose,
  .prose-lg,
  .message-content,
  .message-body,
  .chat-message,
  .chat-content,
  .mes_text,
  .mes-block,
  .swipes,
  .custom-html,
  .custom-content,
  .ai-response,
  .bot-message,
  .assistant-message,
  .response-content,
  .content,
  article,
  main
) {
  color: var(--lh-text);
  line-height: 1.82;
  letter-spacing: 0.02em;
  font-family:
    "Noto Serif SC",
    "Source Han Serif SC",
    "Microsoft YaHei",
    "PingFang SC",
    "Hiragino Sans GB",
    serif;
}


/* ==================== 普通正文细节 ==================== */

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  .ai-response,
  .response-content,
  article,
  main
) p {
  margin: 0.72em 0;
}

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  .ai-response,
  .response-content,
  article,
  main
) strong {
  color: var(--lh-purple-dark);
  font-weight: 800;
}

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  .ai-response,
  .response-content,
  article,
  main
) em {
  color: var(--lh-rose);
  font-style: normal;
}

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  .ai-response,
  .response-content,
  article,
  main
) hr {
  height: 1px;
  border: none;
  margin: 24px 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(184, 149, 92, 0.55),
    transparent
  );
}


/* ==================== 标题美化 ==================== */

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  article,
  main
) :where(h1, h2, h3, h4) {
  color: var(--lh-title);
  font-weight: 800;
  letter-spacing: 0.05em;
}

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  article,
  main
) h1 {
  text-align: center;
  font-size: clamp(1.45rem, 4vw, 2rem);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lh-border-gold);
}

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  article,
  main
) h2 {
  padding-left: 12px;
  border-left: 4px solid rgba(216, 154, 179, 0.78);
}

:where(
  .markdown-body,
  .prose,
  .message-content,
  .message-body,
  .chat-content,
  .mes_text,
  article,
  main
) h3 {
  color: var(--lh-rose);
}


/* ==================== details 状态栏通用美化 ==================== */

details {
  position: relative;
  box-sizing: border-box;
  margin: 14px 0;
  border: 1px solid var(--lh-border);
  border-radius: var(--lh-radius-md);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 210, 229, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(251, 244, 255, 0.82));
  box-shadow: var(--lh-shadow-soft);
  overflow: hidden;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

details:hover {
  transform: translateY(-1px);
  border-color: rgba(184, 149, 92, 0.48);
  box-shadow: 0 12px 30px rgba(91, 65, 110, 0.14);
}

details[open] {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 220, 235, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(252, 246, 255, 0.94));
}


/* ==================== summary 标题条 ==================== */

summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 12px 48px 12px 16px;
  color: var(--lh-purple-dark);
  font-weight: 800;
  font-size: 1em;
  letter-spacing: 0.06em;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background:
    linear-gradient(90deg, rgba(255, 245, 250, 0.96), rgba(247, 241, 255, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), transparent);
  border-bottom: 1px solid rgba(184, 149, 92, 0.18);
}

summary::-webkit-details-marker {
  display: none;
}

/* 左侧徽章 */
summary::before {
  content: "✦";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 30%, #fff0bd, transparent 28%),
    linear-gradient(135deg, var(--lh-pink), var(--lh-purple));
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.72),
    0 6px 12px rgba(119, 97, 154, 0.24);
}

/* 右侧展开按钮 */
summary::after {
  content: "⌄";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  color: var(--lh-gold);
  border: 1px solid rgba(184, 149, 92, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 0.22s ease;
}

details[open] > summary::after {
  transform: translateY(-50%) rotate(180deg);
}

/* details 内部间距 */
details > *:not(summary) {
  margin-left: 18px;
  margin-right: 18px;
}

details > :last-child {
  margin-bottom: 18px;
}


/* ==================== 按 summary 内容自动换徽章 ==================== */

/* 当前情况 */
summary:where([title*="当前"], [aria-label*="当前"])::before {
  content: "☁";
}

/* 现代浏览器可识别文字内容的大致增强 */
details summary {
  --lh-icon-bg: linear-gradient(135deg, var(--lh-pink), var(--lh-purple));
}

/* 这里不用过度依赖 nth-of-type，保证换站也能正常 */


/* ==================== 列表美化 ==================== */

:where(ul, ol) {
  padding-left: 1.35em;
}

:where(li) {
  margin: 0.36em 0;
}

:where(li)::marker {
  color: var(--lh-gold);
}

details :where(p, li) {
  color: #50455a;
}


/* ==================== 状态栏字段卡片感 ==================== */

details p {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

details strong {
  display: inline-block;
  color: var(--lh-purple-dark);
  font-weight: 800;
}


/* ==================== 表格通用美化 ==================== */

table {
  width: 100%;
  margin: 16px 0;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--lh-border-gold);
  border-radius: var(--lh-radius-md);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--lh-shadow-soft);
}

thead {
  background:
    linear-gradient(90deg, rgba(119, 97, 154, 0.94), rgba(184, 149, 92, 0.84));
  color: #fff;
}

th {
  padding: 10px 9px;
  color: #fff;
  font-weight: 800;
  border: none;
  white-space: nowrap;
}

td {
  padding: 10px 9px;
  border-top: 1px solid rgba(184, 149, 92, 0.16);
  color: #4c4058;
  background: rgba(255, 255, 255, 0.46);
}

tbody tr:nth-child(even) td {
  background: rgba(246, 237, 248, 0.52);
}

tbody tr:hover td {
  background: rgba(255, 239, 247, 0.82);
}


/* ==================== 论坛 / 引用块美化 ==================== */

blockquote {
  position: relative;
  margin: 12px 0;
  padding: 12px 14px 12px 18px;
  color: #5b5064;
  border-left: 4px solid rgba(216, 154, 179, 0.75);
  border-radius: var(--lh-radius-sm);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 246, 251, 0.74));
  box-shadow: 0 6px 16px rgba(91, 65, 110, 0.07);
}

blockquote::before {
  content: "BBS";
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(119, 97, 154, 0.48);
}


/* ==================== 代码块 / 记忆区 ==================== */

pre {
  margin: 14px 0;
  padding: 14px;
  border-radius: var(--lh-radius-md);
  border: 1px solid rgba(119, 97, 154, 0.24);
  background:
    linear-gradient(135deg, rgba(43, 35, 57, 0.95), rgba(67, 54, 86, 0.95));
  color: #f5edf9;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 8px 20px rgba(46, 36, 64, 0.18);
  overflow-x: auto;
}

code {
  font-family:
    "LXGW WenKai Mono",
    "Consolas",
    "Menlo",
    "Monaco",
    monospace;
  font-size: 0.92em;
}

:not(pre) > code {
  padding: 2px 6px;
  color: #6c4d87;
  background: rgba(246, 237, 248, 0.92);
  border: 1px solid rgba(119, 97, 154, 0.18);
  border-radius: 8px;
}


/* ==================== 行动推荐：自动把最后一个 details 的列表按钮化 ==================== */

details:last-of-type :where(ol, ul) {
  list-style: none;
  padding-left: 0;
  margin: 14px 0 18px;
  display: grid;
  gap: 10px;
}

details:last-of-type li {
  position: relative;
  margin: 0;
  padding: 12px 14px 12px 42px;
  border: 1px solid rgba(184, 149, 92, 0.28);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 244, 250, 0.78));
  box-shadow: 0 6px 16px rgba(91, 65, 110, 0.07);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

details:last-of-type li:hover {
  transform: translateX(3px);
  border-color: rgba(216, 154, 179, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 235, 246, 0.9));
}

details:last-of-type li::before {
  content: "♡";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lh-pink), var(--lh-purple));
  box-shadow: 0 4px 10px rgba(119, 97, 154, 0.22);
}


/* ==================== 链接 ==================== */

a {
  color: #76549b;
  text-decoration: none;
  border-bottom: 1px dashed rgba(119, 97, 154, 0.38);
}

a:hover {
  color: var(--lh-rose);
  border-bottom-color: rgba(216, 154, 179, 0.72);
}


/* ==================== 图片 ==================== */

img {
  max-width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(184, 149, 92, 0.24);
  box-shadow: var(--lh-shadow-soft);
}


/* ==================== 输入框 / 按钮通用兼容 ==================== */

textarea,
input[type="text"],
input[type="search"],
input:not([type]),
[contenteditable="true"] {
  border-radius: 14px !important;
  border: 1px solid rgba(184, 149, 92, 0.34) !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(252, 244, 255, 0.9)) !important;
  color: var(--lh-text) !important;
  box-shadow: 0 6px 18px rgba(91, 65, 110, 0.08) !important;
}

textarea:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input:not([type]):focus,
[contenteditable="true"]:focus {
  outline: none !important;
  border-color: rgba(216, 154, 179, 0.72) !important;
  box-shadow:
    0 0 0 3px rgba(216, 154, 179, 0.18),
    0 8px 22px rgba(91, 65, 110, 0.12) !important;
}

button,
input[type="button"],
input[type="submit"],
[role="button"] {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(135deg, var(--lh-pink), var(--lh-purple));
  color: #fff;
  box-shadow: 0 7px 16px rgba(119, 97, 154, 0.2);
  transition:
    transform 0.18s ease,
    filter 0.18s ease,
    box-shadow 0.18s ease;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
[role="button"]:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(119, 97, 154, 0.26);
}


/* ==================== 可选：页面浅色背景 ==================== */
/*
  如果你不想改网站整体背景，可以删除这一段。
*/

body {
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 214, 230, 0.28), transparent 30%),
    radial-gradient(circle at 90% 8%, rgba(205, 218, 255, 0.24), transparent 30%),
    linear-gradient(135deg, #fffaf8 0%, #fbf4ff 48%, #fffdf9 100%);
}


/* ==================== 手机适配 ==================== */

@media (max-width: 768px) {
  :where(
    .markdown-body,
    .prose,
    .message-content,
    .message-body,
    .chat-message,
    .chat-content,
    .mes_text,
    .ai-response,
    .response-content,
    article,
    main
  ) {
    font-size: 14px;
    line-height: 1.75;
  }

  details {
    margin: 10px 0;
    border-radius: 14px;
  }

  summary {
    min-height: 42px;
    padding: 10px 42px 10px 13px;
    font-size: 0.94em;
    letter-spacing: 0.04em;
  }

  summary::before {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  details > *:not(summary) {
    margin-left: 12px;
    margin-right: 12px;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border-radius: 12px;
  }

  th,
  td {
    padding: 8px 7px;
    font-size: 13px;
  }

  blockquote,
  pre {
    margin-left: 0;
    margin-right: 0;
  }

  details:last-of-type li {
    padding: 10px 12px 10px 38px;
  }
}


/* ==================== 超窄屏 ==================== */

@media (max-width: 420px) {
  :where(
    .markdown-body,
    .prose,
    .message-content,
    .message-body,
    .chat-content,
    .mes_text,
    article,
    main
  ) {
    font-size: 13px;
  }

  summary {
    font-size: 0.9em;
  }

  h1 {
    font-size: 1.34rem;
  }

  h2 {
    font-size: 1.12rem;
  }
}

/* ═══════════════════════════════════════════
   璃华女子学院 · NPC角色立绘系统
   立绘规格：16:9竖构图（9:16比例）
   尺寸：放大两倍显示
═══════════════════════════════════════════ */

/* ──── 角色立绘容器 ──── */
.lihua-npc {
    width: 320px !important;
    height: 568px !important;
    /* 9:16竖构图比例 × 2倍 = 320×568 */

    border: 3px solid rgba(155, 89, 182, 0.6) !important;
    border-radius: 14px !important;

    box-shadow:
        0 8px 30px rgba(13, 10, 18, 0.65),
        0 0 0 1px rgba(155, 89, 182, 0.2),
        inset 0 0 20px rgba(0, 0, 0, 0.25) !important;

    background-color: #1a1525 !important;
    background-size: cover !important;
    background-position: center top !important;
    background-repeat: no-repeat !important;

    display: block !important;
    margin: 14px auto 10px auto !important;
    position: relative !important;
    overflow: hidden !important;

    animation: lihuaNpcFloat 4s ease-in-out infinite !important;
}

/* 角色名底部标签 */
.lihua-npc::after {
    content: attr(data-npc) !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 14px 12px 10px !important;
    background: linear-gradient(
        to top,
        rgba(13, 10, 18, 0.95),
        rgba(13, 10, 18, 0.6),
        rgba(13, 10, 18, 0.15),
        transparent
    ) !important;
    color: #f0c896 !important;
    font-size: 0.9em !important;
    font-weight: 700 !important;
    text-align: center !important;
    letter-spacing: 1.5px !important;
}

/* 悬浮动画 */
@keyframes lihuaNpcFloat {
    0%, 100% {
        transform: translateY(0);
        box-shadow:
            0 8px 30px rgba(13, 10, 18, 0.65),
            0 0 0 1px rgba(155, 89, 182, 0.2),
            inset 0 0 20px rgba(0, 0, 0, 0.25);
    }
    50% {
        transform: translateY(-4px);
        box-shadow:
            0 14px 40px rgba(13, 10, 18, 0.75),
            0 0 0 1px rgba(155, 89, 182, 0.4),
            0 0 15px rgba(155, 89, 182, 0.12),
            inset 0 0 20px rgba(0, 0, 0, 0.25);
    }
}

/* ──── 各角色派系边框色 ──── */
.lihua-npc-shen { border-color: rgba(192, 192, 192, 0.7) !important; }
.lihua-npc-gu { border-color: rgba(232, 67, 147, 0.7) !important; }
.lihua-npc-liu { border-color: rgba(0, 184, 148, 0.7) !important; }
.lihua-npc-wen { border-color: rgba(108, 92, 231, 0.7) !important; }
.lihua-npc-su { border-color: rgba(253, 203, 110, 0.7) !important; }
.lihua-npc-qi { border-color: rgba(99, 110, 114, 0.7) !important; }
.lihua-npc-qian { border-color: rgba(253, 121, 168, 0.7) !important; }
.lihua-npc-lin { border-color: rgba(85, 168, 107, 0.7) !important; }
.lihua-npc-qinmanman { border-color: rgba(225, 112, 85, 0.7) !important; }
.lihua-npc-zhoulingxian { border-color: rgba(225, 112, 85, 0.7) !important; }

/* ──── 各角色立绘图片 ──── */
.lihua-npc-shen { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsDlqGGVVSfOS5ZFW7zYNGyRPjhgQOwACRigAAqpNwFTSyxDrjhy4RTsE.png') !important; }
.lihua-npc-gu { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsD9qGGVrg2HuYdAJ8u2dCtk5Mj1LFQACTCgAAqpNwFSg2ygKipLl5jsE.png') !important; }
.lihua-npc-liu { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsD5qGGVnvGxQRUlpbkVBDovacQUkugACSygAAqpNwFT1PWRFoEELYjsE.png') !important; }
.lihua-npc-wen { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsEBqGGVtnPjeHkMWxmXcYTJaDoI42AACTSgAAqpNwFQPCy7QRupISTsE.png') !important; }
.lihua-npc-su { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsDtqGGVdBuK7cLAzgsVOc8qI_-c8nwACSCgAAqpNwFT7nUPoSkeUkzsE.png') !important; }
.lihua-npc-qi { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsEFqGGVyNPrVAAFjKWl_JO7ZJAXLDUwAAk4oAAKqTcBUmVqytCXVCzI7BA.png') !important; }
.lihua-npc-qian { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsDxqGGVgyF1_XvHQwQ8RYopE_L713wACSSgAAqpNwFTtSk3Sbyj7UTsE.png') !important; }
.lihua-npc-lin { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsDpqGGVYdcKyAogcjTX6bMBOjLOWXgACRygAAqpNwFSjWt_ls0c_kDsE.png') !important; }
.lihua-npc-qinmanman { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsEVqGGbD9tCtHK2BeKt2QL7X2hOqmQACWCgAAqpNwFSW3SLiyhIkEzsE.png') !important; }
.lihua-npc-zhoulingxian { background-image: url('https://img.remit.ee/api/file/BQACAgUAAyEGAASHRsPbAAEUsEpqGGdqqRjrechw8srUeriUNj6_5QACXSgAAqpNwFRXklXWBfjvkzsE.png') !important; }

/* ──── 移动端适配 ──── */
@media (max-width: 600px) {
    .lihua-npc {
        width: 240px !important;
        height: 426px !important;
        /* 移动端1.5倍 */
    }
}

@media (max-width: 400px) {
    .lihua-npc {
        width: 200px !important;
        height: 355px !important;
    }
}

/* ──── 减少动画偏好 ──── */
@media (prefers-reduced-motion: reduce) {
    .lihua-npc {
        animation: none !important;
    }
}