/* 饥荒攻略百科 — structure only.
   Every colour, font, corner shape and decoration comes from design tokens (CSS variables) that are generated
   into theme.css from baike/site/themes/<skin>.toml. Do not write literal colours here: add a token instead.
   Hand-drawn feel: asymmetric "wobbly ink" radii (--wob/--wob2), paper grain (--grain), slight tilts (--tilt). */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0; color: var(--ink); font: 15px/1.8 var(--sans);
  background: radial-gradient(ellipse 80% 50% at 50% 0, var(--glow), transparent 70%), var(--grain), var(--bg);
  background-attachment: fixed;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline wavy; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .86em; background: var(--paper2); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--paper2); padding: 12px; border-radius: var(--radius); overflow: auto; border: 1.5px dashed var(--soft); }
pre code { background: none; padding: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1, h2, h3 { font-family: var(--fun); line-height: 1.3; font-weight: 400; letter-spacing: .02em; }
h2 { font-size: 1.45rem; margin: 1.7em 0 .6em; padding-bottom: .15em; position: relative; }
h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; background: var(--accent); opacity: .7;
  -webkit-mask: var(--rule) repeat-x; mask: var(--rule) repeat-x; }
h3 { font-size: 1.15rem; color: var(--ink2); }
.emblem::before { content: var(--emblem); }
button { font: inherit; }

/* ---------------- header: ink band with a skin-specific bottom edge */
.top { color: var(--head-ink); position: sticky; top: 0; z-index: 10; padding-bottom: 6px; }
/* the band is a masked pseudo-element, so dropdowns (search results, skin picker) are not clipped by the mask */
.top::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--head-bg);
  -webkit-mask: linear-gradient(#000 calc(100% - 8px), transparent 0), var(--edge) bottom / 60px 8px repeat-x;
          mask: linear-gradient(#000 calc(100% - 8px), transparent 0), var(--edge) bottom / 60px 8px repeat-x; }
.top-in { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 6px; }
.logo { display: flex; align-items: center; gap: 9px; font: 1.35rem var(--fun); color: var(--head-ink); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo img { width: 42px; height: 42px; transition: transform .3s; }
.logo:hover img { transform: rotate(-8deg) scale(1.06); }
.search { flex: 1; position: relative; min-width: 0; }
.search input { width: 100%; padding: 8px 14px; border: var(--bw) solid var(--head-line); border-radius: var(--wob); background: var(--head-field); color: var(--head-ink); font: inherit; outline: none; }
.search input:focus { border-color: var(--head-accent); }
.search input::placeholder { color: var(--head-muted); opacity: .75; }
.filter input { width: 100%; padding: 8px 14px; border: var(--bw) solid var(--line); border-radius: var(--wob); background: var(--paper); color: var(--ink); font: inherit; }
.qr { position: absolute; left: 0; right: 0; top: 46px; background: var(--paper); color: var(--ink); border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
.qr a { display: flex; gap: 10px; align-items: center; padding: 6px 10px; color: var(--ink); }
.qr a:hover, .qr a.on { background: var(--paper2); text-decoration: none; }
.qr img { width: 30px; height: 30px; object-fit: contain; }
.qr small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.ver { font-size: .8rem; color: var(--head-muted); white-space: nowrap; border: 1.5px dashed var(--head-line); padding: 1px 8px; border-radius: 999px; }
.ver b { color: var(--head-accent); }
.hbtn { border: var(--bw) solid var(--head-line); background: var(--head-field); color: var(--head-accent); border-radius: 50%; width: 36px; height: 36px; flex: none; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; transition: transform .2s; }
.hbtn:hover { transform: rotate(-12deg) scale(1.08); border-color: var(--head-accent); }
.skinbox { position: relative; flex: none; }
.skins { position: absolute; right: 0; top: 44px; min-width: 190px; background: var(--paper); color: var(--ink); border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.skins b { display: block; font: 1rem var(--fun); padding: 2px 8px 4px; color: var(--ink2); }
.skins button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); padding: 5px 8px; border-radius: var(--radius); cursor: pointer; }
.skins button:hover { background: var(--paper2); }
.skins button[aria-pressed="true"] { outline: var(--bw) dashed var(--accent); }
.skins small { color: var(--muted); margin-left: auto; font-size: .72rem; }
.cats { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a { padding: 2px 11px; border-radius: 999px; color: var(--head-muted); white-space: nowrap; font-size: .92rem; }
.cats a:hover { background: var(--head-hover); color: var(--head-accent); text-decoration: none; }

/* ---------------- home */
.hero { padding: 38px 0 14px; text-align: center; }
.hero h1 { font-size: 2.7rem; margin: 0 0 .1em; }
.hero h1 .flame { display: inline-block; animation: flicker 2.6s infinite ease-in-out; }
@keyframes flicker { 0%, 100% { transform: rotate(-3deg) scale(1); } 50% { transform: rotate(3deg) scale(1.08); } }
.hero p { margin: .3em 0; color: var(--ink2); }
.hero-meta { font-size: .9rem; }
.hero-act { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; font: 1.05rem var(--fun); color: var(--ink); background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob); padding: 5px 18px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .15s; }
.btn:hover { transform: rotate(calc(var(--tilt) * -1)) translateY(-2px); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--paper); }
.dyk { max-width: 760px; margin: 18px auto 0; text-align: left; background: var(--paper); border: var(--bw) dashed var(--accent); border-radius: var(--wob2); padding: 10px 16px; position: relative; }
.dyk b { font: 1.05rem var(--fun); color: var(--accent); margin-right: 6px; }
.dyk a { font-weight: 600; }
.grid { display: grid; gap: 14px; }
.cats-grid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); margin: 18px 0 8px; }
.cat-card { display: grid; grid-template-columns: 52px 1fr; gap: 2px 12px; background: var(--paper); border: var(--bw) solid var(--line);
  border-radius: var(--wob); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; }
.cat-card:nth-child(even) { border-radius: var(--wob2); }
.cat-card:hover { transform: rotate(calc(var(--tilt) * -1)) translateY(-2px); text-decoration: none; }
.cat-card:nth-child(even):hover { transform: rotate(var(--tilt)) translateY(-2px); }
.cat-ic { grid-row: span 2; width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.6rem; border-radius: 50%;
  background: var(--paper2); border: var(--bw) dashed var(--accent); transition: transform .3s; }
.cat-card:hover .cat-ic { transform: rotate(14deg) scale(1.1); }
.cat-t { font: 1.2rem var(--fun); }
.cat-t small { color: var(--muted); font: .8rem var(--sans); }
.cat-d { font-size: .8rem; color: var(--muted); line-height: 1.5; }
.cards { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.card-l { display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob2); padding: 8px 10px; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .12s; }
.card-l:nth-child(3n) { border-radius: var(--wob); }
.card-l:hover { transform: rotate(calc(var(--tilt) * -1)) scale(1.02); text-decoration: none; }
.card-l img, .card-l .noimg { grid-row: span 2; width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(1px 2px 0 var(--drop)); }
.card-l:hover img { animation: hop .45s ease; }
@keyframes hop { 40% { transform: translateY(-5px) rotate(-6deg); } 70% { transform: translateY(1px); } }
.noimg { display: grid; place-items: center; background: var(--paper2); border-radius: 50%; color: var(--muted); font-family: var(--fun); }
.card-t { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.card-s { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-l.st-stub { border-style: dashed; box-shadow: none; }
.pill { display: inline-block; font-size: .7rem; font-style: normal; padding: 0 7px; border-radius: 999px; border: 1.5px solid currentColor; margin-left: 4px; vertical-align: 1px; font-weight: 500; }
.st-published { color: var(--ok); } .st-stale { color: var(--warn); } .st-stub { color: var(--stub); } .st-draft { color: var(--muted); }
.card-l.st-published, .card-l.st-stale, .card-l.st-stub { color: var(--ink); }
.cl-list { padding-left: 1.2em; }
.cl-list li { margin: 4px 0; }
.cl-list li::marker { content: "✦ "; color: var(--accent); }

/* ---------------- category */
.pt { margin: 26px 0 4px; font-size: 2rem; }
.lead { color: var(--ink2); margin-top: 0; }
.filter { max-width: 360px; margin: 12px 0; }

/* ---------------- page */
.crumbs { font-size: .85rem; color: var(--muted); margin: 16px 0 6px; }
.ph { display: flex; gap: 16px; align-items: center; position: relative; }
.ph h1 { margin: 0; font-size: 2.3rem; }
.ph h1 small { font: 400 1rem var(--sans); color: var(--muted); margin-left: 8px; }
.ph-ic { width: 72px; height: 72px; object-fit: contain; background: var(--paper); border: var(--bw) solid var(--line); border-radius: 50%; padding: 6px; box-shadow: var(--shadow); }
.ph:hover .ph-ic { animation: hop .5s ease; }
.tags { margin-top: 4px; }
.tag { display: inline-block; font-size: .75rem; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--wob); padding: 0 9px; margin: 0 5px 3px 0; color: var(--ink2); }
.tag.alias { border-style: dashed; }
/* status "ink stamp" on stub / stale pages */
.stamp { margin-left: auto; align-self: flex-start; font: 1.05rem var(--fun); letter-spacing: .12em; padding: 2px 12px; border: 3px double currentColor; border-radius: var(--radius); transform: rotate(8deg); opacity: .75; white-space: nowrap; user-select: none; }
.stamp.st-stale { color: var(--warn); } .stamp.st-stub { color: var(--stub); } .stamp.st-gone { color: var(--red); }
/* examine quote: what the character says when inspecting this thing in game */
.quote { position: relative; margin: 14px 0 4px 34px; padding: 8px 16px; background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob); font: 1.1rem var(--fun); color: var(--ink2); box-shadow: var(--shadow-xs); display: inline-block; max-width: calc(100% - 34px); }
.quote::before { content: ""; position: absolute; left: -15px; top: 14px; width: 22px; height: 16px; background: var(--line); clip-path: polygon(100% 0, 0 55%, 100% 100%); }
.quote::after { content: ""; position: absolute; left: -10px; top: 16px; width: 18px; height: 12px; background: var(--paper); clip-path: polygon(100% 0, 0 55%, 100% 100%); }
.quote cite { display: block; font: .75rem var(--sans); color: var(--muted); font-style: normal; }
.banner { margin: 16px 0; padding: 10px 16px; border: var(--bw) solid var(--line); border-radius: var(--wob2); background: var(--paper); font-size: .9rem; box-shadow: var(--shadow-xs); }
.b-ok { border-left: 7px solid var(--ok); }
.b-stale { border-left: 7px solid var(--warn); }
.b-stub { border-left: 7px solid var(--stub); }
.banner details { margin-top: 4px; }
.layout { display: grid; grid-template-columns: 1fr 310px; gap: 26px; align-items: start; }
.infobox { grid-column: 2; grid-row: 1; background: var(--paper); border: 2.5px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 118px; }
.content { grid-column: 1; grid-row: 1; min-width: 0; }
.hero-img { background: radial-gradient(circle at 50% 70%, var(--spot), transparent 65%), var(--paper2); text-align: center; padding: 12px; border-bottom: var(--bw) solid var(--line); }
.hero-img img { max-width: 100%; max-height: 260px; object-fit: contain; filter: drop-shadow(2px 4px 0 var(--drop)); }
.ib-t { font: 1.25rem var(--fun); text-align: center; padding: 6px; background: var(--head-bg); color: var(--head-ink); }
.infobox table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.infobox th, .infobox td { padding: 5px 12px; border-top: 1.5px dashed var(--soft); text-align: left; vertical-align: top; }
.infobox th { color: var(--ink2); font-weight: 600; width: 46%; white-space: nowrap; }
.infobox td { font-weight: 600; }
.fi { display: inline-block; width: 1.5em; text-align: center; margin-right: 2px; }
.ib-f { font-size: .72rem; color: var(--muted); padding: 6px 12px; border-top: 1.5px dashed var(--soft); }
.summary { font-size: 1.05rem; background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob); padding: 10px 16px; box-shadow: var(--shadow-xs); }
.summary p { margin: .3em 0; }
.toc { margin: 14px 0; display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: .9rem; align-items: center; }
.toc b { font-family: var(--fun); font-weight: 400; }
.toc a { border: 1.5px solid var(--line); border-radius: var(--wob); padding: 0 10px; background: var(--paper); }
.toc a:hover { background: var(--paper2); text-decoration: none; }
.content table { border-collapse: collapse; margin: 10px 0; width: fit-content; max-width: 100%; display: block; overflow-x: auto; background: var(--paper); }
.content th, .content td { border: 1.5px solid var(--line); padding: 4px 12px; }
.content th { background: var(--paper2); font-weight: 600; }
.content blockquote { margin: 12px 0; padding: 4px 16px; border-left: 5px solid var(--accent2); background: var(--paper); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink2); }
.content li::marker { color: var(--accent); }
.fact { font-weight: 700; color: var(--accent); background: linear-gradient(transparent 62%, var(--mark) 0); padding: 0 1px; cursor: help; }
.wl { white-space: nowrap; }
.wl.red { color: var(--red); text-decoration: underline dotted; }
.wi { width: 22px; height: 22px; object-fit: contain; vertical-align: -6px; margin-right: 2px; }
.card { background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob2); padding: 10px 14px; margin: 10px 8px 10px 0; display: inline-block; min-width: 270px; max-width: 100%; vertical-align: top; box-shadow: var(--shadow); }
.card-h { font: 1.1rem var(--fun); margin-bottom: 4px; color: var(--accent); }
.card table { display: table; background: none; }
.card th, .card td { border: none; border-top: 1px dashed var(--soft); padding: 3px 10px 3px 0; }
.ings { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
figure.media { display: inline-block; margin: 6px 10px 6px 0; text-align: center; background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob); padding: 6px; }
figure.media img { max-width: 260px; max-height: 220px; display: block; }
figcaption { font-size: .75rem; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; background: radial-gradient(circle at 50% 70%, var(--spot), transparent 70%), var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob2); padding: 6px; text-align: center; transition: transform .15s; }
.gallery figure:nth-child(odd) { transform: rotate(calc(var(--tilt) * -.7)); }
.gallery figure:nth-child(even) { transform: rotate(calc(var(--tilt) * .7)); }
.gallery figure:hover { transform: scale(1.04); z-index: 1; }
.gallery img { width: 100%; height: 150px; object-fit: contain; }
.see { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.meta ul { padding-left: 1.2em; font-size: .9rem; }
.summary-box { background: var(--paper); border: var(--bw) solid var(--line); border-radius: var(--wob); padding: 4px 18px 12px; box-shadow: var(--shadow); }
.tbl { border-collapse: collapse; font-size: .88rem; display: block; width: fit-content; max-width: 100%; overflow-x: auto; background: var(--paper); }
.tbl td, .tbl th { border: 1.5px solid var(--line); padding: 3px 9px; }
.files { columns: 2; font-size: .82rem; }

/* ---------------- 404 */
.lost { text-align: center; padding: 60px 0 30px; }
.lost .eyes { font-size: 4.2rem; letter-spacing: .3em; animation: blink 4s infinite; display: inline-block; }
@keyframes blink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.08); } }
.lost h1 { font-size: 2.4rem; margin: .2em 0; }
.lost p { color: var(--ink2); }

/* ---------------- footer + floating */
.foot { margin-top: 48px; padding: 18px 16px 26px; font-size: .84rem; color: var(--ink2); text-align: center; border-top: var(--bw) dashed var(--soft); }
.foot .sponsor { font: 1.05rem var(--fun); color: var(--accent); margin: 0 0 4px; }
.foot .sponsor b { font-weight: 400; color: var(--ink); background: linear-gradient(transparent 60%, var(--mark) 0); }
.foot p { margin: .25em 0; }
.totop { position: fixed; right: 18px; bottom: 18px; width: 42px; height: 42px; border-radius: 50%; border: var(--bw) solid var(--line); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); cursor: pointer; font-size: 1.1rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9; }
.totop.on { opacity: 1; pointer-events: auto; }
.totop:hover { transform: translateY(-3px) rotate(-8deg); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .infobox { grid-column: 1; grid-row: 1; position: static; }
  .content { grid-column: 1; grid-row: 2; }
  .ver { display: none; }
  .files { columns: 1; }
  .stamp { display: none; }
}
@media (max-width: 520px) {
  .logo span { display: none; }
  .hero h1 { font-size: 2rem; }
  .ph h1 { font-size: 1.6rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { min-width: 0; width: 100%; }
  .quote { margin-left: 18px; max-width: calc(100% - 18px); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
