@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700&family=Comic+Neue:wght@300;400;700&display=swap');

:root{
  --paper:#fafaf8;
  --ink:#1a1a1a;
  --mid:#4a4a4a;
  --line:#dcd6c7;
  --wash:#f0ede4;
  --tape:#efe9d8;
}

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

html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
  background:var(--paper);
}

body{
  margin:0;
  font-family:'Comic Neue','Baloo 2',"PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
  font-size:17px;
  line-height:1.75;
  color:var(--ink);
  background-color:var(--paper);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='170' height='170' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
  overflow-x:hidden;
}

h1,h2,h3,h4{
  font-family:'Baloo 2','Comic Neue',"PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  line-height:1.28;
  letter-spacing:.005em;
  color:var(--ink);
}

a{color:var(--ink)}

/* ---------- 页头：品牌独占一行 + 药丸菜单行 ---------- */

.masthead{
  background:var(--paper);
  border-bottom:2px solid var(--ink);
}

@media (min-width:820px){
  .masthead{position:sticky;top:0;z-index:30}
}

.bar{
  max-width:1060px;
  margin:0 auto;
  padding:8px 18px 10px;
}

.brand{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  padding:6px 2px;
  text-decoration:none;
  color:var(--ink);
  transform:rotate(-.7deg);
}

.brandtext{
  font-family:'Baloo 2','Comic Neue',system-ui,sans-serif;
  font-size:1.32rem;
  font-weight:700;
  letter-spacing:.01em;
}

.hand{
  font-size:1.3rem;
  line-height:1;
  color:var(--mid);
  transform:rotate(-8deg);
}

.brandmark{
  width:40px;
  height:40px;
  border-radius:50%;
  border:2px solid var(--ink);
  background:#fff;
  object-fit:cover;
}

.bar-tools{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  border-top:1px dashed var(--line);
  padding-top:10px;
}

.pills{
  flex:1 1 260px;
  min-width:0;
}

.pills p{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  margin:0;
}

.pill{
  display:inline-block;
  min-height:42px;
  padding:10px 15px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--paper);
  color:var(--ink);
  text-decoration:none;
  font-size:.95rem;
  line-height:1.2;
  transform:rotate(-.9deg);
  transition:background 90ms linear,color 90ms linear;
}

.pill:nth-child(2n){transform:rotate(.8deg);background:var(--wash)}
.pill:nth-child(3n){transform:rotate(-.3deg);border-style:dashed}
.pill:hover,.pill:focus-visible{background:var(--ink);color:var(--paper)}

.finder{
  display:flex;
  gap:6px;
  flex:0 1 210px;
}

.finder-in{
  flex:1 1 auto;
  min-width:0;
  min-height:42px;
  padding:8px 14px;
  border:2px solid var(--mid);
  border-radius:999px;
  background:#fff;
  color:var(--ink);
  font:inherit;
  font-size:.95rem;
}

.finder-in::placeholder{color:#8d8574}

.finder-btn{
  min-height:42px;
  padding:8px 14px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--ink);
  color:var(--paper);
  font:inherit;
  font-size:.95rem;
  cursor:pointer;
  transform:rotate(1deg);
}

/* ---------- 主区：栅格，右栏为便签 ---------- */

.stage{
  max-width:1060px;
  margin:0 auto;
  padding:20px 18px 10px;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:24px;
}

@media (min-width:900px){
  .stage{
    grid-template-columns:minmax(0,1fr) 250px;
    column-gap:32px;
    align-items:start;
  }
}

.hero{
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  min-height:44vh;
  padding:10px 0 20px;
  border-bottom:2px solid var(--ink);
}

.hero-copy{
  flex:1 1 60%;
  min-width:0;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 12px;
}

.chip{
  display:inline-block;
  padding:5px 13px;
  border:2px dashed var(--mid);
  border-radius:999px;
  background:var(--tape);
  color:var(--mid);
  font-size:.95rem;
  line-height:1.3;
  transform:rotate(-2.2deg);
}

.chip + .chip{transform:rotate(1.8deg);border-style:solid}

h1{
  margin:0 0 12px;
  font-size:clamp(1.9rem,6vw,2.9rem);
  font-weight:700;
  letter-spacing:-.01em;
}

.lede{
  margin:0;
  max-width:54ch;
  color:var(--mid);
  font-size:1.02rem;
}

.hero-art{
  flex:0 0 34%;
  max-width:250px;
  margin:0;
  padding:6px;
  border:3px solid var(--ink);
  border-radius:12px;
  background:#fff;
  box-shadow:6px 6px 0 var(--ink);
  transform:rotate(2.2deg);
}

.artimg{
  display:block;
  width:100%;
  height:auto;
  border-radius:8px;
}

/* ---------- 正文纸片 ---------- */

.sheet{
  min-width:0;
  padding:20px 18px 26px;
  border:2px solid var(--ink);
  border-radius:12px;
  background:var(--paper);
}

main article > section{
  padding:4px 0 26px;
  scroll-margin-top:150px;
}

main article > section:nth-child(odd){transform:rotate(-.16deg)}
main article > section:nth-child(even){transform:rotate(.14deg)}

main article > section + section{
  border-top:2px dashed var(--line);
  padding-top:24px;
  margin-top:6px;
}

main article h2{
  display:inline-block;
  margin:22px 0 4px;
  font-size:clamp(1.3rem,3.6vw,1.65rem);
  background:linear-gradient(transparent 66%,var(--tape) 66% 94%,transparent 94%);
}

main article h3{
  margin:20px 0 4px;
  font-size:clamp(1.12rem,3vw,1.3rem);
}

main article p{margin:.85em 0}

main article a{
  text-decoration:underline;
  text-decoration-style:wavy;
  text-decoration-color:var(--mid);
  text-underline-offset:4px;
}

main article ul,
main article ol{
  margin:.9em 0;
  padding-left:1.3em;
}

main article li{margin:.35em 0}
main article li::marker{color:var(--mid)}

main article img{
  max-width:100%;
  height:auto;
  border:2px solid var(--ink);
  border-radius:8px;
}

main article blockquote{
  margin:1.1em 0;
  padding:12px 16px;
  border-left:5px solid var(--mid);
  border-radius:0 10px 10px 0;
  background:var(--wash);
  color:var(--mid);
}

main article blockquote p{margin:.3em 0}

main article strong{color:var(--ink)}

main article table{
  width:100%;
  border-collapse:collapse;
  margin:1em 0;
  font-size:.97rem;
}

main article th,
main article td{
  border:1px solid var(--line);
  padding:8px 10px;
  text-align:left;
}

main article th{background:var(--wash)}

hr,
.scribble{
  display:block;
  width:66px;
  height:3px;
  margin:10px 0 16px;
  border:0;
  border-radius:3px;
  background:var(--ink);
  transform:rotate(-.7deg);
}

/* ---------- 右栏便签 ---------- */

.rail{
  padding:16px 16px 18px;
  border:2px solid var(--ink);
  border-radius:10px;
  background:var(--wash);
  transform:rotate(.7deg);
}

@media (min-width:900px){
  .rail{position:sticky;top:150px}
}

.rail-h{
  margin:0;
  font-size:1.05rem;
}

.rail-links{
  display:flex;
  flex-direction:column;
  margin:0;
}

.rail-links a{
  display:block;
  min-height:40px;
  padding:9px 0;
  border-bottom:1px dashed #b8b0a0;
  color:var(--mid);
  text-decoration:none;
  font-size:.97rem;
  line-height:1.4;
}

.rail-links a:last-child{border-bottom:0}
.rail-links a:hover,
.rail-links a:focus-visible{color:var(--ink);padding-left:6px}

/* ---------- 页脚：三栏 + 居中底注 ---------- */

.foot{
  max-width:1060px;
  margin:32px auto 0;
  padding:22px 18px 30px;
  border-top:3px double var(--ink);
  display:flex;
  flex-wrap:wrap;
  gap:14px 26px;
  align-items:flex-start;
}

.foot p{margin:0}

.foot-brand{
  flex:1 1 100%;
  font-family:'Baloo 2','Comic Neue',system-ui,sans-serif;
  font-size:1.12rem;
  font-weight:700;
  transform:rotate(-.6deg);
}

.foot-col{
  flex:1 1 140px;
  display:flex;
  flex-direction:column;
}

.foot-col a{
  display:block;
  min-height:40px;
  padding:8px 0;
  color:var(--mid);
  text-decoration:none;
  font-size:.97rem;
  line-height:1.4;
}

.foot-col a:hover,
.foot-col a:focus-visible{color:var(--ink);text-decoration:underline}

.foot small{
  flex:1 1 100%;
  padding-top:12px;
  border-top:1px dashed var(--line);
  text-align:center;
  color:var(--mid);
  font-size:.95rem;
}

/* ---------- 回到顶部 ---------- */

.totop{
  position:fixed;
  right:14px;
  bottom:14px;
  z-index:40;
  min-height:44px;
  padding:11px 16px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--ink);
  color:var(--paper);
  font:inherit;
  font-size:.95rem;
  cursor:pointer;
  opacity:0;
  pointer-events:none;
  transform:rotate(-3deg);
  transition:opacity 110ms linear;
}

.totop.on{opacity:1;pointer-events:auto}

/* ---------- 入场 ---------- */

.rv{
  opacity:0;
  transform:translateY(10px) rotate(-.35deg);
}

.rv.in{
  opacity:1;
  transform:none;
  transition:opacity 150ms linear,transform 160ms ease-out;
}

/* ---------- 小屏 ---------- */

@media (max-width:600px){
  body{font-size:17px}

  .hero{
    min-height:0;
    align-items:flex-start;
    gap:12px;
    padding-top:4px;
  }

  .hero-art{
    flex:0 0 38%;
    max-width:132px;
    box-shadow:4px 4px 0 var(--ink);
  }

  .finder{flex:1 1 100%}

  .sheet{padding:18px 14px 22px}

  main div > article{scroll-margin-top:24px}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}

  .rv{opacity:1;transform:none}

  .rv.in,
  .pill,
  .totop{transition:none}
}

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