/* ==========================================================================
   文件名 : vault.css
   描述   : Vault 资源库页面样式 — 复用 theme.css 变量，暗色/白日自适应
   约定   : 页面内不使用 emoji；图标/箭头等装饰全部为 CSS 图形或内联 SVG
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', 'Roboto', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.7;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* 复用 wiki 头部导航样式（与 nav.js 一致） */
.wiki-header {
  background: var(--header-bg);
  border-bottom: 3px solid var(--accent);
  padding: 1.2rem 2rem;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-header);
}
.wiki-header .logo { font-size: 1.6rem; font-weight: 800; color: var(--accent); letter-spacing: 1px; text-decoration: none !important; }
.wiki-header .logo small { font-size: 0.8rem; font-weight: 400; color: var(--text-dim); margin-left: 0.6rem; }
.wiki-header .nav-links { margin-left: auto; display: flex; gap: 1.5rem; }
.wiki-header .nav-links a { color: var(--text-dim); font-size: 0.95rem; padding: 0.3rem 0.6rem; border-radius: 4px; transition: 0.2s; }
.wiki-header .nav-links a:hover,
.wiki-header .nav-links a.active { color: var(--text); background: rgba(255,255,255,0.06); text-decoration: none; }
.wiki-header .theme-toggle {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.3rem 0.6rem; cursor: pointer; font-size: 1.2rem; line-height: 1;
  transition: 0.2s; box-shadow: var(--shadow-toggle); color: var(--text); flex-shrink: 0;
}
.wiki-header .theme-toggle:hover { background: rgba(255,255,255,0.08); border-color: var(--accent); }
@media (max-width: 760px) {
  .wiki-header { flex-wrap: wrap; }
  .wiki-header .nav-links { margin-left: 0; width: 100%; justify-content: flex-start; gap: 0.8rem; flex-wrap: wrap; }
}

.page-wrap { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }

/* 全局：确保 hidden 属性始终生效（.modal-mask / .cat-tab / #demoRoot 均依赖 hidden 控制显隐） */
[hidden] { display: none !important; }

/* ==================================================================
   Vault 主题覆盖（仅作用于 /vault/ 页面，不改动全站 theme.css）
   白天（light-mode）：参考风格 "Field Notes" 的暖米色 + 琥珀橙
   夜晚（dark-mode）：与 wiki 同款 —— 直接沿用 css/theme.css 的
                      「夜空蓝黑 + 星芒金」暗色调色板（值一一对应）
   ================================================================== */
.light-mode {
  --bg-page: #f5f0e7;
  --bg-card: #fffdf8;
  --bg-table-alt: #faf4e8;
  --bg-table-header: #f0e6d2;
  --bg-hover: #f3e8d8;
  --bg-notice: #fdf6e8;
  --bg-block-icon: #f0e6d2;
  --border: #ddd0bb;
  --accent: #bd641d;
  --accent-dim: #9a4f10;
  --text: #28342d;
  --text-dim: #6d786f;
  --link: #2f6b4e;
  --link-hover: #24573f;
  --header-bg: linear-gradient(135deg, #efe6d6, #e8dcc6);
  --shadow-header: 0 2px 12px rgba(90, 70, 40, 0.14);
  --shadow-toggle: 0 2px 8px rgba(90, 70, 40, 0.12);
  --category-grass: #3a7d4f;
  --category-stone: #6d786f;
  --category-air: #3a7d6f;
  --category-water: #2f6b8a;
  --prop-item-bg: rgba(40, 52, 45, 0.04);
  /* Vault 衍生变量（按钮/辉光等按主题变化） */
  --btn-text: #fffdf8;
  --accent-soft: rgba(189, 100, 29, 0.12);
  --accent-glow: rgba(189, 100, 29, 0.10);
  --accent-glow-strong: rgba(189, 100, 29, 0.16);
}
.dark-mode {
  --bg-page: #070714;
  --bg-card: #0f0f2a;
  --bg-table-alt: #14143a;
  --bg-table-header: #1a1a48;
  --bg-hover: #222255;
  --bg-notice: #0f0f2a;
  --bg-block-icon: #0f0f2a;
  --border: #2a2a5a;
  --accent: #f5c542;
  --accent-dim: #c4941a;
  --text: #e0e0f0;
  --text-dim: #8888aa;
  --link: #6a9ef0;
  --link-hover: #8ab4ff;
  --header-bg: linear-gradient(135deg, #0a0a22, #12123a);
  --shadow-header: 0 2px 12px rgba(0, 0, 0, 0.7);
  --shadow-toggle: 0 2px 8px rgba(0, 0, 0, 0.6);
  --category-grass: #6ab84a;
  --category-stone: #8888aa;
  --category-air: #6aaef0;
  --category-water: #4a9ef0;
  --prop-item-bg: rgba(255, 255, 255, 0.04);
  /* Vault 衍生变量（跟随同一套星芒金） */
  --btn-text: #070714;
  --accent-soft: rgba(245, 197, 66, 0.12);
  --accent-glow: rgba(245, 197, 66, 0.10);
  --accent-glow-strong: rgba(245, 197, 66, 0.16);
}

/* ==================================================================
   1. 极简 Hero — 仅标题 + 金色装饰线
   ================================================================== */
.vault-hero {
  text-align: center;
  padding: 3.2rem 1rem 2.6rem;
}
.vault-hero h1 {
  font-size: 3rem; font-weight: 800;
  color: var(--accent); letter-spacing: 0.4em; text-indent: 0.4em;
}
.hero-line {
  display: block; width: 84px; height: 4px; margin: 1.1rem auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-dim));
}

/* ==================================================================
   2. 分类栏 — Minecraft wiki 板块标签 + bilibili 式展开全部
   ================================================================== */
.filter-bar {
  --indicator-left: 0px;
  --indicator-width: 0px;
  --indicator-opacity: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
  padding: 0.35rem;
  background: var(--bg-table-alt);
  border: 1px dashed var(--border); border-radius: 999px;
  position: sticky; top: 78px; z-index: 40;
  margin-bottom: 1.4rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.filter-bar::before {
  content: ''; position: absolute; z-index: 0;
  left: var(--indicator-left); top: 0.35rem;
  width: var(--indicator-width); height: 44px;
  opacity: var(--indicator-opacity);
  border-radius: 999px; background: var(--bg-card);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.14), inset 0 -3px 0 var(--accent);
  transition: left 0.42s cubic-bezier(.22, 1, .36, 1), width 0.42s cubic-bezier(.22, 1, .36, 1), opacity 0.2s;
}
.cat-tab {
  display: inline-flex; align-items: center; gap: 0.5rem;
  height: 44px; padding: 0 0.9rem;
  border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text-dim);
  font-family: inherit; font-size: 14px; cursor: pointer;
  position: relative; z-index: 1; transition: color 0.22s, transform 0.2s;
}
.cat-tab:hover { color: var(--text); transform: translateY(-1px); }
.cat-tab .cat-glyph { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.cat-tab .cat-glyph svg { width: 20px; height: 20px; display: block; }
/* 分类名居中：左侧是 glyph，右侧补一块等宽（20px + 同一 gap）的占位，文字正好落在选项卡中心 */
.cat-tab .cat-name { flex: 0 0 auto; }
.cat-tab::after { content: ''; flex: 0 0 20px; width: 20px; height: 20px; }
.cat-tab.active {
  color: var(--accent); font-weight: 700;
}
.cat-expand {
  display: inline-flex; align-items: center; gap: 0.45rem;
  height: 44px; padding: 0 0.9rem;
  border: 1px dashed var(--border); border-radius: 999px;
  background: transparent; color: var(--text-dim);
  font-family: inherit; font-size: 13px; cursor: pointer; position: relative; z-index: 1; transition: 0.16s;
}
.cat-expand:hover { color: var(--accent); border-color: var(--accent); }
.expand-arrow { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.expand-arrow.down { border-top: 6px solid currentColor; }
.expand-arrow.up { border-bottom: 6px solid currentColor; }
@media (max-width: 680px) {
  .filter-bar { border-radius: 18px; gap: 0.15rem; }
  .filter-bar::before { display: none; }
  .cat-tab, .cat-expand { height: 40px; padding: 0 0.7rem; }
  .cat-tab.active { background: var(--accent-soft); }
}

/* ==================================================================
   3. 卡片网格 — 固定尺寸 380×250，严格对齐
   ================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 380px));
  gap: 1.2rem; justify-content: center;
  align-items: start;               /* 卡片按内容自然高度，顶部对齐，便于向下展开 */
  margin-bottom: 2.5rem;
}
@media (max-width: 1240px) { .grid { grid-template-columns: repeat(2, minmax(0, 380px)); } }
@media (max-width: 840px)  { .grid { grid-template-columns: minmax(0, 380px); } }

.card {
  width: 100%; max-width: 380px; height: auto; min-height: 250px;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px var(--accent-glow, rgba(245,197,66,0.08)); }
.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 6px 18px var(--accent-glow-strong, rgba(245,197,66,0.14));
}

.card-preview {
  position: relative; flex: 0 0 112px;
  background: linear-gradient(135deg, #12123a, #0a0a22);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-preview.pv-palette { display: flex; gap: 0; align-items: stretch; }
.card-preview.pv-palette .pv-swatch { flex: 1; }
.card-preview.pv-wave { display: flex; align-items: center; justify-content: center; gap: 3px; }
.card-preview.pv-wave i { width: 4px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), #6a9ef0); }
.card-preview.pv-wave .pv-play {
  width: 0; height: 0; margin-right: 14px;
  border-top: 9px solid transparent; border-bottom: 9px solid transparent;
  border-left: 14px solid var(--accent);
}
.card-preview.pv-empty { background: #14143a; }
.card-preview.pv-empty::after { content: ''; width: 28px; height: 28px; border: 2px solid #2a2a5a; border-radius: 50%; }

.card-head { padding: 10px 14px 0; }
.card-head h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 5px; }
.chip {
  font-size: 10px; color: var(--text-dim);
  padding: 1px 10px; border-radius: 999px;
  background: var(--bg-table-header); border: 1px solid var(--border);
}
.card-brief {
  padding: 8px 14px 0; font-size: 12px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 弱化按钮（与背景相近色）与主色按钮 */
.btn-soft {
  height: 32px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-table-header); color: var(--text-dim);
  font-family: inherit; font-size: 12px; cursor: pointer; transition: 0.15s;
}
.btn-soft:hover { color: var(--text); border-color: var(--accent-dim); }
.btn-primary {
  height: 32px; padding: 0 16px;
  border: none; border-radius: 6px;
  background: var(--accent); color: var(--btn-text, #070714);
  font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: 0.15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary.chosen { background: var(--category-grass); color: var(--btn-text); }

/* 卡片按钮行：左"展开"（向下展开内容）右"查看"（打开详情页面） */
.card-actions {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 14px;
}

/* ----------------------------------------------------------------
   向下展开区：点击"展开"按钮后，内容在原卡片下方一行一行展开
   采用 grid 0fr→1fr 过渡，收起/展开平滑；展开按钮变为"收起"
   ---------------------------------------------------------------- */
.card-fold {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.34s ease;
  border-top: 1px solid var(--border);
  background: var(--bg-table-alt);
}
.card-fold > .fold-inner { overflow: hidden; min-height: 0; }
.card.folded .card-fold { grid-template-rows: 1fr; }
.fold-body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.fold-code {
  border: 1px solid #2a2a5a; border-radius: 8px; overflow: hidden;
  background: #0a0a20;
}
.fold-code .codeview { max-height: 300px; font-size: 11px; line-height: 1.65; }
.fold-note {
  font-size: 11px; color: var(--text-dim);
  background: var(--bg-notice); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.5rem 0.7rem;
}
.fold-actions { display: flex; align-items: center; gap: 0.6rem; }
.fold-actions .copy-btn { margin-left: 0; height: 32px; font-size: 12px; }

/* 展开按钮上的小箭头，随状态翻转 */
.fold-arrow {
  width: 0; height: 0; display: inline-block; transition: transform 0.2s;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; margin-left: 4px; vertical-align: middle;
}
.card.folded .fold-arrow { transform: rotate(180deg); }

/* 行内内容：图标列表 / 色块（复用弹层组件，缩小到行列式） */
.fold-inline { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fold-inline .copy-item { width: 40px; height: 40px; }
.fold-inline .copy-item svg { width: 24px; height: 24px; }
.fold-inline .swatch { width: 72px; height: 44px; }
.fold-sw { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fold-sw .swatch { width: 72px; height: 44px; }
.fold-sw .swatch span { font-size: 9px; }

.grid-empty {
  grid-column: 1 / -1; text-align: center;
  padding: 3rem 1rem; color: var(--text-dim); font-size: 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
}

/* 无限滚动分批加载：网格底部哨兵（进入视口触发加载下一批） */
.grid-sentinel {
  grid-column: 1 / -1;
  height: 1px;                  /* 只占一行极矮高度，不可见 */
  visibility: hidden;
}

/* ==================================================================
   4. 右侧预览栏 — 常驻显示（fixed，不占文档流，滚动不跳页）；
      可收起为小把手随时打开
   ================================================================== */
.preview-panel {
  position: fixed; right: 16px; top: 150px; width: 300px; z-index: 150;
  /* 起始位置放在吸顶分类栏（78+44px）下方，且高度不超过视口，展开时不会被切掉 */
  max-height: calc(100vh - 166px);
  display: flex; flex-direction: column; gap: 0.8rem; align-items: stretch;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.9rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.preview-panel .pv-body { min-height: 0; }
.preview-panel .pv-preview { width: 100%; height: 132px; flex: 0 1 auto; min-height: 72px; cursor: move; }
.preview-panel .pv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.preview-panel .pv-info h3 { font-size: 16px; color: var(--text); }
.preview-panel .pv-info p { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-panel .pv-open { margin: 0.5rem 0 0 auto; }
.preview-panel .pv-actions {
  margin-top: 0.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.pv-collapse {
  position: absolute; top: -13px; right: -13px;
  width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-card); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.pv-collapse::before, .pv-collapse::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 12px; height: 2px; border-radius: 1px; background: var(--text-dim);
}
.pv-collapse::before { transform: translate(-50%, -50%) rotate(45deg); }
.pv-collapse::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.pv-collapse:hover { border-color: var(--accent); }

/* 收起形态：只剩小把手 */
/* 收起形态：圆形小钮（可点击展开、可整体拖动）。 */
.preview-panel.collapsed {
  width: 52px; height: 52px; padding: 0; border-radius: 50%;
  align-items: center; justify-content: center; cursor: move;
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.15s, transform 0.15s;
}
.preview-panel.collapsed:hover { box-shadow: 0 0 0 2px var(--accent-dim, rgba(245,197,66,.4)), 0 8px 22px rgba(0,0,0,.35); }
.preview-panel.collapsed .pv-body,
.preview-panel.collapsed .pv-collapse,
#pvHandle { display: none; }   /* 旧把手按钮已由面板整体交互替代，隐藏避免空占位 */

/* 收起钮中央的提示：左侧小三角指向内容（表示点击展开）。 */
.preview-panel.collapsed::before {
  content: ''; display: block;
  border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  border-right: 11px solid var(--accent);
  margin-left: -2px;                  /* 视觉略偏左引出内容方向 */
}
/* 点亮的反馈点亮圆钮，示意可交互。 */
.preview-panel.collapsed::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px dashed var(--accent-dim, transparent); opacity: .7; pointer-events: none;
}
.preview-panel.collapsed:hover::after { opacity: 1; }

/* ==================================================================
   5. 换肤演示区
   ================================================================== */
#demoRoot { margin-bottom: 2.5rem; }
.demo-title { font-size: 0.9rem; color: var(--accent); font-weight: 700; margin-bottom: 0.6rem; }
.demo-card {
  width: min(300px, 100%); padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--sk-card, #0f0f2a);
  border: 1px solid var(--sk-border, #2a2a5a); border-radius: 12px;
}
.demo-line { height: 8px; border-radius: 4px; background: var(--sk-dim, #8888aa); opacity: 0.5; }
.demo-line-strong { width: 60%; background: var(--sk-accent, #f5c542); opacity: 1; }
.demo-line-short { width: 40%; }
.demo-btn {
  align-self: flex-start; border: none; border-radius: 6px;
  padding: 8px 18px; font-size: 12px; font-weight: 700;
  background: var(--sk-accent, #f5c542); color: #070714; cursor: pointer;
}

/* ==================================================================
   5. 详情弹层
   ================================================================== */
body.no-scroll { overflow: hidden; }
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.modal {
  width: 780px; max-width: 100%; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
  border-top: 4px solid var(--accent);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.2rem 0.8rem;
}
.modal-head h3 { font-size: 20px; font-weight: 700; color: var(--text); }
.modal-close {
  flex-shrink: 0; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-page); cursor: pointer; position: relative;
}
.modal-close::before, .modal-close::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 14px; height: 2px; border-radius: 1px; background: var(--text-dim);
}
.modal-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.modal-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.modal-close:hover { border-color: var(--accent); }

.modal-cols {
  display: grid; grid-template-columns: 300px 1fr; gap: 1rem;
  padding: 0 1.2rem; min-height: 0;
}
@media (max-width: 680px) { .modal-cols { grid-template-columns: 1fr; } }

.modal-preview {
  height: clamp(160px, 42vh, 330px); border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #12123a, #0a0a22);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.modal-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-preview.pv-inline {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; align-items: stretch; justify-content: flex-start;
}
.modal-preview.pv-skin { padding: 18px; }

.modal-code { min-width: 0; display: flex; flex-direction: column; }
.codebox {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  border: 1px solid #2a2a5a; border-radius: 8px; overflow: hidden;
  background: #0a0a20;
}
.code-tabs { display: flex; gap: 0.2rem; padding: 0.5rem 0.6rem; background: #12123a; border-bottom: 1px solid #2a2a5a; }
.code-tab {
  border: none; background: transparent; color: var(--text-dim);
  font-family: inherit; font-size: 12px; padding: 3px 10px;
  border-radius: 4px; cursor: pointer; position: relative;
}
.code-tab.active { color: var(--accent); font-weight: 600; }
.code-tab.active::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: -6px;
  height: 2px; border-radius: 1px; background: var(--accent);
}
.codeview {
  flex: 1; overflow: auto; padding: 0.7rem 0.8rem;
  font-family: Consolas, 'Courier New', monospace; font-size: 11.5px; line-height: 1.7;
  color: #c8c8e8; white-space: pre;
}
.codeview .cl { display: block; }
.codeview .ln { display: inline-block; min-width: 2.6em; text-align: right; padding-right: 0.8em; color: #5a5a8a; user-select: none; }
.tk-s { color: #8ab4ff; }  /* 选择器/标签 —— 星云蓝 */
.tk-p { color: #f5c542; }  /* 属性 —— 星芒金 */
.tk-v { color: #6ab84a; }  /* 值 —— 草绿 */
.tk-c { color: #5a5a8a; font-style: italic; }  /* 注释 */

.copy-list { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: center; }
.copy-item {
  width: 52px; height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-page); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: 0.15s;
}
.copy-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.copy-item svg { width: 30px; height: 30px; }

.pv-palette-big { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; padding: 14px; }
.swatch {
  width: 86px; height: 62px; border: none; border-radius: 8px; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  transition: 0.15s;
}
.swatch:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.swatch span {
  font-family: Consolas, monospace; font-size: 10px;
  background: rgba(0,0,0,.45); color: #fff; padding: 1px 6px; border-radius: 4px;
}

.pv-audio { flex-direction: column; gap: 1rem; }
.audio-play {
  width: 72px; height: 72px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--accent-soft, rgba(245,197,66,0.1));
  cursor: pointer; position: relative; transition: 0.15s;
}
.audio-play:hover { background: var(--accent-soft, rgba(245,197,66,0.2)); }
.audio-play::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  border-left: 18px solid var(--accent);
  border-top: 11px solid transparent; border-bottom: 11px solid transparent;
  transform: translate(-42%, -50%);
}
.audio-play.playing::before { border: none; }
.audio-play.playing::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px; transform: translate(-50%, -50%);
  border-left: 5px solid var(--accent); border-right: 5px solid var(--accent);
}
.pv-audio p { font-size: 12px; color: var(--text-dim); text-align: center; padding: 0 1rem; }

.modal-foot {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 1rem 1.2rem; margin-top: 1rem;
  border-top: 1px solid var(--border);
}
.m-cat { font-size: 12px; color: var(--text-dim); }
.m-license { font-size: 12px; color: var(--text-dim); }
.source-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.copy-btn {
  margin-left: auto;
  height: 36px; padding: 0 1.1rem;
  border: none; border-radius: 6px;
  background: var(--accent); color: #070714;
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: 0.15s;
}
.copy-btn:hover { filter: brightness(1.08); }
.copy-btn.copied { background: var(--category-grass); color: var(--btn-text); }
.btn-ghost {
  height: 36px; padding: 0 1.1rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text-dim);
  font-family: inherit; font-size: 13px; cursor: pointer; transition: 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-skin {
  height: 36px; padding: 0 1.1rem;
  border: 1px solid var(--accent); border-radius: 6px;
  background: transparent; color: var(--accent);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.15s;
}
.btn-skin:hover { background: var(--accent-soft, rgba(245,197,66,0.12)); }

/* ==================================================================
   6. 页脚
   ================================================================== */
.footer { text-align: center; padding: 2rem 1.5rem; border-top: 1px solid var(--border); margin-top: 2rem; font-size: 0.8rem; color: var(--text-dim); }
.footer a { color: var(--link); }

::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ==================================================================
   7. 屏幕比例适配 — 超宽 / 笔记本 / 平板 / 手机竖屏 / 手机横屏
   实测档位：2560·1920·1600·1440·1366·1280·1180·1024·834·768·
             640·540·430·414·390·375·360·320（宽）× 常见高度
   ================================================================== */

/* 平板横屏及以下：头部改为随页滚动，否则两行头部会压住吸顶的分类栏 */
@media (max-width: 760px) {
  .wiki-header { position: static; }
  .wiki-header .logo { flex: 1; }
  .wiki-header .theme-toggle { order: 2; }            /* 主题按钮跟在 logo 同行，省一行高度 */
  .wiki-header .nav-links { order: 3; }
  .filter-bar { top: 8px; }
}

/* 手机：右侧预览栏改为贴底卡片，避免 300px 固定宽度遮住大半屏 */
@media (max-width: 640px) {
  .preview-panel {
    left: 12px; right: 12px; top: auto; bottom: 12px; width: auto;
    max-height: 70vh;
  }
  .preview-panel.collapsed { left: auto; right: 12px; bottom: 12px; width: 46px; height: 46px; }
  .preview-panel .pv-collapse { top: -13px; right: 4px; }   /* 贴底卡片：收起钮收回屏内，别被裁掉 */
  .modal { width: 100%; overflow-y: auto; }
  .modal-head h3 { font-size: 17px; }
  .modal-preview { height: clamp(150px, 32vh, 280px); }
  .filter-bar { border-radius: 18px; }
}

/* 小屏手机：收紧留白，标题与卡片跟随视口缩放（原来固定 380px 会横向溢出） */
@media (max-width: 480px) {
  .page-wrap { padding: 0 1rem; }
  /* 手机上的头部压成两行以内：去掉副标题、缩小 logo 与导航字号 */
  .wiki-header { padding: 0.8rem 1rem; gap: 0.5rem; }
  .wiki-header .logo { font-size: 1.25rem; }
  .wiki-header .logo small { display: none; }
  .wiki-header .nav-links { gap: 0.35rem 0.6rem; }
  .wiki-header .nav-links a { font-size: 0.85rem; padding: 0.22rem 0.45rem; }
  .vault-hero { padding: 2rem 0.5rem 1.6rem; }
  .vault-hero h1 { font-size: clamp(1.9rem, 9vw, 3rem); letter-spacing: 0.3em; text-indent: 0.3em; }
  .hero-line { margin-top: 0.8rem; }
  .card { min-height: 0; }
  .card-preview { flex-basis: 96px; }
  /* 分类标签压窄：glyph 与右侧等宽占位同步缩到 16px，文字仍在选项卡正中 */
  .cat-tab { gap: 0.3rem; padding: 0 0.6rem; font-size: 13px; }
  .cat-tab .cat-glyph, .cat-tab .cat-glyph svg { width: 16px; height: 16px; }
  .cat-tab::after { flex: 0 0 16px; width: 16px; height: 16px; }
  .cat-expand { padding: 0 0.6rem; font-size: 12px; }
  .modal-mask { padding: 0.6rem; }
  .footer { padding: 1.5rem 1rem; }
}

/* 矮屏（手机横屏 / 小笔记本）：压缩弹层预览高度，让代码区仍有空间 */
@media (max-height: 560px) {
  .modal-preview { height: clamp(120px, 30vh, 190px); }
  .modal-head { padding: 0.7rem 0.9rem 0.5rem; }
  .vault-hero { padding: 1.6rem 1rem 1.2rem; }
}

/* 超宽屏（21:9 等）：容器放宽到 4 列（卡片仍是 380 固定宽），否则两侧留白过多 */
@media (min-width: 1800px) {
  .page-wrap { max-width: 1620px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 380px)); gap: 1.5rem; }
}
