/* ============================================================
   PromptVault · 个人提示词库
   ============================================================ */

/* ---------------------------- Tokens ---------------------------- */
:root {
  --bg: #f5f6fa;
  --bg-soft: #eceef5;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f2f4f9;
  --border: #e5e8f0;
  --border-2: #d7dbe7;
  --text: #14171f;
  --text-2: #4e5566;
  --text-3: #878fa3;
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(91, 91, 214, .09);
  --ok: #16a34a;
  --ring: rgba(91, 91, 214, .35);
  --sh-1: 0 1px 2px rgba(18, 22, 45, .04), 0 3px 10px rgba(18, 22, 45, .045);
  --sh-2: 0 2px 6px rgba(18, 22, 45, .05), 0 14px 34px rgba(18, 22, 45, .10);
  --sh-3: 0 24px 70px rgba(18, 22, 45, .16);
  --r: 14px;
  --r-sm: 9px;
  --hdr-h: 62px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="dark"] {
  --bg: #0c0e13;
  --bg-soft: #12151c;
  --surface: #14181f;
  --surface-2: #181d26;
  --surface-3: #1d2330;
  --border: #232936;
  --border-2: #2f3745;
  --text: #e7eaf2;
  --text-2: #a5adbe;
  --text-3: #6e7688;
  --accent: #8b8bf5;
  --accent-2: #a78bfa;
  --accent-soft: rgba(139, 139, 245, .14);
  --ring: rgba(139, 139, 245, .4);
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 2px 8px rgba(0, 0, 0, .35), 0 14px 34px rgba(0, 0, 0, .42);
  --sh-3: 0 24px 70px rgba(0, 0, 0, .6);
}

/* ---------------------------- Reset ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--hdr-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding-left: 1.25em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }

/* 背景光晕 */
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(620px 340px at 12% -6%, rgba(91, 91, 214, .10), transparent 70%),
    radial-gradient(520px 300px at 88% 2%, rgba(236, 72, 153, .07), transparent 70%);
}
[data-theme="dark"] .bg-glow {
  background:
    radial-gradient(620px 340px at 12% -6%, rgba(99, 102, 241, .16), transparent 70%),
    radial-gradient(520px 300px at 88% 2%, rgba(168, 85, 247, .12), transparent 70%);
}

/* ---------------------------- Header ---------------------------- */
.hdr {
  position: sticky; top: 0; z-index: 60;
  height: var(--hdr-h);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.hdr-in {
  max-width: 1420px; height: 100%; margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; gap: 16px;
}
.hdr-left { display: flex; align-items: center; gap: 10px; flex: none; }
.hdr-set { display: flex; align-items: center; gap: 6px; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: 4px; flex: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 3px 10px rgba(91, 91, 214, .32);
}
.brand-mark .ic { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.brand-txt { font-size: 15px; font-weight: 650; letter-spacing: -.2px; line-height: 1.15; display: flex; flex-direction: column; }
.brand-txt b { font-weight: 650; }
.brand-txt em {
  font-style: normal; font-size: 10.5px; font-weight: 500; color: var(--text-3);
  letter-spacing: .8px; margin-top: 1px;
}

.search {
  position: relative; flex: 1; max-width: 200px; display: flex; align-items: center;
  background: var(--surface-3); border: 1px solid transparent; border-radius: 8px;
  padding: 0 7px; height: 32px; transition: border-color .18s, background .18s, box-shadow .18s, max-width .2s var(--ease);
}
.search:focus-within {
  background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
  max-width: 280px;
}
.search-ic { width: 14px; height: 14px; color: var(--text-3); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: none; background: none; outline: none;
  padding: 0 6px; font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.kbd-hint {
  font-family: inherit; font-size: 10px; color: var(--text-3);
  border: 1px solid var(--border-2); border-radius: 4px; padding: 1px 5px; line-height: 1.4;
  background: var(--surface);
}
.search:focus-within .kbd-hint { display: none; }
.search-clear { display: grid; place-items: center; color: var(--text-3); border-radius: 6px; padding: 2px; }
.search-clear:hover { color: var(--text); background: var(--bg-soft); }
.search-clear .ic { width: 13px; height: 13px; }

.hdr-act { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }

/* ============ 语言切换器 ============ */
.lang-pick { position: relative; }
.lang-btn {
  width: auto; height: 34px; padding: 0 10px; gap: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); border: 1px solid transparent; border-radius: 9px;
  background: transparent; cursor: pointer; transition: .16s var(--ease);
  font: 650 12px/1 -apple-system, BlinkMacSystemFont, system-ui;
}
.lang-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.lang-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.lang-btn .lang-flag { font-size: 14px; line-height: 1; }
.lang-btn .lang-code { letter-spacing: .04em; font-size: 11px; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  list-style: none; padding: 6px; margin: 0;
  background: var(--surface, var(--bg)); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 32px rgba(15, 17, 38, .12), 0 2px 6px rgba(15, 17, 38, .05);
  min-width: 168px; max-height: 360px; overflow-y: auto;
  z-index: 50;
}
.lang-menu[hidden] { display: none; }
.lang-menu li {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: var(--text-2); transition: .12s var(--ease);
  user-select: none;
}
.lang-menu li:hover { background: var(--surface-3); color: var(--text); }
.lang-menu li[aria-selected="true"] {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600;
}
.lang-menu li .fi { font-size: 16px; line-height: 1; }
.lang-menu li .nm { flex: 1; }
.lang-menu li .ck {
  width: 14px; height: 14px; opacity: 0; color: var(--accent);
}
.lang-menu li[aria-selected="true"] .ck { opacity: 1; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  color: var(--text-2); border: 1px solid transparent; transition: .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.chip-btn {
  height: 34px; padding: 0 11px; border-radius: 9px; display: flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 13px; border: 1px solid transparent; transition: .16s var(--ease);
}
.chip-btn .ic { width: 15px; height: 15px; }
.chip-btn:hover { background: var(--surface-3); color: var(--text); }
.chip-btn.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.chip-btn.on .ic { fill: var(--accent); stroke: var(--accent); }
.chip-btn b { font-weight: 650; font-variant-numeric: tabular-nums; }
.only-mobile { display: none; }

/* ---------------------------- Layout ---------------------------- */
.layout {
  position: relative; z-index: 1;
  max-width: 1420px; margin: 0 auto; padding: 0 22px;
  display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 28px;
  align-items: start;
}
.scrim { display: none; }

/* ---------------------------- Sidebar ---------------------------- */
.side {
  position: sticky; top: calc(var(--hdr-h) + 18px);
  max-height: calc(100vh - var(--hdr-h) - 36px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}
.side-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 11px; border-bottom: 1px solid var(--border);
}
.side-title { font-size: 11px; font-weight: 700; letter-spacing: 1.1px; color: var(--text-3); text-transform: uppercase; }
.side-reset { font-size: 12px; color: var(--text-3); padding: 2px 7px; border-radius: 6px; transition: .15s; }
.side-reset:hover { color: var(--accent); background: var(--accent-soft); }

.tree { overflow-y: auto; padding: 7px; flex: 1; scrollbar-width: thin; }
.tree::-webkit-scrollbar { width: 7px; }
.tree::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
.tree::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* 分隔线：提示词库 / Skills 两大区块 */
.tg-sep {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 8px 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; color: var(--text-3);
}
.tg-sep::before, .tg-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border-2);
}

.tg { margin-bottom: 2px; }
.tg-head {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--r-sm);
  color: var(--text-2); transition: .15s var(--ease); text-align: left;
}
.tg-head:hover { background: var(--surface-3); color: var(--text); }
.tg-head .ic-chev {
  width: 13px; height: 13px; color: var(--text-3); margin-left: auto;
  transition: transform .2s var(--ease), color .15s;
}
.tg.open .ic-chev { transform: rotate(90deg); }
.tg-icon {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--c);
}
.tg-icon .ic { width: 14px; height: 14px; }
.tg-name { font-size: 13.5px; font-weight: 550; }
.tg-n {
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
  background: var(--surface-3); border-radius: 20px; padding: 1px 7px; min-width: 26px; text-align: center;
}
.tg.active .tg-head { background: color-mix(in srgb, var(--c) 11%, transparent); color: var(--text); }
.tg.active .tg-name { font-weight: 650; color: var(--c); }
.tg.active .tg-n { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }

.tg-subs { display: none; padding: 2px 0 5px 0; }
.tg.open .tg-subs { display: block; }
.sub {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5.5px 8px 5.5px 14px; border-radius: 7px;
  font-size: 12.8px; color: var(--text-2); transition: .14s var(--ease); text-align: left;
}
.sub::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px;
  background: var(--border-2); transition: .14s var(--ease); flex: none;
}
.sub:hover { background: var(--surface-3); color: var(--text); }
.sub:hover::before { background: var(--c); }
.sub.on { color: var(--text); font-weight: 600; background: color-mix(in srgb, var(--c) 9%, transparent); }
.sub.on::before { background: var(--c); height: 15px; }
.sub-n { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.side-foot {
  padding: 10px 13px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11.5px; color: var(--text-3);
}
.side-foot a:hover { color: var(--accent); }
.side-foot b { color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------------------------- Hero ---------------------------- */
.main { min-width: 0; padding: 20px 0 60px; }
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; align-items: center;
  padding: 30px 32px; margin-bottom: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 7%, var(--surface)),
    var(--surface) 55%);
  border: 1px solid var(--border); border-radius: 20px;
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .3px; color: var(--accent);
  background: var(--accent-soft); border-radius: 20px; padding: 3.5px 11px 3.5px 8px; margin-bottom: 14px;
}
.hero-kicker i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.hero h1 {
  font-size: clamp(24px, 3.1vw, 34px); line-height: 1.28; font-weight: 700; letter-spacing: -.6px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin-top: 12px; font-size: 13.8px; color: var(--text-2); max-width: 52ch; }
.hero-stats { display: flex; gap: 26px; margin-top: 20px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 22px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--text-3); }

.hero-art { position: relative; height: 150px; }
.orb { position: absolute; border-radius: 50%; filter: blur(22px); opacity: .55; }
.orb1 { width: 110px; height: 110px; background: var(--accent); top: 6px; right: 34px; }
.orb2 { width: 82px; height: 82px; background: #ec4899; bottom: 4px; right: 6px; }
.orb3 { width: 66px; height: 66px; background: #06b6d4; top: 34px; left: 26px; }
.hero-card {
  position: absolute; inset: 22px 30px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border-2); border-radius: 12px;
  backdrop-filter: blur(6px); box-shadow: var(--sh-2);
  padding: 14px; display: flex; flex-direction: column; gap: 9px;
}
.hero-card .dot { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.hero-card .l1, .hero-card .l2, .hero-card .l3 { height: 7px; border-radius: 4px; background: var(--surface-3); }
.hero-card .l1 { width: 78%; }
.hero-card .l2 { width: 52%; }
.hero-card .l3 { width: 64%; }

/* 快速分类 */
.quickbar { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; position: relative; }
.quickbar::-webkit-scrollbar { display: none; }
.qb-more {
  flex: none; display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: .16s var(--ease);
  position: sticky; right: 0; box-shadow: -8px 0 14px var(--bg);
  z-index: 2;
}
.qb-more:hover { border-color: var(--border-2); color: var(--text); }
.qb-more .ic { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.quickbar.expanded { flex-wrap: wrap; overflow-x: visible; }
.qb-more.expanded .ic { transform: rotate(180deg); }
.qchip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 20px;
  font-size: 12.8px; font-weight: 550; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); transition: .16s var(--ease);
}
.qchip .ic { width: 14px; height: 14px; color: var(--c); }
.qchip:hover { border-color: var(--c); color: var(--text); transform: translateY(-1px); }
.qchip.on {
  background: var(--c); border-color: var(--c); color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 30%, transparent);
}
.qchip.on .ic { color: #fff; }

/* ---------------------------- Toolbar ---------------------------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 2px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.tool-l { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.res-title { font-size: 16px; font-weight: 650; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.sel { position: relative; display: flex; align-items: center; }
.sel .ic { position: absolute; left: 9px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.sel select {
  appearance: none; height: 32px; padding: 0 30px 0 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.8px; color: var(--text-2); cursor: pointer; transition: .15s;
}
.sel select:hover { border-color: var(--border-2); color: var(--text); }
.sel::after {
  content: ''; position: absolute; right: 11px; pointer-events: none;
  width: 6px; height: 6px; border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3);
  transform: translateY(-2px) rotate(45deg);
}

/* ---------------------------- Cards ---------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 14px; }

.card {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  padding: 16px 16px 13px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; text-align: left;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2.5px;
  background: var(--c); opacity: 0; transition: opacity .2s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--c) 40%, var(--border)); }
.card:hover::before { opacity: 1; }
.card:active { transform: translateY(-1px); }

.card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 11.5px; font-weight: 600; color: var(--c);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  border-radius: 6px; padding: 2.5px 8px;
}
.cat-chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.sub-txt { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-top .star {
  margin-left: auto; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; flex: none;
}
.star { color: var(--text-3); transition: .15s var(--ease); }
.star .ic { width: 15px; height: 15px; }
.star:hover { background: var(--surface-3); color: #f59e0b; }
.star.on { color: #f59e0b; }
.star.on .ic { fill: #f59e0b; stroke: #f59e0b; }

.card h3 {
  font-size: 14.8px; font-weight: 650; line-height: 1.45; letter-spacing: -.1px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card p {
  font-size: 12.8px; line-height: 1.62; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card mark { background: color-mix(in srgb, var(--accent) 20%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11px; color: var(--text-3); background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 20px; padding: 1.5px 8px; white-space: nowrap;
}

.card-bot {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto; padding-top: 11px; border-top: 1px dashed var(--border);
}
.meta { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.meta span { display: inline-flex; align-items: center; gap: 3px; }
.copy-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px; border-radius: 8px;
  font-size: 12px; font-weight: 550; color: var(--text-2);
  background: var(--surface-3); border: 1px solid var(--border); transition: .15s var(--ease);
}
.copy-btn .ic { width: 14px; height: 14px; }
.copy-btn:hover { color: #fff; background: var(--c); border-color: var(--c); }
.copy-btn.done { color: #fff; background: var(--ok); border-color: var(--ok); }

/* ---------------------------- Empty ---------------------------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 70px 20px; text-align: center; }
.empty .ic { width: 40px; height: 40px; color: var(--text-3); stroke-width: 1.3; }
.empty p { font-size: 15px; font-weight: 600; margin-top: 6px; }
.empty span { font-size: 13px; color: var(--text-3); }
.btn {
  height: 34px; padding: 0 15px; border-radius: 9px; font-size: 13px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 6px; transition: .16s var(--ease);
}
.btn-ghost { border: 1px solid var(--border); color: var(--text-2); background: var(--surface); margin-top: 8px; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------------------------- Detail ---------------------------- */
.dtl { animation: fade .28s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }

.dtl-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.back {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 9px;
  border-radius: 9px; font-size: 13px; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface); transition: .15s var(--ease);
}
.back .ic { width: 15px; height: 15px; }
.back:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.crumb { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.crumb b { color: var(--c, var(--accent)); font-weight: 600; }
.crumb .sep { color: var(--border-2); }

.dtl-head {
  padding: 22px 24px 20px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  position: relative; overflow: hidden;
}
.dtl-head::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 25%, transparent));
}
.dtl-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.35; margin-bottom: 8px; }
.dtl-sum { font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.dtl-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mchip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  color: var(--text-2); background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 7px; padding: 3px 9px;
}
.mchip b { color: var(--text); font-weight: 600; }
.mchip-src { text-decoration: none; transition: .15s; }
.mchip-src:hover { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.dtl-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn-p {
  height: 36px; padding: 0 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 62%, #000));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 32%, transparent); transition: .16s var(--ease);
  white-space: nowrap;
}
.btn-p:hover { transform: translateY(-1px); box-shadow: 0 6px 20px color-mix(in srgb, var(--c) 42%, transparent); }
.btn-p.done { background: var(--ok); box-shadow: 0 4px 14px rgba(22, 163, 74, .3); }
.btn-s {
  height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 7px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); transition: .16s var(--ease);
  white-space: nowrap;
}
.btn-s:hover { border-color: var(--border-2); color: var(--text); background: var(--surface-3); }
.btn-s.on { color: #f59e0b; border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .1); }
.btn-s.on .ic { fill: #f59e0b; stroke: #f59e0b; }

/* 变量填充 */
.vars {
  padding: 16px 18px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--c) 5%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 22%, var(--border));
  border-radius: var(--r);
}
.vars-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 12.5px; font-weight: 650; color: var(--text);
}
.vars-head .badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; color: #fff;
  background: var(--c); border-radius: 5px; padding: 1.5px 7px;
}
.vars-head .hint { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.vars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.vf { display: flex; flex-direction: column; gap: 4px; }
.vf label { font-size: 11.5px; color: var(--text-2); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vf input, .vf select {
  height: 34px; padding: 0 10px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface); outline: none; transition: .15s;
  color: var(--text); width: 100%;
}
.vf input:focus, .vf select:focus { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 14%, transparent); }
/* 选项型：用不同底色区分「选一个」和「自己填」 */
.vf select { background: color-mix(in srgb, var(--c) 7%, var(--surface)); border-style: dashed; cursor: pointer; }
.vf:has(select) label::before { content: '▾ '; color: var(--c); }

/* 正文 */
.dtl-body {
  padding: 24px 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
}
.dtl-body.dim .pv-var { opacity: .45; }
.md { font-size: 13.6px; line-height: 1.75; color: var(--text); }
.md > :first-child { margin-top: 0; }
.md h2, .md h3, .md h4 { line-height: 1.4; letter-spacing: -.1px; margin: 24px 0 10px; }
.md h2 { font-size: 16px; font-weight: 680; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 14.5px; font-weight: 650; }
.md h4 { font-size: 13.5px; font-weight: 650; color: var(--text-2); }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 1.35em; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--text-3); }
.md strong { font-weight: 650; }
.md code {
  font-size: 12.4px; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px;
}
.md pre {
  position: relative; margin: 12px 0; padding: 13px 14px; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.md pre code { font-size: 12.4px; line-height: 1.65; background: none; border: none; padding: 0; }
.md pre[data-lang]::after {
  content: attr(data-lang); position: absolute; top: 8px; right: 12px;
  font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3);
}
.md blockquote {
  margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--c, var(--accent));
  background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md hr { margin: 20px 0; border: none; border-top: 1px solid var(--border); }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-table { margin: 12px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.md table { width: 100%; border-collapse: collapse; font-size: 12.6px; }
.md th, .md td { padding: 7px 11px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.md th { background: var(--surface-3); font-weight: 650; white-space: nowrap; }
.md tbody tr:last-child td { border-bottom: none; }
.md tbody tr:hover { background: var(--surface-2); }

.pv-var {
  font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: .93em;
  color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c) 11%, transparent);
  border: 1px dashed color-mix(in srgb, var(--c) 40%, transparent);
  border-radius: 5px; padding: 0 4px; white-space: nowrap;
}
.pv-var.filled { border-style: solid; background: color-mix(in srgb, var(--ok) 12%, transparent);
  color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.md pre .pv-var { background: none; border-style: dotted; padding: 0 2px; }
.md pre .pv-var.filled { background: none; border-color: transparent; color: inherit; font-weight: 600; }

/* 选项型占位：正文里可点击循环切换 */
.pv-choice {
  cursor: pointer; user-select: none;
  border-style: solid; position: relative;
}
.pv-choice::after {
  content: ' ⇄'; font-size: .82em; opacity: .5;
}
.pv-choice:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.pv-choice.filled { border-style: solid; background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.md pre .pv-choice { border-style: solid; }

/* Skill tabs */
.skill-tabs { display: flex; gap: 4px; margin: 0 26px 16px; }
.skill-tab {
  padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; transition: .16s var(--ease);
}
.skill-tab:hover { border-color: color-mix(in srgb, var(--c) 40%, var(--border)); color: var(--text); }
.skill-tab.active { background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-color: var(--c); color: var(--c); }
.skill-content { padding: 0 26px; }
.skill-content-skill pre {
  margin: 0; padding: 18px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); overflow-x: auto; font-size: 12.5px; line-height: 1.65;
}
.skill-content-skill code { font-family: "SF Mono", ui-monospace, Menlo, monospace; color: var(--text); }

/* 相关推荐 */
.rel { margin-top: 28px; }
.rel h2 { font-size: 14px; font-weight: 650; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.rel h2::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.rel-item {
  padding: 11px 13px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; text-align: left; transition: .16s var(--ease);
}
.rel-item:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--sh-1); }
.rel-item .t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-item .s { font-size: 11.5px; color: var(--text-3); }

/* ---------------------------- Toast ---------------------------- */
.toasts {
  position: fixed; z-index: 200; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: var(--sh-3);
  animation: toastIn .26s var(--ease);
}
.toast .ic { width: 15px; height: 15px; color: #4ade80; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.toast.out { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------------------------- Footer ---------------------------- */
.foot { position: relative; z-index: 1; border-top: 1px solid var(--border); background: var(--surface); }
.foot-in {
  max-width: 1420px; margin: 0 auto; padding: 18px 22px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 12px; color: var(--text-3);
}
.foot code { font-size: 11.5px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.dot-sep { opacity: .5; }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .only-mobile { display: grid; }
  .qb-more { display: inline-flex; }
  /* 移动端 header 自适应：单行布局 + 向下滚动时收起，减少遮挡 */
  :root { --hdr-h: 54px; }
  .hdr { transition: transform .22s var(--ease); }
  .hdr.hide { transform: translateY(-100%); }
  .hdr-in { padding: 0 10px; gap: 8px; }
  .hdr-left { flex: none; }
  .brand-txt { display: none; }
  .icon-btn, .lang-btn { width: 30px; height: 30px; }
  .chip-btn { height: 30px; padding: 0 8px; }
  .chip-btn .ic { width: 14px; height: 14px; }
  .hdr-set { gap: 1px; }
  .hdr-act { gap: 2px; margin-left: auto; }
  .search { flex: 1; max-width: 90px; height: 30px; padding: 0 6px; }
  .search:focus-within { max-width: 220px; }
  .search-ic { width: 13px; height: 13px; }
  .search input { padding: 0 5px; font-size: 12.5px; }
  .side {
    position: fixed; z-index: 90; top: var(--hdr-h); left: 0; bottom: 0; width: 276px;
    max-height: none; border-radius: 0; border-left: none; border-top: none;
    transform: translateX(-102%); transition: transform .26s var(--ease);
  }
  .side.open { transform: none; box-shadow: var(--sh-3); }
  .scrim:not([hidden]) {
    display: block; position: fixed; inset: var(--hdr-h) 0 0; z-index: 80;
    background: rgba(10, 12, 20, .42); backdrop-filter: blur(2px);
  }
  .chip-btn-t { display: none; }
  .hero { padding: 26px 20px; border-radius: 0; border-left: none; border-right: none; margin-bottom: 0; }
  .hero-sub { max-width: 42ch; }
  .main { padding-top: 0; }
  .quickbar { padding: 14px 14px 12px; }
  .toolbar { padding: 2px 14px 14px; margin-bottom: 0; }
  .grid { grid-template-columns: 1fr; padding: 0 14px; gap: 12px; }
  .dtl-head, .dtl-body { padding: 18px 16px; border-radius: 0; border-left: none; border-right: none; overflow: visible; width: 100%; }
  .dtl-head h1 { font-size: 19px; }
  .foot-in { padding: 18px 14px; }
  .skill-tabs { margin: 0 16px 12px; }
  .skill-content { padding: 0 16px; }
}
@media (max-width: 560px) {
  .hdr-in { padding: 0 10px; gap: 7px; }
  .hdr-left { gap: 6px; }
  .hdr-set { gap: 1px; }
  .hdr-act { gap: 2px; }
  .search { max-width: 80px; padding: 0 5px; }
  .search-ic { width: 12px; height: 12px; }
  .search input { padding: 0 4px; font-size: 12px; }
  .hdr-set .lang-code { display: none; }
  .kbd-hint { display: none; }
  .hero-stats { gap: 18px; }
  .stat b { font-size: 19px; }
  .toolbar { flex-direction: column; align-items: flex-start; gap: 9px; }
  .toasts { bottom: 14px; width: calc(100% - 28px); }
  .toast { width: 100%; justify-content: center; }
  .dtl-act { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; width: 100%; }
  .dtl-act .btn-p { grid-column: span 3; display: flex; justify-content: center; padding: 0 8px; height: 36px; font-size: 12.5px; gap: 6px; min-width: 0; overflow: hidden; }
  .dtl-act .btn-s { grid-column: span 2; display: flex; justify-content: center; padding: 0 4px; height: 34px; font-size: 12px; gap: 4px; min-width: 0; overflow: hidden; }
  .dtl-act .btn-p span, .dtl-act .btn-s span { display: inline-block; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .dtl-act .btn-p .ic { width: 16px; height: 16px; }
  .dtl-act .btn-s .ic { width: 15px; height: 15px; }
}

@media (max-width: 400px) {
  .brand-txt { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .hdr, .side, .foot, .toasts, .dtl-act, .vars, .rel { display: none !important; }
  .layout { display: block; }
}
