/* ============================================================
   蜡笔传奇攻略 — own design system
   Dark-first "ink & ember" theme, light variant via [data-theme=light]
   ============================================================ */

:root {
  --bg: #0b0e13;
  --bg-soft: #10141c;
  --panel: #141a24;
  --panel-2: #1a2130;
  --line: #232b3a;
  --line-soft: #1c2330;
  --text: #e8ecf3;
  --text-2: #a7b1c1;
  --text-3: #6f7b8d;
  --gold: #e0a340;
  --gold-soft: #f2c777;
  --ember: #e2623c;
  --jade: #4fb08a;
  --violet: #8b7bd8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .85);
  --maxw: 1180px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg: #f6f4ef;
  --bg-soft: #fffdf9;
  --panel: #ffffff;
  --panel-2: #faf7f1;
  --line: #e3ddd0;
  --line-soft: #eee9dd;
  --text: #1e2126;
  --text-2: #5b6472;
  --text-3: #8b95a3;
  --gold: #a9761a;
  --gold-soft: #c08f2c;
  --ember: #c14a26;
  --jade: #2f8163;
  --violet: #5f4fb0;
  --shadow: 0 16px 34px -24px rgba(60, 45, 20, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(224, 163, 64, .10), transparent 62%),
    radial-gradient(900px 480px at 92% 0%, rgba(139, 123, 216, .09), transparent 60%);
  background-attachment: fixed;
}

a { color: var(--gold-soft); text-decoration: none; }
a:hover { color: var(--gold); }

img { max-width: 100%; height: auto; display: block; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.head-inner { display: flex; align-items: center; gap: 20px; height: 66px; }

.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold), #a9761a 70%);
  color: #1b1408; font-family: var(--serif); font-weight: 700; font-size: 19px;
  box-shadow: 0 6px 16px -8px rgba(224, 163, 64, .9);
}
.brand-text b { display: block; font-family: var(--serif); font-size: 17px; letter-spacing: .5px; line-height: 1.2; }
.brand-text span { display: block; font-size: 11.5px; color: var(--text-3); letter-spacing: 1.4px; text-transform: uppercase; }

.main-nav { display: flex; gap: 2px; margin-left: 6px; flex: 1; overflow: hidden; }
.main-nav a {
  color: var(--text-2); font-size: 14.5px; padding: 8px 11px; border-radius: 8px;
  white-space: nowrap; transition: .16s;
}
.main-nav a:hover { color: var(--text); background: var(--panel); }
.main-nav a.on { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }

.head-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text-2); display: grid; place-items: center;
  cursor: pointer; transition: .16s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold); }
.icon-btn svg { width: 18px; height: 18px; }

.nav-toggle { display: none; }

/* ---------- hero ---------- */
.hero { padding: 60px 0 34px; position: relative; }
.hero-inner { max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; letter-spacing: 2px;
  color: var(--gold); text-transform: uppercase; margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  padding: 5px 13px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 8%, transparent);
}
.hero h1 {
  font-family: var(--serif); font-size: clamp(30px, 5.2vw, 48px); line-height: 1.24;
  margin: 0 0 14px; letter-spacing: .5px;
}
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p.lead { color: var(--text-2); font-size: 17px; margin: 0 0 24px; max-width: 640px; }

.hero-search { display: flex; gap: 10px; max-width: 560px; }
.hero-search input {
  flex: 1; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 11px; padding: 13px 16px; font-size: 15px; font-family: inherit;
}
.hero-search input:focus { outline: none; border-color: var(--gold); }
.hero-search button {
  background: linear-gradient(145deg, var(--gold), #a9761a); color: #1b1408; border: none;
  border-radius: 11px; padding: 0 22px; font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.hero-search button:hover { filter: brightness(1.08); }

.stats { display: flex; flex-wrap: wrap; gap: 34px; margin-top: 30px; }
.stat b { display: block; font-family: var(--serif); font-size: 27px; color: var(--text); line-height: 1.2; }
.stat span { font-size: 12.5px; color: var(--text-3); letter-spacing: .6px; }

/* ---------- section ---------- */
.section { padding: 34px 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
.section-head h2 {
  font-family: var(--serif); font-size: 23px; margin: 0; letter-spacing: .5px;
  display: flex; align-items: center; gap: 10px;
}
.section-head h2::before {
  content: ""; width: 4px; height: 20px; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), var(--ember));
}
.section-head p { margin: 0; color: var(--text-3); font-size: 14px; }
.more-link { font-size: 14px; color: var(--text-2); white-space: nowrap; }
.more-link:hover { color: var(--gold); }

/* ---------- category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.cat-card {
  display: block; padding: 18px 18px 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); transition: .18s; position: relative; overflow: hidden;
}
.cat-card::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), transparent); opacity: .55;
}
.cat-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); box-shadow: var(--shadow); color: inherit; }
.cat-top { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.cat-ico {
  width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--gold);
}
.cat-ico svg { width: 20px; height: 20px; }
.cat-card h3 { font-family: var(--serif); font-size: 17px; margin: 0; letter-spacing: .4px; }
.cat-count { margin-left: auto; font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.cat-card p { margin: 0; color: var(--text-2); font-size: 13.6px; line-height: 1.7; }
.cat-tag { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--gold); }

/* ---------- article list ---------- */
.post-list { display: flex; flex-direction: column; }
.post-row {
  display: grid; grid-template-columns: 92px 1fr; gap: 18px; align-items: start;
  padding: 15px 0; border-bottom: 1px solid var(--line-soft);
}
.post-row:last-child { border-bottom: none; }
.post-date { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); padding-top: 3px; }
.post-date b { display: block; color: var(--text-2); font-weight: 500; }
.post-row h3 { margin: 0 0 5px; font-size: 17px; font-family: var(--serif); letter-spacing: .3px; line-height: 1.5; }
.post-row h3 a { color: var(--text); }
.post-row h3 a:hover { color: var(--gold); }
.post-row p { margin: 0; color: var(--text-2); font-size: 14.2px; line-height: 1.72; }
.post-tags { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px; color: var(--text-3);
  border: 1px solid var(--line); background: var(--panel-2);
}

/* ---------- layout w/ sidebar ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 34px; align-items: start; }
.side { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
.side-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px; }
.side-box h4 {
  font-family: var(--serif); font-size: 15px; margin: 0 0 11px; letter-spacing: .5px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-list a {
  display: block; padding: 6px 9px; border-radius: 8px; font-size: 14px; color: var(--text-2);
}
.side-list a:hover { background: var(--panel-2); color: var(--gold); }
.side-list .n { float: right; font-family: var(--mono); font-size: 12px; color: var(--text-3); }

/* ---------- article page ---------- */
.article-head { padding: 30px 0 20px; border-bottom: 1px solid var(--line-soft); margin-bottom: 26px; }
.crumb { font-size: 13px; color: var(--text-3); margin-bottom: 12px; }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--gold); }
.crumb span { margin: 0 7px; opacity: .5; }
.article-head h1 {
  font-family: var(--serif); font-size: clamp(25px, 3.6vw, 35px); margin: 0 0 12px;
  line-height: 1.35; letter-spacing: .4px;
}
.meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-3); }
.meta i { font-style: normal; color: var(--gold); }

.lead {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); padding: 15px 18px; margin: 0 0 26px;
  color: var(--text-2); font-size: 15.4px; line-height: 1.8;
}

.content { font-size: 16.2px; line-height: 1.95; color: var(--text); }
.content p { margin: 0 0 1.05em; }
.content h2 {
  font-family: var(--serif); font-size: 20px; margin: 1.9em 0 .75em; letter-spacing: .4px;
  padding-left: 12px; border-left: 3px solid var(--gold); line-height: 1.5;
}
.content h2:first-child { margin-top: 0; }
.content ul, .content ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.content li { margin-bottom: .5em; }
.content strong { color: var(--gold-soft); font-weight: 600; }
.content img { border-radius: var(--radius-sm); margin: 1.1em 0; border: 1px solid var(--line); }
.content figure { margin: 1.4em 0; }
.content figcaption { font-size: 13px; color: var(--text-3); text-align: center; margin-top: -8px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 1.4em 0; }
.shot-grid img { margin: 0; height: 132px; object-fit: cover; width: 100%; }
.shot-grid a { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.shot-grid a:hover img { transform: scale(1.05); transition: .25s; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.4px; min-width: 520px; }
table.data th, table.data td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data thead th {
  background: var(--panel-2); color: var(--gold-soft); font-weight: 600; font-size: 13.5px;
  letter-spacing: .4px; white-space: nowrap; position: sticky; top: 0;
}
table.data tbody tr:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.strong { color: var(--text); font-weight: 600; white-space: nowrap; }
table.data td img { width: 34px; height: 34px; object-fit: contain; margin: 0 auto; border-radius: 6px; }
table.data td.strong img { display: inline-block; vertical-align: -7px; margin: 0 9px 0 0; }
.skill-name { display: inline-block; }

/* ---------- toc ---------- */
.toc { position: sticky; top: 86px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: t; max-height: 58vh; overflow: auto; }
.toc li { counter-increment: t; }
.toc a {
  display: block; padding: 5px 10px 5px 24px; font-size: 13.6px; color: var(--text-3);
  border-left: 2px solid var(--line); position: relative; line-height: 1.6;
}
.toc a::before {
  content: counter(t); position: absolute; left: 8px; font-family: var(--mono);
  font-size: 11px; color: var(--text-3);
}
.toc a:hover, .toc a.on { color: var(--gold); border-left-color: var(--gold); }

/* ---------- tool pages ---------- */
.tool-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.tool-input {
  flex: 1; min-width: 220px; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 11px 15px; font-family: inherit; font-size: 14.5px;
}
.tool-input:focus { outline: none; border-color: var(--gold); }
.tool-count { font-size: 13px; color: var(--text-3); font-family: var(--mono); }

.attr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 13px; }
.attr-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; border-left: 3px solid var(--violet);
}
.attr-card h4 { margin: 0 0 7px; font-family: var(--serif); font-size: 16.5px; color: var(--text); }
.attr-card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.75; }

.tabs { display: flex; gap: 7px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 8px 17px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text-2); cursor: pointer; font-size: 14.5px; font-family: inherit;
}
.tab:hover { color: var(--gold); border-color: var(--gold); }
.tab.on { background: var(--gold); border-color: var(--gold); color: #1b1408; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.on { display: block; }

/* ---------- search ---------- */
.search-box { display: flex; gap: 10px; margin-bottom: 22px; }
.search-box input {
  flex: 1; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 11px; padding: 13px 17px; font-size: 15.5px; font-family: inherit;
}
.search-box input:focus { outline: none; border-color: var(--gold); }
.result {
  padding: 14px 0; border-bottom: 1px solid var(--line-soft);
}
.result h3 { margin: 0 0 4px; font-size: 16.5px; font-family: var(--serif); }
.result h3 a { color: var(--text); }
.result h3 a:hover { color: var(--gold); }
.result p { margin: 0; color: var(--text-2); font-size: 14px; }
.result .crumb-line { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
mark { background: color-mix(in srgb, var(--gold) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- notice / footer ---------- */
.notice {
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 15px 18px; color: var(--text-2); font-size: 14.2px; line-height: 1.8;
}
.notice strong { color: var(--gold-soft); }

.site-footer { border-top: 1px solid var(--line-soft); margin-top: 40px; padding: 36px 0 26px; background: var(--bg-soft); }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 34px; }
.foot-grid h4 { font-family: var(--serif); font-size: 15px; margin: 0 0 12px; }
.foot-grid p, .foot-grid a { color: var(--text-3); font-size: 13.6px; line-height: 1.9; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-size: 12.5px; color: var(--text-3);
}

/* ---------- misc ---------- */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 7px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text-2); font-size: 14px;
}
.pager a:hover { border-color: var(--gold); color: var(--gold); }
.pager .on { background: var(--gold); border-color: var(--gold); color: #1b1408; font-weight: 600; }

.to-top {
  position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; opacity: 0; pointer-events: none;
  transition: .2s; z-index: 50;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--gold); border-color: var(--gold); }

.breadcrumb-json { display: none; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .side, .toc { position: static; }
  .side { order: 2; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .main-nav {
    position: fixed; inset: 66px 0 auto 0; background: var(--panel); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: 12px 16px 18px; gap: 2px; transform: translateY(-120%);
    transition: .22s; max-height: calc(100vh - 66px); overflow: auto;
  }
  .main-nav.open { transform: translateY(0); }
  .main-nav a { padding: 11px 12px; font-size: 15.5px; }
  .nav-toggle { display: grid; }
  .hero { padding: 40px 0 24px; }
  .stats { gap: 22px; }
  .stat b { font-size: 22px; }
  .post-row { grid-template-columns: 1fr; gap: 4px; }
  .post-date { display: flex; gap: 8px; align-items: baseline; }
  .post-date b { display: inline; }
  .foot-grid { grid-template-columns: 1fr; gap: 22px; }
  .hero-search { flex-direction: column; }
  .hero-search button { padding: 12px; }
  .shot-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .shot-grid img { height: 104px; }
}

@media print {
  .site-header, .side, .toc, .to-top, .site-footer, .hero-search { display: none !important; }
  body { background: #fff; color: #000; }
}
