:root{
  --paper:#F4EDE1;
  --paper-2:#EADFCD;
  --card:#FCF7EE;
  --note:#E6ECF2;
  --ink:#2E4057;
  --ink-soft:#5B6E82;
  --red:#C8553D;
  --red-soft:#E0A090;
  --line:#D8CBB6;
  --rail:212px;
  --r:18px;
  --hand:'Patrick Hand','Kalam','Kaiti SC',STKaiti,'Xingkai SC',KaiTi,serif;
  --sans:-apple-system,BlinkMacSystemFont,'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans SC',sans-serif;
}

*{box-sizing:border-box}

html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
}

body{
  margin:0;
  background-color:var(--paper);
  background-image:
    repeating-linear-gradient(0deg,rgba(46,64,87,.05) 0 1px,transparent 1px 30px),
    repeating-linear-gradient(90deg,rgba(46,64,87,.05) 0 1px,transparent 1px 30px);
  color:var(--ink);
  font-family:var(--sans);
  font-size:17px;
  line-height:1.75;
  -webkit-font-smoothing:antialiased;
}

a{color:var(--ink)}
img{max-width:100%;height:auto}

/* —— 视差层 —— */
.layers{
  position:fixed;
  inset:0;
  z-index:0;
  overflow:hidden;
  pointer-events:none;
}
.layers .l{
  position:absolute;
  display:block;
  border-radius:50%;
  will-change:transform;
}
.l1{
  width:340px;height:340px;right:-90px;top:6vh;
  background:radial-gradient(circle at 38% 34%,rgba(200,85,61,.22),rgba(200,85,61,0) 70%);
}
.l2{
  width:240px;height:240px;left:34%;top:52vh;
  background:radial-gradient(circle at 50% 50%,rgba(46,64,87,.16),rgba(46,64,87,0) 70%);
}
.l3{
  width:120px;height:120px;left:16%;top:16vh;
  background:rgba(200,85,61,.12);
  border-radius:46% 54% 58% 42%;
}
.l4{
  width:520px;height:520px;right:12%;top:88vh;
  background:radial-gradient(circle at 50% 50%,rgba(46,64,87,.10),rgba(46,64,87,0) 72%);
}

/* —— 左侧竖栏 —— */
.rail{
  position:fixed;
  top:0;left:0;bottom:0;
  z-index:50;
  width:var(--rail);
  padding:18px 14px 22px;
  display:flex;
  flex-direction:column;
  gap:16px;
  background:rgba(244,237,225,.94);
  border-right:2px dashed var(--line);
}
.rail-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.brand{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:46px;
  height:46px;
  border-radius:14px;
  background:var(--red);
  color:var(--paper);
  text-decoration:none;
  flex:0 0 auto;
}
.brand .mark{
  width:44px;height:44px;
  border-radius:14px;
  object-fit:cover;
  display:block;
}
.brand svg.mark{
  width:26px;height:26px;
  fill:none;
  stroke:currentColor;
  stroke-width:2.2;
  stroke-linecap:round;
  stroke-linejoin:round;
  margin:auto;
}
.brand svg.mark rect,.brand svg.mark circle{fill:none}

.burger{
  display:none;
  min-height:44px;
  padding:0 16px;
  border:2px dashed var(--line);
  border-radius:14px;
  background:transparent;
  color:var(--ink);
  font-family:var(--sans);
  font-size:16px;
  cursor:pointer;
}

.menu ol{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.menu a{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:44px;
  padding:8px 10px;
  border-radius:14px;
  color:var(--ink);
  text-decoration:none;
  font-size:16px;
  line-height:1.45;
  transition:background .18s ease,color .18s ease,transform .18s ease;
}
.menu a:hover,.menu a:focus-visible{
  background:var(--paper-2);
  color:var(--red);
  transform:translateX(3px);
}
.ico{
  flex:0 0 auto;
  width:20px;height:20px;
  display:inline-flex;
  color:var(--red);
}
.ico svg{
  width:20px;height:20px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.find{margin-top:auto}
.find input{
  width:100%;
  min-height:44px;
  padding:9px 12px;
  border:2px dashed var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.55);
  color:var(--ink);
  font-family:var(--sans);
  font-size:16px;
}
.find input:focus{
  outline:none;
  border-color:var(--red);
  background:#fff;
}
.find.miss input{
  border-color:var(--red);
  animation:shake .4s ease;
}
@keyframes shake{
  0%,100%{transform:translateX(0)}
  25%{transform:translateX(-5px)}
  75%{transform:translateX(5px)}
}

/* —— 主体 —— */
main{
  position:relative;
  z-index:1;
  margin-left:var(--rail);
}
.wrap{
  max-width:1080px;
  margin:0 auto;
  padding:0 32px;
}

.hero{
  min-height:70vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:70px 0 46px;
  position:relative;
}
.badge{
  display:inline-block;
  margin:0 0 22px;
  padding:4px 16px;
  border-radius:999px;
  background:var(--red);
  color:var(--paper);
  font-family:var(--hand);
  font-size:16px;
  line-height:1.6;
  letter-spacing:.04em;
  transform:rotate(-2deg);
  animation:sway 7s ease-in-out infinite;
}
@keyframes sway{
  0%,100%{transform:rotate(-2deg) translateY(0)}
  50%{transform:rotate(1deg) translateY(-6px)}
}
.hero-in{
  position:relative;
  display:inline-block;
  animation:rise .8s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise{
  from{opacity:0;transform:translateY(20px)}
  to{opacity:1;transform:none}
}
.hero h1{
  margin:0;
  max-width:15em;
  font-family:var(--hand);
  font-weight:700;
  font-size:clamp(30px,5.4vw,60px);
  line-height:1.35;
  letter-spacing:.01em;
  color:var(--ink);
  word-break:break-word;
}
.art{
  position:absolute;
  right:-78px;
  top:-14px;
  width:74px;
  height:74px;
  margin:0;
  color:var(--red);
  transform:rotate(9deg);
  animation:float 6s ease-in-out infinite;
}
.art svg{width:100%;height:100%;display:block}
@keyframes float{
  0%,100%{transform:rotate(9deg) translateY(0)}
  50%{transform:rotate(4deg) translateY(-9px)}
}
.down{
  margin-top:38px;
  color:var(--red);
  font-family:var(--hand);
  font-size:22px;
  animation:bob 1.9s ease-in-out infinite;
}
.down::before{content:"↓"}
@keyframes bob{
  0%,100%{transform:translateY(0);opacity:.85}
  50%{transform:translateY(7px);opacity:.4}
}

/* —— 正文区 —— */
.stage{
  display:grid;
  grid-template-columns:minmax(0,1fr) 286px;
  gap:46px;
  align-items:start;
  padding:8px 0 84px;
}
.prose{
  counter-reset:sec;
  min-width:0;
}
.prose > section{
  counter-increment:sec;
  position:relative;
  background:var(--card);
  border-radius:var(--r);
  padding:26px 30px;
  margin:0 0 22px;
  scroll-margin-top:28px;
}
.prose > section::before{
  content:counter(sec,decimal-leading-zero);
  display:block;
  margin-bottom:2px;
  font-family:var(--hand);
  font-size:16px;
  letter-spacing:.16em;
  color:var(--red-soft);
}
.prose > section.hit{
  outline:3px dashed var(--red);
  outline-offset:3px;
}
.js .prose > section{
  opacity:0;
  transform:translateY(26px);
  transition:opacity .6s ease,transform .6s cubic-bezier(.2,.7,.3,1);
}
.js .prose > section.in{
  opacity:1;
  transform:none;
}

.prose h2{
  margin:0 0 14px;
  font-family:var(--hand);
  font-weight:700;
  font-size:27px;
  line-height:1.45;
  color:var(--red);
  padding-bottom:6px;
  background:linear-gradient(var(--red-soft),var(--red-soft)) left bottom/100% 3px no-repeat;
}
.prose h3{
  margin:26px 0 10px;
  font-family:var(--hand);
  font-size:21px;
  line-height:1.5;
  color:var(--ink);
}
.prose p{margin:0 0 1.05em;line-height:1.85}
.prose p:last-child{margin-bottom:0}
.prose ul,.prose ol{pargin:0;margin:0 0 1.05em;padding-left:1.35em}
.prose li{margin:.35em 0;line-height:1.8}
.prose a{color:var(--red);text-underline-offset:3px}
.prose a:hover{color:var(--ink)}
.prose strong{color:var(--red)}
.prose img{
  display:block;
  border-radius:14px;
  margin:1em 0;
  background:var(--paper-2);
}
.prose figure{margin:1.2em 0}
.prose blockquote{
  margin:1.2em 0;
  padding:12px 18px;
  background:#fff;
  border-left:4px solid var(--red);
  border-radius:0 14px 14px 0;
  color:var(--ink-soft);
}
.prose blockquote p:last-child{margin-bottom:0}
.prose table{
  width:100%;
  border-collapse:collapse;
  margin:1.1em 0;
  font-size:16px;
}
.prose th,.prose td{
  padding:9px 10px;
  border-bottom:1px dashed var(--line);
  text-align:left;
}
.prose th{color:var(--red);font-weight:700}

/* —— 侧栏 —— */
.side{
  position:sticky;
  top:24px;
  display:flex;
  flex-direction:column;
  gap:14px;
  min-width:0;
}
.note{
  background:var(--note);
  border-radius:var(--r);
  padding:18px 20px;
  transition:transform .25s ease;
}
.note:hover{transform:translateY(-3px) rotate(-.4deg)}
.note h2{
  margin:0 0 2px;
  font-family:var(--hand);
  font-size:21px;
  line-height:1.4;
  color:var(--ink);
}
.subtitle{
  margin:0;
  font-family:var(--hand);
  font-size:16px;
  line-height:1.6;
  color:var(--red);
}
.toc{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
}
.toc li + li{border-top:1px dashed rgba(46,64,87,.18)}
.toc a{
  display:flex;
  align-items:center;
  min-height:42px;
  padding:8px 2px;
  color:var(--ink);
  text-decoration:none;
  font-size:16px;
  line-height:1.5;
}
.toc a:hover{color:var(--red);text-decoration:underline;text-underline-offset:3px}
.top{
  display:block;
  min-height:46px;
  padding:12px;
  text-align:center;
  border-radius:14px;
  background:var(--red);
  color:var(--paper);
  text-decoration:none;
  font-size:16px;
  line-height:1.4;
  transition:background .2s ease;
}
.top:hover{background:var(--ink)}

/* —— 页脚 —— */
.foot{
  position:relative;
  z-index:1;
  margin-left:var(--rail);
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px;
  padding:20px 34px 40px;
  border-top:2px dashed var(--line);
}
.foot address{
  font-style:normal;
  font-family:var(--hand);
  font-size:16px;
  color:var(--ink-soft);
}
.foot ul{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.foot a{
  display:inline-flex;
  align-items:center;
  min-height:42px;
  padding:8px 12px;
  border-radius:12px;
  color:var(--ink);
  text-decoration:none;
  font-size:16px;
}
.foot a:hover{background:var(--paper-2);color:var(--red)}

/* —— 自适应 —— */
@media (max-width:980px){
  .rail{
    position:sticky;
    top:0;left:auto;right:auto;bottom:auto;
    width:auto;
    flex-direction:column;
    padding:10px 16px 12px;
    border-right:0;
    border-bottom:2px dashed var(--line);
    background:var(--paper);
    box-shadow:0 6px 18px rgba(46,64,87,.07);
  }
  .brand{width:44px;height:44px}
  .burger{display:inline-flex;align-items:center}
  .menu,.find{display:none}
  .rail.open .menu,.rail.open .find{display:block}
  .rail.open .menu ol{
    padding-top:6px;
    max-height:58vh;
    overflow-y:auto;
  }
  .rail.open .find{margin:8px 0 4px}
  .rail.open .find input{background:#fff}

  main{margin-left:0}
  .wrap{padding:0 18px}
  .foot{margin-left:0;padding:18px 18px 36px}

  .hero{padding:44px 0 30px;min-height:auto}
  .art{
    position:static;
    width:60px;height:60px;
    margin:0 auto 4px;
    transform:none;
    animation:none;
  }
  .down{margin-top:22px}

  .stage{
    grid-template-columns:minmax(0,1fr);
    gap:22px;
    padding-bottom:56px;
  }
  .side{position:static;order:2}
  .prose > section{
    padding:22px 20px;
    scroll-margin-top:110px;
  }
  .prose h2{font-size:24px}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .badge,.art,.down,.hero-in{animation:none}
  .js .prose > section{
    opacity:1;
    transform:none;
    transition:none;
  }
  .menu a,.note,.top{transition:none}
  .note:hover{transform:none}
}

button[aria-expanded]{min-width:44px;min-height:44px}
