/* ============================================================
   Web 字体（7 种可选，仅用于卡片正文）
   ============================================================ */
@font-face {
  font-family: "Chillhfs1";
  src: url("../font/Chillhfs1.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "gfyxct";
  src: url("../font/gfyxct.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "hwfs";
  src: url("../font/hwfs.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "smiley";
  src: url("../font/smiley.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "yomeng";
  src: url("../font/yomeng.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "zhxht";
  src: url("../font/zhxht.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ztqyt";
  src: url("../font/ztqyt.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   CSS 变量系统（深色主题默认值）
   ============================================================ */
:root {
  /* --- 基础色彩 --- */
  --bg-main: #080c12;
  --bg-card: #0a0b0f;
  --bg-card2: #0c1118;
  --text-main: #eef4f8;
  --text-muted: #8d9aa8;
  --brand-yellow: #ff7ab8;
  --neon-blue: #ff6fae;
  --neon-pink: #f17ab4;
  --neon-cyan: #ff5f91;

  /* --- 阴影 --- */
  --shadow-soft: 0 16px 38px rgba(0, 0, 0, 0.34);
  --shadow-raised: 0 10px 26px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --shadow-card: 26px 30px 54px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-popover: 0 18px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);

  /* --- 边框 & 悬停 --- */
  --border-dim: rgba(255, 128, 183, 0.13);
  --border-md: rgba(255, 128, 183, 0.26);
  --hover-pink: rgba(241, 122, 180, 0.12);

  /* --- 背景 & 导航 --- */
  --bg-page: linear-gradient(145deg, #070a0f 0%, #0d141d 46%, #121722 100%);
  --nav-bg: rgba(11, 16, 23, 0.92);
  --nav-border: rgba(255, 255, 255, 0.1);

  /* --- 杂项 UI --- */
  --scrollbar-thumb: #d85b95;
  --placeholder-color: #596777;
  --counter-color: #687687;
  --toast-bg: rgba(16, 23, 31, 0.96);
  --toast-border: rgba(255, 128, 183, 0.34);
  --toast-color: #ff9fca;
  --code-bg: rgba(255, 255, 255, 0.055);
  --code-border: rgba(142, 169, 197, 0.16);
  --heading-border-strong: rgba(213, 213, 213, 0.3);
  --heading-border-soft: rgba(142, 169, 197, 0.18);
  --rule-border: rgba(255, 255, 255, 0.1);
  --table-border: rgba(255, 255, 255, 0.12);
  --table-head-bg: rgba(103, 168, 255, 0.1);
  --loading-bg: rgba(8, 12, 18, 0.88);
  --spinner-track: rgba(255, 128, 183, 0.22);
  --theme-toggle-bg: linear-gradient(145deg, rgba(255, 128, 183, 0.18), rgba(255, 255, 255, 0.035));

  --app-text: #edf3f7;
  --app-muted: #a9acae;
  --app-subtle: #757a7e;
  --app-border: rgba(255, 255, 255, 0.1);
  --app-border-strong: rgba(255, 255, 255, 0.3);
  --app-control-bg: linear-gradient(145deg, rgba(255, 128, 183, 0.12), rgba(255, 255, 255, 0.035));
  --app-control-hover: linear-gradient(145deg, rgba(255, 111, 174, 0.22), rgba(255, 159, 202, 0.09));
  --app-accent: #ff6fae;
  --app-accent-2: #ff9fca;
  --app-accent-warm: #f17ab4;
  --app-accent-soft: rgba(255, 111, 174, 0.14);
  --app-panel-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.045), inset -1px 0 0 rgba(0, 0, 0, 0.24);

  /* --- 尺寸 & 其他 --- */
  --btn-radius: 6px;
  --color-scheme: dark;
}

/* ============================================================
   CSS 变量系统（浅色主题覆盖）
   ============================================================ */
html[data-theme="light"] {
  --bg-main: #f6fbf8;
  --bg-card: #ffffff;
  --bg-card2: #edf8f5;
  --text-main: #25343a;
  --text-muted: #70838a;
  --brand-yellow: #d93882;
  --neon-blue: #e84f96;
  --neon-pink: #de6d9d;
  --neon-cyan: #ff5f91;
  --shadow-soft: 0 16px 36px rgba(101, 126, 133, 0.13);
  --shadow-raised: 0 10px 24px rgba(93, 123, 130, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  --shadow-card: 24px 28px 46px rgba(94, 118, 123, 0.3), -20px -20px 36px rgba(255, 255, 255, 0.64), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --shadow-popover: 0 18px 42px rgba(91, 119, 124, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --border-dim: rgba(216, 56, 130, 0.16);
  --border-md: rgba(216, 56, 130, 0.28);
  --hover-pink: rgba(222, 109, 157, 0.1);
  --bg-page: linear-gradient(135deg, #f4fbf8 0%, #eef9fb 48%, #fbf6fb 100%);
  --nav-bg: rgba(252, 255, 253, 0.88);
  --nav-border: rgba(216, 56, 130, 0.2);
  --scrollbar-thumb: #e36a9f;
  --placeholder-color: #9badb0;
  --counter-color: #82989b;
  --toast-bg: rgba(255, 255, 255, 0.94);
  --toast-border: rgba(216, 56, 130, 0.24);
  --toast-color: #c92f78;
  --code-bg: rgba(232, 79, 150, 0.07);
  --code-border: rgba(232, 79, 150, 0.14);
  --heading-border-strong: rgba(25, 170, 155, 0.24);
  --heading-border-soft: rgba(95, 134, 232, 0.14);
  --rule-border: rgba(104, 143, 146, 0.18);
  --table-border: rgba(104, 143, 146, 0.2);
  --table-head-bg: rgba(25, 170, 155, 0.08);
  --loading-bg: rgba(246, 251, 248, 0.86);
  --spinner-track: rgba(232, 79, 150, 0.16);
  --theme-toggle-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 238, 247, 0.82));
  --app-text: #314148;
  --app-muted: #74888e;
  --app-subtle: #98a9ad;
  --app-border: rgba(0, 0, 0, 0.1);
  --app-border-strong: rgba(0, 0, 0, 0.1);
  --app-control-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 238, 247, 0.86));
  --app-control-hover: linear-gradient(145deg, rgba(255, 238, 247, 0.98), rgba(255, 224, 240, 0.9));
  --app-accent: #e84f96;
  --app-accent-2: #f08ab8;
  --app-accent-warm: #de6d9d;
  --app-accent-soft: rgba(232, 79, 150, 0.1);
  --app-panel-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.72), inset -1px 0 0 rgba(115, 145, 148, 0.08);
  --color-scheme: light;
}

/* ============================================================
   全局基础样式
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg-page);
  color: var(--text-main);
  color-scheme: var(--color-scheme);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  background: #0a0b0f;
  transition: background 0.5s ease;
}
[data-theme="light"] body {
  background: #fbfbfc;
}
a {
  text-decoration: none !important;
}

/* 主题切换过渡 */
body,
.navbar,
.btn,
#main-textarea,
.content-card,
#capture-target,
#toast,
#loading-overlay {
  transition:
    background 0.28s ease,
    background-color 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #ffeef7;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #ec4899;
}

html:not([data-theme="light"]) ::-webkit-scrollbar-track {
  background: #1a0f18;
}
html:not([data-theme="light"]) ::-webkit-scrollbar-thumb:hover {
  background: #ff8fbd;
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-yellow);
  letter-spacing: 0.05em;
  cursor: default;
  user-select: none;
  font-family: "Noto Serif SC", "Times New Roman", Times, ui-serif, Georgia, serif !important;
}

.nav-center-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-center-links a {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
}

.nav-center-links a:hover {
  background: #ec4899;
  color: #fff;
  transform: scale(1.05);
}

.nav-buttons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ============================================================
   通用按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.3rem 0.9rem;
  border-radius: var(--btn-radius);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
  border: 1.5px solid;
  white-space: nowrap;
  user-select: none;
  outline: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:hover {
  transform: scale(1.05);
}

.btn-blue {
  color: var(--neon-blue);
  border-color: var(--neon-blue);
}
.btn-blue:hover {
  background: var(--hover-pink);
  color: var(--neon-pink);
  border-color: var(--neon-pink);
}

.btn-pink {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
}
.btn-pink:hover {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border-color: var(--neon-pink);
}

/* 主题切换按钮 */
.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  flex: 0 0 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border-md);
  background: var(--theme-toggle-bg);
  color: var(--text-main);
  box-shadow: var(--shadow-raised);
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  background: var(--hover-pink);
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  transform: scale(1.05);
}

.theme-toggle.is-spinning {
  animation: themeSpin 0.45s ease;
}

@keyframes themeSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   视图1：文本输入页
   ============================================================ */
#view-input {
  min-height: 100vh;
  padding-top: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.input-container {
  width: 100%;
  max-width: 760px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.text-input-wrap {
  position: relative;
}

#main-textarea {
  width: 100%;
  min-height: 340px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-md);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.75;
  padding: 1.25rem 1.5rem;
  resize: vertical;
  outline: none;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
  font-family: inherit;
}

#main-textarea::placeholder {
  color: var(--placeholder-color);
}
#main-textarea:focus {
  border-color: var(--neon-blue);
}

.char-counter {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 0.75rem;
  color: var(--counter-color);
  pointer-events: none;
}

/* ============================================================
   Toast 提示
   ============================================================ */
#toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  color: var(--toast-color);
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  z-index: 9999;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-popover);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   卡片布局辅助
   ============================================================ */
.card-center-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  min-height: 0;
}

/* ============================================================
   内容展示卡片（3:4 固定比例，无滚动）
   ============================================================ */
.content-card {
  background: var(--bg-card);
  padding: 2rem 2.5rem;
  line-height: 1.9;
  font-size: 20px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  aspect-ratio: 3/4;
  width: 100%;
  max-width: 600px;
  min-width: 320px;
  flex-shrink: 0;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

/* 离屏截图容器（与卡片尺寸一致，导出时渲染） */
#capture-target {
  background: var(--bg-card);
  padding: 2rem 2.5rem;
  line-height: 1.9;
  font-size: 20px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  width: 600px;
  height: 800px;
  overflow: hidden;
  position: fixed;
  top: -9999px;
  left: 0;
  box-sizing: border-box;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   Markdown 模式样式（卡片 + 截图容器共用）
   ============================================================ */
.md-mode {
  white-space: normal;
  word-break: normal;
  overflow: hidden;
}

.md-mode h1 {
  font-size: 2.4em;
  font-weight: 800;
  margin: 0.2em 0 0.4em;
  line-height: 1.3;
  border-bottom: 2px solid var(--heading-border-strong);
  padding-bottom: 0.3em;
  font-family: "Noto Serif SC", ui-serif, Georgia, serif !important;
}

.md-mode h2 {
  font-size: 1.3em;
  font-weight: 700;
  margin: 0.55em 0 0.5em;
  line-height: 1.3;
  border-bottom: 1px solid var(--heading-border-soft);
  padding-bottom: 0.5em;
}

.md-mode h3 {
  font-size: 1.15em;
  font-weight: 600;
  margin: 0.4em 0 0.3em;
  line-height: 1.4;
}

.md-mode h4,
.md-mode h5,
.md-mode h6 {
  font-size: 1em;
  font-weight: 600;
  margin: 0.3em 0 0.15em;
}

.md-mode p {
  margin: 0.3em 0;
  line-height: 1.8;
}
.md-mode p:first-child {
  margin-top: 0;
}
.md-mode p:last-child {
  margin-bottom: 0;
}

.md-mode strong {
  font-weight: 700;
  color: var(--neon-cyan);
}
.md-mode em {
  font-style: italic;
}

.md-mode code,
.md-mode kbd,
.md-mode samp {
  font-family: monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: var(--neon-cyan);
}

.md-mode pre {
  font-family: monospace;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--btn-radius);
  padding: 0.7em 1em;
  margin: 0.4em 0;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  font-size: 0.85em;
}

.md-mode pre code,
.md-mode pre kbd,
.md-mode pre samp {
  font-family: inherit;
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.md-mode blockquote {
  border-left: 3px solid var(--neon-blue);
  padding: 0.3em 0.8em;
  margin: 0.4em 0;
  color: var(--text-muted);
  font-style: italic;
}

.md-mode ul {
  list-style: none;
  padding-left: 1.4em;
  margin: 0.3em 0;
  line-height: 1.7;
}

.md-mode ul li {
  position: relative;
  padding-left: 0.5em;
}
.md-mode ul li::before {
  content: "•";
  position: absolute;
  left: -1em;
  color: currentColor;
  font-size: 1em;
}
.md-mode ul ul li::before {
  content: "○";
}
.md-mode ul ul ul li::before {
  content: "▪";
}

.md-mode ol {
  list-style: none;
  padding-left: 1.8em;
  margin: 0.3em 0;
  line-height: 1.7;
  counter-reset: ol-counter;
}

.md-mode ol li {
  position: relative;
  counter-increment: ol-counter;
  padding-left: 0.5em;
}

.md-mode ol li::before {
  content: counter(ol-counter) ".";
  position: absolute;
  left: -1.4em;
  width: 1.2em;
  text-align: right;
  color: currentColor;
  font-size: 1em;
}

.md-mode ol ol {
  counter-reset: sub-counter;
}
.md-mode ol ol li {
  counter-increment: sub-counter;
}
.md-mode ol ol li::before {
  content: counter(sub-counter) ".";
  left: -1.8em;
}

.md-mode hr {
  border: none;
  border-top: 1px solid var(--rule-border);
  margin: 0.6em 0;
}

.md-mode table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.4em 0;
  font-size: 0.85em;
}

.md-mode th,
.md-mode td {
  border: 1px solid var(--table-border);
  padding: 0.3em 0.6em;
  text-align: left;
}

.md-mode th {
  background: var(--table-head-bg);
  font-weight: 600;
}

/* ============================================================
   加载遮罩
   ============================================================ */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--loading-bg);
  backdrop-filter: blur(4px);
  z-index: 9998;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

#loading-overlay.show {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--spinner-track);
  border-top-color: var(--neon-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: var(--neon-blue);
  font-size: 0.9rem;
}
.loading-progress {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ============================================================
   xhs-ui-ready 工作区布局
   ============================================================ */

body.xhs-ui-ready {
  overflow: hidden;
  color: var(--app-muted);
}

body.xhs-ui-ready .navbar {
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: none;
  color: var(--app-muted);
}

body.xhs-ui-ready .brand {
  color: var(--brand-yellow);
  letter-spacing: 0;
  font-size: 20px;
}

body.xhs-ui-ready .nav-buttons .btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  color: var(--app-muted);
  background: var(--app-control-bg);
  text-shadow: none;
}

body.xhs-ui-ready .theme-toggle {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 50%;
  font-size: 15px;
}

body.xhs-ui-ready #view-input {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  display: block !important;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.xhs-workspace {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 40vw) minmax(420px, 1fr) 240px;
}

/* --- 左侧编辑区 --- */
.xhs-left {
  position: relative;

  border-right: 1px solid var(--app-border);
  box-shadow: var(--app-panel-shadow);
  display: flex;
  flex-direction: column;
}

.xhs-editor-bar {
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;

  border-bottom: 1px solid var(--app-border);
}

.xhs-editor-title {
  color: var(--app-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.xhs-editor-title a {
  color: var(--app-accent-warm);
  display: inline-block;
  transition: transform 0.2s ease;
}

.xhs-editor-title a:hover {
  transform: scale(1.05);
  color: var(--app-accent-warm);
}

.xhs-editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 编辑区按钮（紫粉实色） */
.xhs-editor-actions button,
.xhs-preview-actions button {
  height: 30px;
  padding: 0 8px;
  border: 1px solid #f472b6;
  border: none;
  border-radius: 6px;
  background: #ec4899;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s;
}

.xhs-editor-actions button:hover,
.xhs-preview-actions button:hover {
  background: #db2777;
  border-color: #db2777;
  transform: scale(1.05);
}

.xhs-preview-actions button.edit-active {
  background: #be185d;
  border-color: #be185d;
}
.xhs-preview-actions button.edit-active:hover {
  background: #9d174d;
  border-color: #9d174d;
}

/* --- 文本域 --- */
.xhs-left .input-container {
  width: 100%;
  max-width: none;
  padding: 28px 0 28px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.xhs-left .text-input-wrap {
  flex: 1;
  display: flex;
}

body.xhs-ui-ready #main-textarea {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 0 28px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--app-text);
  resize: none;
  box-shadow: none;
  font-size: 16px;
  line-height: 1.9;
}

body.xhs-ui-ready #main-textarea:focus {
  border: 0;
  box-shadow: none;
}

body.xhs-ui-ready .char-counter {
  right: 0;
  bottom: -22px;
  color: var(--app-subtle);
}

/* --- 预览区 --- */
.xhs-preview-bar {
  width: 100%;
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--app-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.xhs-preview-title {
  color: var(--app-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.xhs-preview-title a {
  color: var(--app-accent-warm);
  display: inline-block;
  transition: transform 0.2s ease;
}
.xhs-preview-title a:hover {
  transform: scale(1.05);
}

.xhs-preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xhs-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  background: var(--bg-main);
  overflow: auto;
}

.xhs-preview .card-center-wrapper {
  justify-content: flex-start;
  gap: 40px;
  width: 100%;
  padding: 32px 32px 44px;
}

body.xhs-ui-ready .content-card {
  width: min(42vw, 600px);
  min-width: 360px;
  max-width: 600px;
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-card);
  border: 1px solid color-mix(in srgb, var(--app-border) 76%, transparent);
}

/* 卡片编辑态 */
body.xhs-ui-ready .content-card[contenteditable="true"] {
  cursor: text;
  outline: 2px solid transparent;
  outline-offset: 4px;
}
body.xhs-ui-ready .content-card[contenteditable="true"]:focus {
  outline-color: color-mix(in srgb, var(--app-accent) 42%, transparent);
}

/* --- 右侧设置面板 --- */
.xhs-side {
  width: 240px;

  border-left: 1px solid var(--app-border);
  box-shadow: var(--app-panel-shadow);
  padding: 24px 18px;
  overflow: auto;
}

.xhs-group {
  margin-bottom: 20px;
}

.xhs-title {
  color: var(--app-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

/* 字体选择：两列按钮网格 */
.xhs-font-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.xhs-font-btn {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: var(--app-control-bg);
  color: var(--app-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.2s;
}

.xhs-font-btn:hover {
  color: var(--app-accent-warm);
  border-color: color-mix(in srgb, var(--app-accent-warm) 46%, transparent);
  background: var(--app-control-hover);
  transform: scale(1.05);
}

.xhs-font-btn.active {
  color: #fff;
  border-color: #ec4899;
  background: #ec4899;
}

.xhs-font-btn.active:hover {
  background: #db2777;
  border-color: #db2777;
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-font-btn {
  background: var(--app-control-bg);
  border-color: var(--app-border);
  color: var(--app-muted);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-font-btn:hover {
  color: var(--app-accent-warm);
  border-color: var(--app-border-strong);
  background: var(--app-control-hover);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-font-btn.active {
  color: #fff;
  border-color: #ec4899;
  background: #ec4899;
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-font-btn.active:hover {
  background: #db2777;
  border-color: #db2777;
}

/* --- 行内工具按钮 --- */
.xhs-inline-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  position: relative;
}

.xhs-inline-btn {
  flex: 1;
  height: 36px;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: var(--app-control-bg);
  color: var(--app-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}

.xhs-inline-btn:hover {
  color: var(--app-accent-warm);
  border-color: color-mix(in srgb, var(--app-accent-warm) 46%, transparent);
  background: var(--app-control-hover);
  transform: scale(1.05);
}

/* 高亮色板弹窗 */
.xhs-highlight-popup {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;

  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: var(--shadow-popover);
  padding: 6px;
  gap: 6px;
  z-index: 20;
  display: none;
}

.xhs-highlight-popup.is-open {
  display: flex;
}

.xhs-hl-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--app-border);
  cursor: pointer;
  transition: transform 0.15s;
}

.xhs-hl-swatch:hover {
  transform: scale(1.05);
  border-color: var(--app-accent-warm);
}

/* 高亮色板静态背景色（行内样式迁移） */
.xhs-hl-swatch[data-highlight="#FFFF00"] {
  background-color: #ffff00;
}
.xhs-hl-swatch[data-highlight="#00DDFF"] {
  background-color: #00ddff;
}
.xhs-hl-swatch[data-highlight="#FF4BDB"] {
  background-color: #ff4bdb;
}

/* --- 颜色/背景 色板 --- */
.xhs-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.xhs-swatch {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  outline: 1px solid var(--app-border);
  transition: transform 0.2s ease;
}

.xhs-swatch:hover {
  transform: scale(1.05);
}

/* xhs-swatch 色板静态背景色（行内样式迁移 — 字体颜色色板） */
.xhs-swatch[data-value="#ffffff"] {
  background: #ffffff;
}
.xhs-swatch[data-value="#222222"] {
  background: #222222;
}
.xhs-swatch[data-value="#FF0000"] {
  background: #ff0000;
}
.xhs-swatch[data-value="#FF4500"] {
  background: #ff4500;
}
.xhs-swatch[data-value="#FF7F00"] {
  background: #ff7f00;
}
.xhs-swatch[data-value="#FFB90F"] {
  background: #ffb90f;
}
.xhs-swatch[data-value="#FFFF00"] {
  background: #ffff00;
}
.xhs-swatch[data-value="#ADFF2F"] {
  background: #adff2f;
}
.xhs-swatch[data-value="#00FF00"] {
  background: #00ff00;
}
.xhs-swatch[data-value="#00FA9A"] {
  background: #00fa9a;
}
.xhs-swatch[data-value="#00FFFF"] {
  background: #00ffff;
}
.xhs-swatch[data-value="#00BFFF"] {
  background: #00bfff;
}
.xhs-swatch[data-value="#0000FF"] {
  background: #0000ff;
}
.xhs-swatch[data-value="#4169E1"] {
  background: #4169e1;
}
.xhs-swatch[data-value="#8A2BE2"] {
  background: #8a2be2;
}
.xhs-swatch[data-value="#9900FF"] {
  background: #9900ff;
}
.xhs-swatch[data-value="#FF00FF"] {
  background: #ff00ff;
}
.xhs-swatch[data-value="#FF1493"] {
  background: #ff1493;
}
.xhs-swatch[data-value="#FF3E96"] {
  background: #ff3e96;
}
.xhs-swatch[data-value="#FF6EB4"] {
  background: #ff6eb4;
}
.xhs-swatch[data-value="#FF2400"] {
  background: #ff2400;
}
.xhs-swatch[data-value="#00E5EE"] {
  background: #00e5ee;
}
.xhs-swatch[data-value="#7FFF00"] {
  background: #7fff00;
}

/* xhs-swatch 纯色背景色板 */
.xhs-swatch[data-value="#000000"] {
  background: #000000;
}

/* xhs-swatch 渐变背景色板 */
.xhs-swatch[data-value="linear-gradient(135deg,#fff,#f0f0f0)"] {
  background: linear-gradient(135deg, #fff, #f0f0f0);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fff7f2,#ffe2ec)"] {
  background: linear-gradient(135deg, #fff7f2, #ffe2ec);
}
.xhs-swatch[data-value="linear-gradient(135deg,#f1fbff,#d7f0ff)"] {
  background: linear-gradient(135deg, #f1fbff, #d7f0ff);
}
.xhs-swatch[data-value="linear-gradient(135deg,#f8fff2,#ddffd9)"] {
  background: linear-gradient(135deg, #f8fff2, #ddffd9);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fffbe8,#ffe58a)"] {
  background: linear-gradient(135deg, #fffbe8, #ffe58a);
}
.xhs-swatch[data-value="linear-gradient(135deg,#f7f0ff,#ded1ff)"] {
  background: linear-gradient(135deg, #f7f0ff, #ded1ff);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fff,#dbeafe)"] {
  background: linear-gradient(135deg, #fff, #dbeafe);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fff1f2,#fecdd3)"] {
  background: linear-gradient(135deg, #fff1f2, #fecdd3);
}
.xhs-swatch[data-value="linear-gradient(135deg,#f0fdfa,#ccfbf1)"] {
  background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fafafa,#d4d4d4)"] {
  background: linear-gradient(135deg, #fafafa, #d4d4d4);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fdf2f8,#e0e7ff)"] {
  background: linear-gradient(135deg, #fdf2f8, #e0e7ff);
}
.xhs-swatch[data-value="linear-gradient(135deg,#fefce8,#dcfce7)"] {
  background: linear-gradient(135deg, #fefce8, #dcfce7);
}

/* xhs-swatch 图片背景色板（缩略预览） */
.xhs-swatch[data-value="url('img/bg1.jpg')"] {
  background: url("../img/preview/bg1.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg2.jpg')"] {
  background: url("../img/preview/bg2.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg3.jpg')"] {
  background: url("../img/preview/bg3.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg4.jpg')"] {
  background: url("../img/preview/bg4.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg5.jpg')"] {
  background: url("../img/preview/bg5.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg6.jpg')"] {
  background: url("../img/preview/bg6.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg7.jpg')"] {
  background: url("../img/preview/bg7.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg8.jpg')"] {
  background: url("../img/preview/bg8.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg9.jpg')"] {
  background: url("../img/preview/bg9.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg10.jpg')"] {
  background: url("../img/preview/bg10.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg11.jpg')"] {
  background: url("../img/preview/bg11.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg12.jpg')"] {
  background: url("../img/preview/bg12.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg13.jpg')"] {
  background: url("../img/preview/bg13.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg14.jpg')"] {
  background: url("../img/preview/bg14.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg15.jpg')"] {
  background: url("../img/preview/bg15.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg16.jpg')"] {
  background: url("../img/preview/bg16.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg17.jpg')"] {
  background: url("../img/preview/bg17.jpg") center/cover no-repeat;
}
.xhs-swatch[data-value="url('img/bg18.jpg')"] {
  background: url("../img/preview/bg18.jpg") center/cover no-repeat;
}

/* --- 下拉选择器 --- */
.xhs-hidden-file {
  display: none;
}

/* ============================================================
   纯黑深色主题 — xhs-ui-ready 完整适配
   ============================================================ */
html:not([data-theme="light"]) body.xhs-ui-ready {
  color: var(--app-text);
}

html:not([data-theme="light"]) body.xhs-ui-ready .navbar {
  border-bottom-color: var(--nav-border);
  color: var(--app-text);
}

html:not([data-theme="light"]) body.xhs-ui-ready .brand {
  color: var(--brand-yellow);
}

html:not([data-theme="light"]) body.xhs-ui-ready .nav-buttons .btn {
  background: var(--app-control-bg);
  border-color: var(--app-border);
  color: var(--app-text);
}

html:not([data-theme="light"]) body.xhs-ui-ready .nav-buttons .btn:hover {
  background: var(--app-control-hover);
  color: var(--app-accent-warm);
  border-color: var(--app-border-strong);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-left {
  border-right-color: var(--app-border);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-editor-bar {
  border-bottom-color: var(--app-border);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-editor-title {
  color: var(--app-muted);
}
html:not([data-theme="light"]) body.xhs-ui-ready #main-textarea {
  color: var(--app-text);
}
html:not([data-theme="light"]) body.xhs-ui-ready #main-textarea::placeholder {
  color: var(--placeholder-color);
}
html:not([data-theme="light"]) body.xhs-ui-ready .char-counter {
  color: var(--app-subtle);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-preview-bar {
  border-bottom-color: var(--app-border);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-preview-title {
  color: var(--app-muted);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-side {
  border-left-color: var(--app-border);
  box-shadow: var(--app-panel-shadow);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-title {
  color: var(--app-muted);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-inline-btn {
  background: var(--app-control-bg);
  border-color: var(--app-border);
  color: var(--app-muted);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-inline-btn:hover {
  color: var(--app-accent-warm);
  border-color: var(--app-border-strong);
  background: var(--app-control-hover);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-highlight-popup {
  border-color: var(--app-border);
  box-shadow: var(--shadow-popover);
}

html:not([data-theme="light"]) body.xhs-ui-ready .xhs-swatch {
  outline-color: var(--app-border);
}

html:not([data-theme="light"]) body.xhs-ui-ready .content-card[contenteditable="true"]:focus {
  outline-color: color-mix(in srgb, var(--app-accent) 48%, transparent);
}
