/* Tok小屋 · hour.css
   暖木屋配色:深棕木梁、琥珀灯光、奶油纸面 */

:root {
  --th-soot: #1d1511;
  --th-bark: #2a1f1a;
  --th-bark-2: #3a2b22;
  --th-char: #4b3a2e;
  --th-ember: #f0a43a;
  --th-ember-hi: #ffd08a;
  --th-ember-deep: #d9741f;
  --th-ember-ink: #9a560d;
  --th-cream: #f5ecdb;
  --th-paper: #fbf6ec;
  --th-milk: #fffaf2;
  --th-ink: #2e241e;
  --th-ink-2: #5d4b3e;
  --th-ink-3: #7c6858;
  --th-rule: #e6d6bc;
  --th-rule-2: #efe3cf;

  --th-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --th-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;

  --th-gutter: clamp(1rem, 5vw, 2rem);
  --th-measure: 40rem;
  --th-r-lg: 1.375rem;
  --th-r-md: .875rem;
  --th-r-sm: .5rem;
  --th-lift: 0 1.5rem 3rem -2rem rgba(42, 31, 26, .55);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body.th-body {
  margin: 0;
  font-family: var(--th-sans);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--th-ink);
  background-color: var(--th-cream);
  background-image:
    radial-gradient(90rem 40rem at 50% -10rem, rgba(240, 164, 58, .10), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .24 0 0 0 0 .14 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--th-ember-ink); text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: rgba(217, 116, 31, .55); }
a:hover { color: #7a3f05; text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--th-ember-deep); outline-offset: 3px; border-radius: 4px; }

.th-skip {
  position: absolute; left: .75rem; top: -3rem; z-index: 50;
  padding: .5rem 1rem; border-radius: var(--th-r-sm);
  background: var(--th-ember); color: var(--th-bark); font-weight: 700; text-decoration: none;
}
.th-skip:focus { top: .75rem; }

/* ───────── 屋檐(页头) ───────── */
.th-eaves {
  position: relative; z-index: 3;
  background: var(--th-soot);
  border-bottom: 1px solid rgba(240, 164, 58, .16);
}
.th-eaves-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 72rem; margin: 0 auto; padding: .85rem var(--th-gutter);
}
.th-mark {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--th-cream); text-decoration: none;
}
.th-mark:hover { color: #fff; }
.th-mark-g { flex: none; color: #e9dcc4; }
.th-mark-lamp { fill: var(--th-ember); filter: drop-shadow(0 0 3px rgba(240, 164, 58, .9)); }
.th-mark-w {
  font-family: var(--th-serif); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; line-height: 1;
}
.th-mark-w em { font-style: normal; color: var(--th-ember); margin-left: .08em; }
.th-mark-sm .th-mark-w { font-size: 1.125rem; }

.th-nav { display: flex; gap: clamp(.25rem, 2vw, 1.25rem); }
.th-nav a {
  position: relative;
  padding: .35rem .55rem; color: rgba(245, 236, 219, .78);
  font-size: .9375rem; text-decoration: none; letter-spacing: .06em;
}
.th-nav a:hover { color: var(--th-cream); }
.th-nav a[aria-current="page"],
[data-th-page="about"] .th-nav a[href="/about/"],
[data-th-page="contact"] .th-nav a[href="/contact/"] { color: var(--th-ember-hi); }
.th-nav a[aria-current="page"]::after,
[data-th-page="about"] .th-nav a[href="/about/"]::after,
[data-th-page="contact"] .th-nav a[href="/contact/"]::after {
  content: ""; position: absolute; left: 50%; bottom: -.1rem;
  width: .3rem; height: .3rem; margin-left: -.15rem; border-radius: 50%;
  background: var(--th-ember); box-shadow: 0 0 6px 1px rgba(240, 164, 58, .8);
}

/* ───────── 首页骨架:正文 + 炉火栏 ───────── */
.th-tale {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0;
  padding: 0 var(--th-gutter) 4rem;
}
.th-tale > * { grid-column: 1; min-width: 0; width: 100%; max-width: var(--th-measure); justify-self: center; }

/* 首屏暖光底板:伪元素铺满整行再向两侧延展 */
.th-tale::before {
  content: ""; grid-column: 1 / -1; grid-row: 1 / 3; justify-self: center; width: 100vw;
  z-index: 0;
  background:
    radial-gradient(40rem 28rem at 72% 60%, rgba(240, 164, 58, .2), transparent 70%),
    radial-gradient(34rem 24rem at 12% 0%, rgba(217, 116, 31, .12), transparent 70%),
    var(--th-bark);
  box-shadow: inset 0 -1px 0 rgba(240, 164, 58, .22), inset 0 -.6rem 1.2rem -.6rem rgba(0, 0, 0, .35);
}

.th-tale > [data-part="hero"] { grid-row: 1; position: relative; z-index: 1; padding: 2.4rem 0 1.6rem; color: var(--th-cream); }
.th-window { grid-row: 2; position: relative; z-index: 1; }
.th-rail { grid-row: 3; }

[data-part="kicker"] {
  display: inline-flex; align-items: center; gap: .55rem;
  margin: 0 0 1rem; color: var(--th-ember-hi);
  font-size: .875rem; letter-spacing: .14em; font-weight: 600;
}
[data-part="kicker"]::before {
  content: ""; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--th-ember); box-shadow: 0 0 0 4px rgba(240, 164, 58, .18), 0 0 12px 2px rgba(240, 164, 58, .7);
}
[data-part="hero"] h1 {
  margin: 0 0 1.1rem;
  font-family: var(--th-serif); font-weight: 700;
  font-size: clamp(1.7rem, 1.05rem + 2.4vw, 2.85rem); line-height: 1.3; letter-spacing: .01em;
  color: #fbf3e4; text-wrap: balance;
}
[data-part="dek"] { margin: 0 0 1.4rem; font-size: 1.0625rem; line-height: 1.85; color: rgba(245, 236, 219, .86); }
[data-part="meta"] {
  margin: 0; padding-top: .9rem;
  border-top: 1px solid rgba(240, 164, 58, .28);
  font-size: .875rem; line-height: 1.7; color: rgba(245, 236, 219, .7); letter-spacing: .03em;
}

/* 拱窗主视觉 + 窗台 */
.th-window { margin: 0 0 2.6rem; }
.th-window img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: 66% 50%;
  border-radius: 48% 48% var(--th-r-md) var(--th-r-md) / 34% 34% var(--th-r-md) var(--th-r-md);
  box-shadow: 0 1.5rem 4rem -1.5rem rgba(240, 164, 58, .3), 0 0 0 1px rgba(240, 164, 58, .22);
  background: var(--th-bark-2);
}
.th-window::before {
  content: ""; position: absolute; inset: .55rem; z-index: 1; pointer-events: none;
  border: 1px solid rgba(255, 208, 138, .35);
  border-radius: 48% 48% .5rem .5rem / 34% 34% .5rem .5rem;
}
.th-window::after {
  content: ""; position: absolute; left: -4%; right: -4%; bottom: -.9rem; height: .9rem;
  border-radius: .2rem .2rem .45rem .45rem;
  background: linear-gradient(180deg, #6a4a33, #3b2a1f 60%, #2a1d15);
  box-shadow: 0 .6rem 1.2rem -.3rem rgba(0, 0, 0, .5);
}

/* ───────── 炉火栏 ───────── */
.th-rail { margin: 1.5rem 0 1rem; }
.th-hearth {
  position: relative;
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); align-items: center; gap: 1rem;
  padding: 1rem 1rem 1rem .85rem;
  border-radius: var(--th-r-lg);
  background:
    radial-gradient(14rem 12rem at 22% 50%, rgba(240, 164, 58, .26), transparent 70%),
    linear-gradient(160deg, #35271f, var(--th-bark) 60%);
  border: 1px solid rgba(240, 164, 58, .22);
  box-shadow: var(--th-lift);
  color: var(--th-cream);
}
.th-hearth-ring { position: relative; aspect-ratio: 1; width: 100%; }
.th-hearth-ring:empty::before {
  content: ""; position: absolute; inset: 11%; border-radius: 50%;
  border: .55rem solid var(--th-char); opacity: .8;
}
.th-hearth-tip { display: none; margin: 0; font-size: .8125rem; line-height: 1.6; color: rgba(245, 236, 219, .7); text-align: center; }

.th-ring { display: block; width: 100%; height: auto; overflow: visible; }
.th-ring-halo { fill: none; stroke: rgba(240, 164, 58, .14); stroke-width: 1; }
.th-ring-bed { fill: rgba(0, 0, 0, .18); }
.th-seg-a { cursor: pointer; outline: none; }
.th-seg {
  fill: none; stroke: #5d4838; stroke-width: 15; stroke-linecap: round;
  transition: stroke .35s ease, filter .35s ease, stroke-width .25s ease;
}
.th-seg-a:hover .th-seg, .th-seg-a:focus-visible .th-seg { stroke-width: 18; }
.th-seg.is-seen { stroke: #7a4f2b; }
.th-seg.is-done { stroke: url(#th-ember-fill); filter: drop-shadow(0 0 4px rgba(240, 164, 58, .75)); }
.th-seg.is-here { stroke: var(--th-ember); }
.th-seg-spark { fill: none; stroke: var(--th-ember-hi); stroke-width: 15; stroke-linecap: round; opacity: 0; pointer-events: none; }
.th-seg-spark.is-here { opacity: .55; animation: th-flicker 2.6s ease-in-out infinite; }
.th-seg-a:focus-visible .th-seg-spark { opacity: .9; }
@keyframes th-flicker {
  0%, 100% { opacity: .25; } 38% { opacity: .7; } 52% { opacity: .45; } 70% { opacity: .8; }
}
@media (prefers-reduced-motion: reduce) { .th-seg-spark.is-here { animation: none; } }

.th-core {
  position: absolute; inset: 24%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; line-height: 1.25;
}
.th-core-k { font-size: .6875rem; letter-spacing: .14em; color: var(--th-ember-hi); }
.th-core-n {
  margin: .2rem 0 .15rem; font-family: var(--th-serif); font-weight: 700;
  font-size: 1.05rem; color: #fff6e6; text-shadow: 0 0 14px rgba(240, 164, 58, .55);
}
.th-core-t { font-size: .6875rem; color: rgba(245, 236, 219, .66); }

.th-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: .1rem; }
.th-legend a {
  display: flex; align-items: center; gap: .45rem; padding: .3rem .2rem;
  color: rgba(245, 236, 219, .86); font-size: .875rem; line-height: 1.35; text-decoration: none;
}
.th-legend a:hover { color: #fff; }
.th-pip {
  flex: none; width: .6rem; height: .6rem; border-radius: 50%;
  border: 2px solid #8a6446; background: transparent;
}
.th-pip.is-seen { border-color: #b57a40; }
.th-pip.is-done { border-color: var(--th-ember); background: var(--th-ember); box-shadow: 0 0 6px rgba(240, 164, 58, .9); }
.th-pip.is-here { border-color: var(--th-ember-hi); box-shadow: 0 0 0 3px rgba(240, 164, 58, .25); }

/* 本页章节 */
.th-toc { margin-top: 1rem; padding: 1rem 1.1rem; border-radius: var(--th-r-lg); background: rgba(255, 250, 242, .7); border: 1px solid var(--th-rule); }
.th-toc-h { margin: 0 0 .4rem; font-size: .75rem; letter-spacing: .22em; color: var(--th-ember-ink); font-weight: 700; }
.th-toc-list { list-style: none; margin: 0; padding: 0; }
.th-toc-i a {
  position: relative; display: block; padding: .42rem .5rem .42rem 1.35rem; border-radius: .55rem;
  color: var(--th-ink-2); font-size: .875rem; line-height: 1.5; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.th-toc-i a::before {
  content: ""; position: absolute; left: .45rem; top: .95rem; width: .4rem; height: 1px; background: #c5ac88;
}
.th-toc-i.is-task a::before {
  top: .78rem; width: .5rem; height: .5rem; border-radius: 50%; left: .38rem;
  background: transparent; border: 1.5px solid #b48a62;
}
.th-toc-i.is-task.is-done a::before { background: var(--th-ember); border-color: var(--th-ember); box-shadow: 0 0 5px rgba(240, 164, 58, .9); }
@media (hover: hover) { .th-toc-i a:hover { color: var(--th-bark); background: rgba(240, 164, 58, .1); } }
.th-toc-i.is-here a { color: var(--th-bark); background: #f3e2c2; font-weight: 600; }
.th-toc-i.is-here a::before { background: var(--th-ember-deep); border-color: var(--th-ember-deep); }

/* JS 在手机上把章节收进右下角的炉火按钮 */
.th-js .th-rail .th-toc { display: none; }

.th-orb {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 30;
  width: 3.5rem; height: 3.5rem; padding: .3rem; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #3e2d22, var(--th-soot));
  box-shadow: 0 .75rem 1.5rem -.5rem rgba(29, 21, 17, .7), 0 0 0 1px rgba(240, 164, 58, .3);
  cursor: pointer; opacity: 0; transform: translateY(.75rem) scale(.9); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.th-orb.is-on { opacity: 1; transform: none; pointer-events: auto; }
.th-orb .th-ring { pointer-events: none; }
.th-orb .th-seg { stroke-width: 22; }

.th-pop[hidden] { display: none; }
.th-pop { position: fixed; inset: 0; z-index: 40; }
.th-pop-veil { position: absolute; inset: 0; background: rgba(29, 21, 17, .55); }
.th-pop-card {
  position: absolute; left: .75rem; right: .75rem; bottom: .75rem; max-height: min(78vh, 40rem); overflow: auto;
  padding: 1.1rem 1rem 1rem; border-radius: var(--th-r-lg);
  background: var(--th-paper); border: 1px solid var(--th-rule); box-shadow: 0 1.5rem 3rem -1rem rgba(0, 0, 0, .55);
}
.th-pop-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 .4rem; }
.th-pop-head .th-toc-h { margin: 0; }
.th-pop-x {
  width: 2.25rem; height: 2.25rem; border: 1px solid var(--th-rule); border-radius: 50%;
  background: var(--th-milk); color: var(--th-bark); font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.th-pop .th-toc-i a { font-size: .9375rem; padding-block: .55rem; -webkit-line-clamp: 3; }

/* ───────── 正文 ───────── */
.th-tale > section { scroll-margin-top: 1.25rem; margin: 3.25rem 0 0; }
.th-tale > section > p, .th-tale li, .th-tale dd { overflow-wrap: anywhere; }
.th-tale h2 {
  margin: 0 0 1.1rem;
  font-family: var(--th-serif); font-weight: 700;
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.875rem); line-height: 1.4; color: var(--th-bark);
  text-wrap: pretty;
}
.th-tale > section:not([data-task]) > h2::before {
  content: ""; display: block; width: 2.4rem; height: .2rem; margin-bottom: .9rem; border-radius: .2rem;
  background: linear-gradient(90deg, var(--th-ember-deep), var(--th-ember));
}
.th-tale h3 {
  margin: 2.2rem 0 .7rem;
  font-family: var(--th-serif); font-weight: 700; font-size: 1.2rem; line-height: 1.5; color: var(--th-bark-2);
}
.th-tale p { margin: 0 0 1.1rem; }
.th-tale strong { color: var(--th-bark); }

/* 安全任务:木框卡片 + 门楣牌 */
.th-tale > section[data-task] {
  position: relative; margin-top: 3.75rem;
  padding: 3.4rem clamp(1.1rem, 3.6vw, 2.4rem) 1.6rem;
  border-radius: var(--th-r-lg);
  background: linear-gradient(180deg, var(--th-milk), var(--th-paper));
  border: 1px solid var(--th-rule);
  box-shadow: var(--th-lift), inset 0 1px 0 #fff;
}
.th-tale > section[data-task]::before {
  content: "安全任务 " attr(data-task) "  ·  " attr(data-task-name);
  position: absolute; top: -1rem; left: clamp(1.1rem, 3.6vw, 2.4rem);
  display: inline-flex; align-items: center; gap: .5rem; height: 2rem; padding: 0 1rem 0 2.3rem;
  border-radius: 999px; white-space: pre;
  background:
    radial-gradient(circle at 1.15rem 50%, var(--th-ember) 0 .28rem, rgba(240, 164, 58, .25) .3rem .5rem, transparent .52rem),
    linear-gradient(180deg, #3a2a20, var(--th-bark));
  color: var(--th-ember-hi); font-size: .8125rem; letter-spacing: .1em; font-weight: 600;
  box-shadow: 0 .4rem .9rem -.3rem rgba(42, 31, 26, .6);
}
.th-tale > section[data-task].is-done::before {
  background:
    radial-gradient(circle at 1.15rem 50%, #fff3d6 0 .22rem, var(--th-ember) .24rem .42rem, rgba(240, 164, 58, .35) .44rem .6rem, transparent .62rem),
    linear-gradient(180deg, #4a321f, #2f2117);
}

/* 步骤:烛焰编号 */
.th-tale ol[data-part="steps"] { list-style: none; counter-reset: th-step; margin: 1.6rem 0 1.8rem; padding: 0; }
.th-tale ol[data-part="steps"] > li {
  counter-increment: th-step; position: relative; margin: 0; padding: 0 0 1.25rem 3.3rem;
  background: linear-gradient(var(--th-rule), var(--th-rule)) no-repeat 1.05rem 2.6rem / 1px calc(100% - 2.9rem);
}
.th-tale ol[data-part="steps"] > li:last-child { background: none; padding-bottom: .2rem; }
.th-tale ol[data-part="steps"] > li::before {
  content: ""; position: absolute; left: .2rem; top: .15rem; width: 1.7rem; height: 1.7rem;
  border-radius: 50% 0 50% 50%; transform: rotate(-45deg);
  background: radial-gradient(circle at 40% 60%, var(--th-ember-hi), var(--th-ember) 55%, var(--th-ember-deep));
  box-shadow: 0 0 .9rem rgba(240, 164, 58, .45);
}
.th-tale ol[data-part="steps"] > li::after {
  content: counter(th-step); position: absolute; left: .2rem; top: .2rem; width: 1.7rem; height: 1.7rem;
  display: grid; place-items: center; padding-top: .1rem;
  font-family: var(--th-serif); font-weight: 700; font-size: .9375rem; line-height: 1; color: var(--th-bark);
}

.th-tale ul { padding-left: 1.3rem; }
.th-tale ul li::marker { color: var(--th-ember-deep); }

/* 截图:木墙上的相框 */
.th-tale figure[data-part="shot"] {
  margin: 2rem 0; padding: .6rem;
  background: #fff; border: 1px solid var(--th-rule); border-radius: var(--th-r-md);
  box-shadow: 0 1.4rem 2.6rem -1.8rem rgba(42, 31, 26, .55), 0 0 0 .35rem rgba(240, 164, 58, .07);
}
.th-tale figure[data-part="shot"] img { display: block; width: 100%; height: auto; border-radius: .4rem; background: #f3ece0; }
.th-tale figure[data-part="shot"] figcaption {
  display: flex; gap: .55rem; padding: .75rem .35rem .15rem;
  font-size: .875rem; line-height: 1.65; color: var(--th-ink-2);
}
.th-tale figure[data-part="shot"] figcaption::before {
  content: ""; flex: none; width: .9rem; height: 2px; margin-top: .72rem; background: var(--th-ember);
}

/* 表格 */
.th-tale table {
  width: 100%; margin: 1.5rem 0 1.8rem; border-collapse: separate; border-spacing: 0;
  font-size: .9375rem; line-height: 1.65;
  background: var(--th-milk); border: 1px solid var(--th-rule); border-radius: var(--th-r-md); overflow: hidden;
}
.th-tale thead th {
  padding: .75rem .9rem; text-align: left; vertical-align: bottom;
  background: var(--th-bark); color: var(--th-cream); font-weight: 600; font-size: .875rem; letter-spacing: .04em;
}
.th-tale td { padding: .75rem .9rem; vertical-align: top; border-top: 1px solid var(--th-rule-2); }
.th-tale tbody tr:nth-child(even) td { background: rgba(240, 164, 58, .045); }
.th-tale tbody td:first-child { color: var(--th-bark); font-weight: 600; }

/* 定义列表 */
.th-tale dl { display: grid; grid-template-columns: minmax(6.5em, 9em) 1fr; margin: 1.4rem 0 1.6rem; border-top: 1px solid var(--th-rule); }
.th-tale dt, .th-tale dd { padding: .8rem 0; border-bottom: 1px solid var(--th-rule); }
.th-tale dt { padding-right: 1rem; font-weight: 700; color: var(--th-bark); }
.th-tale dd { margin: 0; color: var(--th-ink); }

/* 提示 / 警示 */
.th-tale [data-part="note"] {
  position: relative; margin: 1.8rem 0; padding: 1.2rem 1.3rem 1rem 3.2rem;
  border-radius: var(--th-r-md); border: 1px solid #ecc88e;
  background: radial-gradient(10rem 7rem at 0 0, rgba(240, 164, 58, .22), transparent 70%), #fff4df;
}
.th-tale [data-part="note"]::before {
  content: ""; position: absolute; left: 1.15rem; top: 1.45rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: radial-gradient(circle, #fff6e2 0 22%, var(--th-ember) 30% 55%, rgba(240, 164, 58, 0) 72%);
}
.th-tale [data-part="note"] p:last-child { margin-bottom: 0; }

.th-tale [data-part="warn"] {
  position: relative; margin: 1.8rem 0; padding: 1.25rem 1.3rem 1.1rem 3.3rem;
  border-radius: var(--th-r-md); color: #f8e9d6;
  background: linear-gradient(135deg, #4a231a, #33190f);
  border: 1px solid #a8492a; box-shadow: 0 1rem 2rem -1.4rem rgba(74, 35, 26, .9);
}
.th-tale [data-part="warn"]::before {
  content: "!"; position: absolute; left: 1.05rem; top: 1.3rem; width: 1.4rem; height: 1.4rem;
  display: grid; place-items: center; border-radius: 50%;
  background: #e0632e; color: #2a120b; font-weight: 800; font-size: .875rem; line-height: 1;
}
.th-tale [data-part="warn"] p { margin: 0; }

/* 邀请码卡 */
.th-tale > aside[data-part="cta"] {
  position: relative; margin: 3.5rem 0 0; padding: 1.8rem clamp(1.2rem, 4vw, 2.4rem) 1.6rem; overflow: hidden;
  border-radius: var(--th-r-lg); color: var(--th-cream);
  background:
    radial-gradient(28rem 16rem at 100% 0%, rgba(240, 164, 58, .32), transparent 65%),
    radial-gradient(18rem 12rem at 0% 100%, rgba(217, 116, 31, .16), transparent 70%),
    var(--th-bark);
  border: 1px solid rgba(240, 164, 58, .35);
  box-shadow: 0 2rem 3rem -2rem rgba(42, 31, 26, .8);
}
.th-tale > aside[data-part="cta"] > p { margin: 0 0 1rem; color: rgba(245, 236, 219, .9); font-size: .9375rem; line-height: 1.75; }
.th-tale > aside[data-part="cta"] > p:first-child {
  font-family: var(--th-serif); font-weight: 700; font-size: 1.6rem; letter-spacing: .05em; color: #fff6e6;
}
.th-code { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
.th-code-l { width: 100%; font-family: var(--th-sans); font-size: .8125rem; font-weight: 600; letter-spacing: .2em; color: var(--th-ember-hi); }
.th-tale .th-code-v {
  font-family: var(--th-serif); font-weight: 700; font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3rem); line-height: 1.1;
  letter-spacing: .12em; color: #fff4dc; text-shadow: 0 0 22px rgba(240, 164, 58, .5);
  -webkit-user-select: all; user-select: all;
}
.th-copy {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: 999px; cursor: pointer;
  font: 600 .875rem/1 var(--th-sans); letter-spacing: .06em; color: var(--th-ember-hi);
  background: rgba(240, 164, 58, .1); border: 1px solid rgba(240, 164, 58, .5);
  transition: background .2s ease, color .2s ease;
}
.th-copy:hover { background: rgba(240, 164, 58, .2); color: #fff; }
.th-copy.is-ok { background: var(--th-ember); color: var(--th-bark); border-color: var(--th-ember); }
.th-tale a[data-cta] {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin: 1.3rem 0 1.1rem; padding: 1rem 1.4rem; border-radius: .9rem;
  font-size: 1.0625rem; font-weight: 700; letter-spacing: .08em; color: var(--th-bark); text-decoration: none;
  background: linear-gradient(180deg, #ffc56d, var(--th-ember) 55%, #e48d27);
  box-shadow: 0 .9rem 1.8rem -.8rem rgba(240, 164, 58, .75), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .15s ease, box-shadow .2s ease;
}
.th-tale a[data-cta]::after { content: "→"; font-weight: 700; }
.th-tale a[data-cta]:hover { color: var(--th-bark); transform: translateY(-1px); box-shadow: 0 1.1rem 2rem -.8rem rgba(240, 164, 58, .9), inset 0 1px 0 rgba(255, 255, 255, .5); }
.th-tale > aside[data-part="cta"] > p:last-child {
  margin: 0; padding-top: 1rem; border-top: 1px dashed rgba(240, 164, 58, .35);
  font-size: .9375rem; color: rgba(245, 236, 219, .88);
}
.th-tale > aside[data-part="cta"] a:not([data-cta]) { color: var(--th-ember-hi); text-decoration-color: rgba(255, 208, 138, .6); }

/* 做好了按钮(JS 生成) */
.th-done { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 1.6rem 0 0; padding-top: 1.2rem; border-top: 1px dashed var(--th-rule); }
.th-done-b {
  display: inline-flex; align-items: center; gap: .6rem; padding: .6rem 1.1rem .6rem .8rem; border-radius: 999px; cursor: pointer;
  font: 600 .9375rem/1.2 var(--th-sans); color: var(--th-bark);
  background: var(--th-milk); border: 1px solid #d9c09a;
  transition: background .2s ease, border-color .2s ease;
}
.th-done-b:hover { border-color: var(--th-ember-deep); background: #fff3de; }
.th-done-i { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid #b48a62; display: grid; place-items: center; }
.th-done-b[aria-pressed="true"] { background: var(--th-bark); color: var(--th-ember-hi); border-color: var(--th-bark); }
.th-done-b[aria-pressed="true"] .th-done-i { border-color: var(--th-ember); background: var(--th-ember); box-shadow: 0 0 8px rgba(240, 164, 58, .9); }
.th-done-b[aria-pressed="true"] .th-done-i::after { content: ""; width: .32rem; height: .55rem; margin-top: -.12rem; border: solid var(--th-bark); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.th-done-h { margin: 0 !important; font-size: .8125rem; color: var(--th-ink-3); }

/* 常见问题 */
#faq { margin-top: 4rem; }
#faq details { border-top: 1px solid var(--th-rule); }
#faq details:last-of-type { border-bottom: 1px solid var(--th-rule); }
#faq summary {
  position: relative; list-style: none; cursor: pointer; padding: 1.1rem 3rem 1.1rem 0;
  font-family: var(--th-serif); font-weight: 700; font-size: 1.0625rem; line-height: 1.6; color: var(--th-bark);
}
#faq summary::-webkit-details-marker { display: none; }
#faq summary::after {
  content: ""; position: absolute; right: .2rem; top: 50%; width: 1.9rem; height: 1.9rem; margin-top: -.95rem; border-radius: 50%;
  background:
    linear-gradient(var(--th-bark), var(--th-bark)) center / .7rem 1.5px no-repeat,
    linear-gradient(var(--th-bark), var(--th-bark)) center / 1.5px .7rem no-repeat,
    #f1e2c6;
  transition: transform .25s ease, background-color .25s ease;
}
#faq details[open] summary::after { transform: rotate(45deg); background-color: var(--th-ember); }
#faq summary:hover { color: var(--th-ember-ink); }
#faq details > p { margin: 0; padding: 0 0 1.3rem; color: var(--th-ink-2); }

/* ───────── 页脚 ───────── */
.th-hearthstone {
  color: rgba(245, 236, 219, .78);
  background:
    radial-gradient(40rem 14rem at 50% 0, rgba(240, 164, 58, .12), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .015) 0 1px, transparent 1px 6px),
    var(--th-soot);
  border-top: 1px solid rgba(240, 164, 58, .2);
  font-size: .9375rem; line-height: 1.75;
}
.th-hs-row, .th-hs-fine { max-width: 72rem; margin: 0 auto; padding-inline: var(--th-gutter); }
.th-hs-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem 3rem; padding-top: 2.6rem; padding-bottom: 1.6rem; }
.th-hs-id { max-width: 30rem; }
.th-hs-id p { margin: .8rem 0 0; }
.th-hs-links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; align-content: flex-start; }
.th-hs-links a, .th-hs-fine a { color: var(--th-cream); text-decoration-color: rgba(240, 164, 58, .45); }
.th-hs-links a:hover, .th-hs-fine a:hover { color: var(--th-ember-hi); }
.th-hs-fine { padding-top: 1.2rem; padding-bottom: 2.4rem; border-top: 1px solid rgba(245, 236, 219, .1); font-size: .875rem; }
.th-hs-fine p { margin: 0 0 .3rem; }
.th-hs-risk { color: var(--th-ember-hi); }

/* ───────── 站务页 ───────── */
.th-den { position: relative; padding: clamp(2rem, 6vw, 4.5rem) var(--th-gutter) clamp(3rem, 7vw, 5rem); }
.th-den-lamp {
  position: absolute; inset: 0 0 auto; height: 16rem; z-index: 0;
  background: radial-gradient(30rem 12rem at 50% 0, rgba(240, 164, 58, .2), transparent 70%), linear-gradient(180deg, var(--th-bark), transparent);
  opacity: .9;
}
.th-sheet-page {
  position: relative; z-index: 1; max-width: 44rem; margin: 0 auto;
  padding: clamp(1.6rem, 5vw, 3rem) clamp(1.2rem, 5vw, 3.2rem);
  background: linear-gradient(180deg, var(--th-milk), var(--th-paper));
  border: 1px solid var(--th-rule); border-radius: var(--th-r-lg); box-shadow: var(--th-lift);
}
.th-sheet-page h1 {
  margin: 0 0 1.4rem; padding-bottom: 1rem; border-bottom: 1px solid var(--th-rule);
  font-family: var(--th-serif); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); line-height: 1.35; color: var(--th-bark);
}
.th-sheet-page h2 { margin: 2rem 0 .6rem; font-family: var(--th-serif); font-weight: 700; font-size: 1.25rem; line-height: 1.5; color: var(--th-bark-2); }
.th-sheet-page p { margin: 0 0 1rem; }
.th-sheet-page ul { padding-left: 1.3rem; }
.th-sheet-page li { margin: 0 0 .5rem; }
.th-sheet-page li::marker { color: var(--th-ember-deep); }
.th-den-back { margin: 2.2rem 0 0 !important; padding-top: 1.2rem; border-top: 1px dashed var(--th-rule); font-size: .9375rem; }

/* 404 */
.th-lost {
  min-height: 70vh; display: grid; place-items: center; text-align: center;
  padding: 4rem var(--th-gutter); color: var(--th-cream);
  background: radial-gradient(24rem 18rem at 50% 42%, rgba(240, 164, 58, .25), transparent 70%), var(--th-bark);
}
.th-lost-ring { width: 8.5rem; height: 8.5rem; margin: 0 auto 1.6rem; }
.th-lost h1 { margin: 0 0 .8rem; font-family: var(--th-serif); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); color: #fbf3e4; }
.th-lost p { margin: 0 auto 1.6rem; max-width: 28rem; color: rgba(245, 236, 219, .8); }
.th-lost a.th-lost-go {
  display: inline-flex; padding: .8rem 1.5rem; border-radius: 999px; font-weight: 700; letter-spacing: .06em; text-decoration: none;
  color: var(--th-bark); background: linear-gradient(180deg, #ffc56d, var(--th-ember));
}

/* ───────── 手机 ───────── */
@media (max-width: 40em) {
  .th-mark-w { font-size: 1.125rem; }
  .th-nav a { padding-inline: .45rem; font-size: .875rem; }

  .th-tale dl { grid-template-columns: 1fr; }
  .th-tale dt { padding: .8rem 0 .1rem; border-bottom: 0; }
  .th-tale dd { padding-top: 0; }

  /* 无 JS:表格在自身盒子里横向滚动 */
  .th-tale table { display: block; overflow-x: auto; }
  /* 有 JS:按行拆成卡片 */
  .th-tale table.th-stack { display: table; }
  .th-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .th-stack, .th-stack tbody, .th-stack tr, .th-stack td { display: block; width: 100%; }
  .th-stack tr { padding: .85rem 1rem .7rem; border-top: 1px solid var(--th-rule-2); }
  .th-stack tbody tr:first-child { border-top: 0; }
  .th-stack tbody tr:nth-child(even) td { background: none; }
  .th-stack tbody tr:nth-child(even) { background: rgba(240, 164, 58, .05); }
  .th-stack td { padding: .2rem 0; border: 0; }
  .th-stack td[data-th]::before { content: attr(data-th); display: block; font-size: .75rem; letter-spacing: .08em; color: var(--th-ember-ink); font-weight: 600; }
  .th-stack td:first-child { font-family: var(--th-serif); font-size: 1.0625rem; padding-bottom: .35rem; }
  .th-stack td:first-child::before { display: none; }
  .th-tale .th-stack td.th-num, .th-tale .th-stack tbody tr:nth-child(even) td.th-num { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-right: .5rem; padding: 0; border-radius: 50%; background: var(--th-bark); color: var(--th-ember-hi); font-size: .875rem; vertical-align: middle; }
  .th-tale .th-stack td.th-num + td { display: inline; font-family: var(--th-serif); font-weight: 700; color: var(--th-bark); font-size: 1.0625rem; }
  .th-stack td.th-num + td::before { display: none; }
  .th-stack td.th-num + td + td { margin-top: .35rem; }

  .th-tale figure[data-part="shot"] { margin-inline: -.25rem; padding: .4rem; }
  .th-tale [data-part="note"], .th-tale [data-part="warn"] { padding-left: 2.9rem; padding-right: 1rem; }
  .th-tale [data-part="note"]::before { left: .95rem; }
  .th-tale [data-part="warn"]::before { left: .8rem; }
  .th-tale > section[data-task] { padding-inline: 1.05rem; }
  .th-tale > section[data-task]::before { left: 1rem; }
}

/* ───────── 平板 ───────── */
@media (min-width: 40.01em) and (max-width: 63.99em) {
  .th-tale > [data-part="hero"] { padding-top: 3.2rem; }
  .th-hearth { grid-template-columns: 11rem minmax(0, 1fr); padding: 1.2rem 1.4rem; }
}

/* ───────── 桌面:正文 + 右栏炉火环 ───────── */
@media (min-width: 64em) {
  .th-tale {
    grid-template-columns: minmax(0, var(--th-measure)) 17rem;
    column-gap: clamp(3rem, 5vw, 4.75rem);
    justify-content: center;
    padding-bottom: 5.5rem;
  }
  .th-tale > * { max-width: none; justify-self: stretch; }
  .th-tale::before { grid-row: 1; }
  .th-tale > [data-part="hero"] {
    grid-column: 1 / -1; grid-row: 1; justify-self: start; align-self: center;
    width: 47%; padding: 4.25rem 0 4.5rem;
  }
  .th-window {
    grid-column: 1 / -1; grid-row: 1; justify-self: end; align-self: center;
    width: 48%; margin: 3rem 0 3.6rem;
  }
  .th-window img { aspect-ratio: 1 / 1.02; object-position: 70% 50%; border-radius: 50% 50% var(--th-r-md) var(--th-r-md) / 38% 38% var(--th-r-md) var(--th-r-md); }
  .th-window::before { border-radius: 50% 50% .5rem .5rem / 38% 38% .5rem .5rem; }
  .th-window::after { left: -7%; right: -7%; }

  .th-rail { grid-column: 2; grid-row: 2 / span 40; margin: 0; }
  .th-tale > :not(.th-rail):not(.th-window):not([data-part="hero"]) { grid-column: 1; }
  .th-rail-in {
    position: sticky; top: 1.25rem; padding: 2.25rem 0 1.25rem;
    max-height: calc(100vh - 1.25rem); display: flex; flex-direction: column;
  }
  .th-rail-in > .th-hearth { flex: none; }
  .th-rail .th-toc {
    position: relative; flex: 0 1 auto; min-height: 6rem;
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d6c09d transparent;
  }
  .th-hearth { display: block; padding: 1.1rem 1.2rem .9rem; }
  .th-hearth-ring { width: 100%; max-width: 11.5rem; margin: 0 auto; }
  .th-toc { padding: .85rem .9rem; }
  .th-toc-i a { padding-block: .34rem; font-size: .84rem; }
  .th-toc-i a::before { top: .85rem; }
  .th-toc-i.is-task a::before { top: .7rem; }
  .th-hearth-tip { display: block; margin-top: .8rem; }
  .th-hearth .th-legend { display: none; }
  .th-core-k { font-size: .75rem; }
  .th-core-n { font-size: 1.3rem; }
  .th-core-t { font-size: .75rem; }
  .th-js .th-rail .th-toc { display: block; }
  .th-orb, .th-pop { display: none !important; }
}

@media (min-width: 90em) {
  .th-tale { grid-template-columns: minmax(0, var(--th-measure)) 18.5rem; }
}

@media print {
  .th-rail, .th-orb, .th-pop, .th-done, .th-eaves nav { display: none !important; }
  .th-tale::before { display: none; }
  [data-part="hero"], [data-part="hero"] h1 { color: #000 !important; }
}

/* 404 整页暖底 */
body.th-is-lost { background: var(--th-bark); }
.th-is-lost .th-lost { min-height: calc(100vh - 11rem); }
.th-is-lost .th-hs-fine { border-top: 0; padding-top: 1.8rem; }
