/* Chinese Minecraft Wiki-style — Gravestone Dungeons */

:root {
  --bg: #eaecf0;
  --page: #ffffff;
  --sidebar: #f6f7f9;
  --line: #a2a9b1;
  --line-soft: #c8ccd1;
  --ink: #202122;
  --ink-2: #54595d;
  --muted: #72777d;
  --link: #0645ad;
  --link-hover: #0b0080;
  --visited: #0b0080;
  --accent: #36c;
  --header: #fff;
  --infobox-bg: #f8f9fa;
  --table-head: #eaecf0;
  --note-bg: #fdf3d0;
  --note-border: #d4a017;
  --warn-bg: #fdf2f2;
  --warn-border: #b32424;
  --easy: #2e7d32;
  --mid: #b8860b;
  --hard: #b32424;
  --hc: #6a1b9a;
  --gold: #8a6d00;
  --font: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Cascadia Code", ui-monospace, Consolas, monospace;
  --sidebar-w: 176px;
  --content-max: 960px;
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; overflow-anchor: none; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--visited); }

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: #f8f9fa;
  padding: 0 0.25em;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}

/* —— Top bar —— */
.wiki-header {
  background: var(--header);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.wiki-header .inner {
  max-width: calc(var(--sidebar-w) + var(--content-max) + 40px);
  margin: 0 auto;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.wiki-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.wiki-logo span { color: #54595d; font-weight: 500; font-size: 0.85rem; margin-left: 0.35rem; }
.wiki-logo:hover { text-decoration: none; }

.wiki-search {
  margin-left: auto;
  position: relative;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.wiki-search input {
  width: min(220px, 36vw);
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
  color: var(--ink);
}

.wiki-search button {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f8f9fa;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink);
}

.wiki-search button:hover { background: #eaecf0; }

.toc-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #f8f9fa;
  border-radius: 2px;
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
  cursor: pointer;
}

/* —— Shell —— */
.wiki-shell {
  max-width: calc(var(--sidebar-w) + var(--content-max) + 40px);
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

/* —— Sidebar (MediaWiki-like) —— */
.wiki-sidebar {
  background: var(--sidebar);
  border: 1px solid var(--line-soft);
  border-right: none;
  padding: 0.75rem 0.65rem 1rem;
  position: sticky;
  top: 3.1rem;
  max-height: calc(100vh - 3.6rem);
  overflow: auto;
  font-size: 0.84rem;
}

.wiki-sidebar .sb-title {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.55rem 0 0.25rem;
  padding-left: 0.25rem;
  letter-spacing: 0.02em;
}

.wiki-sidebar .sb-title:first-child { margin-top: 0; }

.wiki-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-sidebar li { margin: 0.05rem 0; }

.wiki-sidebar a {
  display: block;
  padding: 0.18rem 0.3rem;
  color: var(--link);
  border-radius: 2px;
}

.wiki-sidebar a:hover { background: #eaf3ff; text-decoration: none; }
.wiki-sidebar a.active { background: #d9e6f7; font-weight: 600; }
.wiki-sidebar a.dimmed { opacity: 0.45; }

/* —— Content —— */
.wiki-content {
  background: var(--page);
  border: 1px solid var(--line-soft);
  min-width: 0;
  padding: 1rem 1.25rem 1.5rem;
}

.breadcrumbs {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.breadcrumbs a { color: var(--link); }

/* Article header */
.article-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
}

.article-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink);
}

.article-header .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* Hatnote */
.hatnote {
  font-size: 0.88rem;
  color: var(--ink-2);
  font-style: italic;
  margin: 0.4rem 0 0.75rem;
  padding-left: 1.2em;
}

/* TOC box */
.toc-box {
  display: table;
  background: var(--infobox-bg);
  border: 1px solid var(--line);
  padding: 0.55rem 0.85rem;
  margin: 0.65rem 0 1rem;
  font-size: 0.88rem;
  max-width: 320px;
}

.toc-box .toc-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
}

.toc-box ol {
  margin: 0;
  padding-left: 1.25rem;
}

.toc-box li { margin: 0.1rem 0; }

.toc-box .toc-num { color: var(--muted); margin-right: 0.25rem; }

/* Sections — wiki article blocks */
.article {
  margin: 1.25rem 0 1.75rem;
  padding-top: 0.25rem;
  scroll-margin-top: 3.5rem;
}

.article h1,
.article h2,
.article h3 {
  scroll-margin-top: 4.2rem;
}

.article + .article {
  border-top: 1px solid var(--line-soft);
  padding-top: 0.75rem;
}

.article > h2 {
  margin: 0 0 0.55rem;
  font-size: 1.35rem;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  clear: both;
}

.article h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.15rem;
}

.article h4 {
  margin: 0.75rem 0 0.3rem;
  font-size: 0.98rem;
  font-weight: 700;
}

.article p { margin: 0.4rem 0; }

.article ul.bullets, .article ol.numbered {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1.5rem;
}

.article ul.bullets li, .article ol.numbered li { margin: 0.15rem 0; }


/* Infobox float layout fixes — prevent content boxes overlapping the float */
.article::after {
  content: "";
  display: table;
  clear: both;
}
.infobox {
  float: right;
  width: min(300px, 100%);
  margin: 0 0 0.85rem 1rem;
  border: 1px solid var(--line);
  background: var(--infobox-bg);
  font-size: 0.84rem;
  line-height: 1.45;
  clear: right;
  position: relative;
  z-index: 1;
}
.infobox .ib-title {
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  font-weight: 700;
  text-align: center;
  font-size: 0.95rem;
}
.infobox .ib-img {
  text-align: center;
  padding: 0.55rem;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.infobox .ib-img img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 150px;
  object-fit: contain;
  image-rendering: pixelated;
  display: inline-block;
  vertical-align: middle;
}
.infobox table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.infobox td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.infobox tr:last-child td { border-bottom: none; }
.infobox td.k {
  width: 36%;
  color: var(--muted);
  font-weight: 600;
}
.infobox td.v { color: var(--ink); }
.infobox td.v code {
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

/* Headings and structured blocks sit below the float, not under it */
.article > h3,
.article > .steps,
.article > .wiki-table-wrap,
.article > .dialogue,
.article > .shot-grid,
.article > .clear {
  clear: both;
}
.article > p { overflow-wrap: break-word; }

.steps {
  clear: both;
  counter-reset: step;
  list-style: none;
  margin: 0.55rem 0;
  padding: 0;
  overflow: hidden;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.45rem 0.55rem 0.45rem 2.4rem;
  margin: 0.35rem 0;
  border: 1px solid var(--line-soft);
  background: #fff;
  overflow-wrap: break-word;
}
.steps li .detail { overflow-wrap: break-word; }

.clear { clear: both; }

/* Notes */
.note, .warning {
  margin: 0.65rem 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  border-left: 4px solid;
}

.note {
  background: var(--note-bg);
  border-color: var(--note-border);
}

.warning {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

/* Tables — wiki style */
.wiki-table-wrap { overflow-x: auto; margin: 0.5rem 0; }

table.wiki {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #fff;
}

table.wiki th,
table.wiki td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

table.wiki th {
  background: var(--table-head);
  font-weight: 700;
}

table.wiki tr:hover td { background: #f8f9fa; }

table.wiki td.imgs img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  vertical-align: -4px;
  margin-right: 2px;
}

table.craft {
  border-collapse: collapse;
  display: inline-table;
}

table.craft td {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #f0f0f0;
  padding: 2px;
  text-align: center;
  vertical-align: middle;
}

table.craft img {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
}

/* Status colors */
.d-easy { color: var(--easy); font-weight: 600; }
.d-mid { color: var(--mid); font-weight: 600; }
.d-hard { color: var(--hard); font-weight: 600; }
.d-hc { color: var(--hc); font-weight: 600; }

.mc-blue { color: #5555ff; }
.mc-red { color: #aa0000; }
.mc-green { color: #00aa00; }
.mc-purple { color: #aa00aa; }
.mc-gold { color: #8a6d00; }
.mc-gray { color: var(--muted); }

/* Item rows */
.item-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--line-soft);
}

.item-row:last-child { border-bottom: none; }

.item-row img.pixel {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  object-fit: contain;
  background: #f0f0f0;
  border: 1px solid var(--line-soft);
}

.item-row .name { font-weight: 700; }
.item-row .desc { font-size: 0.88rem; color: var(--ink-2); }
.item-row .desc li { list-style: none; margin: 0.1rem 0; }

.icon {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  vertical-align: -3px;
  margin-right: 2px;
}

/* Mini grid */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.4rem;
  margin: 0.45rem 0;
}

.mini-item {
  border: 1px solid var(--line-soft);
  background: #fff;
  padding: 0.4rem 0.55rem;
  font-size: 0.86rem;
}

.mini-item .t { font-weight: 700; }
.mini-item .d { color: var(--muted); font-size: 0.8rem; }

/* Adv grid */
.adv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem;
  margin: 0.4rem 0;
}

.adv-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line-soft);
  font-size: 0.84rem;
  background: #fff;
}

.adv-item img {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
}

.adv-item .t { font-weight: 600; }
.adv-item .d { color: var(--muted); font-size: 0.78rem; }

/* Craft row */
.craft-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.craft-row:last-child { border-bottom: none; }

.craft-row .result {
  font-weight: 700;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.craft-row .effect { flex: 1; min-width: 120px; font-size: 0.9rem; color: var(--ink-2); }

.craft-arrow { color: var(--ink-2); }

/* Spoiler details */
details.spoiler {
  margin: 0.45rem 0;
  border: 1px solid var(--line-soft);
  background: #f8f9fa;
}

details.spoiler summary {
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  font-size: 0.88rem;
  color: var(--link);
  list-style: none;
}

details.spoiler summary::before { content: "[展开] "; font-weight: 600; }
details.spoiler[open] summary::before { content: "[收起] "; }

details.spoiler .inner {
  padding: 0 0.75rem 0.65rem;
  font-size: 0.88rem;
}

/* Step list for summon */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.45rem 0.55rem 0.45rem 2.4rem;
  margin: 0.35rem 0;
  border: 1px solid var(--line-soft);
  background: #fff;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.45rem;
  top: 0.45rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--table-head);
  border: 1px solid var(--line);
  text-align: center;
  line-height: 1.45rem;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink);
}

.steps li strong { display: block; margin-bottom: 0.15rem; }
.steps li .detail { font-size: 0.88rem; color: var(--ink-2); }

/* Dialogue */
.dialogue {
  margin: 0.45rem 0;
  padding: 0.55rem 0.75rem;
  background: #f8f9fa;
  border-left: 3px solid var(--line);
  font-size: 0.9rem;
}

.dialogue .who { font-weight: 700; }
.dialogue .who.morbex { color: #6f0c99; }
.dialogue .who.player { color: var(--ink-2); font-weight: 600; }
.dialogue .line { margin: 0.2rem 0; }

/* Category footer */
.categories {
  margin-top: 1.5rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.82rem;
  color: var(--muted);
}

.categories a { margin-right: 0.35rem; }

/* Site footer */
.wiki-footer {
  max-width: calc(var(--sidebar-w) + var(--content-max) + 40px);
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* Image cards for structures */
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.55rem;
  margin: 0.55rem 0;
}

.shot-card {
  border: 1px solid var(--line-soft);
  background: #fff;
  font-size: 0.86rem;
}

.shot-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--line-soft);
  background: #ddd;
}

.shot-card .cap { padding: 0.4rem 0.5rem; }
.shot-card .cap .t { font-weight: 700; }
.shot-card .cap .s { color: var(--muted); font-size: 0.78rem; }

/* Responsive */
@media (max-width: 800px) {
  .wiki-shell {
    grid-template-columns: 1fr;
    padding: 0.5rem 0.55rem 1.5rem;
  }

  .wiki-sidebar {
    position: relative;
    top: 0;
    max-height: none;
    border-right: 1px solid var(--line-soft);
    border-bottom: none;
  }

  .wiki-sidebar.collapsed ul { display: none; }

  .toc-toggle { display: inline-block; }

  .wiki-content { padding: 0.75rem 0.75rem 1.25rem; }

  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 0.75rem;
  }

  .article-header h1 { font-size: 1.45rem; }

  .toc-box { max-width: 100%; }
}

/* Search — prevent scroll jump while filtering */
body {
  overflow-anchor: none;
}

html.searching {
  scroll-behavior: auto !important;
}

body.search-lock {
  overflow-anchor: none;
}

main.wiki-content {
  overflow-anchor: none;
}

article.article {
  overflow-anchor: none;
}

.search-panel {
  position: fixed;
  max-height: min(64vh, 540px);
  overflow: auto;
  margin: 0;
  padding: 0.6rem 0.8rem 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  z-index: 60;
}

.search-panel .sr-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.search-panel .sr-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.search-panel .sr-clear {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 2px;
  padding: 0.2rem 0.55rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ink);
}

.search-panel .sr-clear:hover { background: #eaecf0; }

.search-panel .sr-hint {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.search-panel .sr-list {
  margin: 0;
  padding-left: 1.4rem;
  max-height: 240px;
  overflow: auto;
  font-size: 0.92rem;
}

.search-panel .sr-list li {
  margin: 0.2rem 0;
}

.search-panel .sr-list a {
  color: var(--link);
  font-weight: 600;
}

.search-panel .sr-list .sr-snip {
  margin: 0.1rem 0 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.search-panel .sr-list li {
  margin: 0.25rem 0;
  padding-bottom: 0.15rem;
  border-bottom: 1px dashed var(--line-soft);
}

.search-panel .sr-list li:last-child { border-bottom: none; }

.search-empty {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--warn-bg);
  color: var(--ink);
  font-size: 0.9rem;
}

.search-hit {
  background: #ffeaa0;
}

.search-panel mark {
  background: #fff3a0;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.search-panel .sr-snip mark {
  background: #ffe066;
}

/* 正文搜索高亮 */
mark.search-mark {
  background: #ffd54d;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  scroll-margin-top: 4.5rem;
  scroll-margin-bottom: 4.5rem;
}

/* 键盘/交互态 */
.search-panel .sr-list a:focus {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

#searchBox {
  min-width: 220px;
}

.hidden-by-search {
  display: none !important;
}

/* 搜索历史 */
.sr-history {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.sr-history .hist-tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  font-size: 0.8rem;
  background: #f8f9fa;
  color: var(--ink);
  cursor: pointer;
}

.sr-history .hist-tag:hover {
  background: var(--link);
  color: #fff;
  border-color: var(--link);
}

.sr-head .hist-clear {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
}

.sr-head .hist-clear:hover { color: var(--link); }

/* 移动端：浮层左对齐、占满可用宽 */


/* back to hub */
.back-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line-soft);
}
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  background: var(--link);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}
.back-home:hover {
  background: var(--link-hover);
  color: #fff;
  text-decoration: none;
}
.back-hub {
  font-size: 0.82rem;
  color: var(--muted);
}
.hub-logo-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
}

/* tables: full display on narrow/wiki content */
.wiki-content { overflow-x: clip; }

.wiki-table-wrap {
  overflow-x: auto;
  margin: 0.65rem 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table.wiki {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  table-layout: fixed;
}

table.wiki th,
table.wiki td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

table.wiki th {
  background: var(--table-head);
  font-weight: 700;
}

table.wiki code {
  font-size: 0.72rem;
  word-break: break-all;
  white-space: normal;
  display: inline;
}

/* stacked name+id cell */
.cell-stack { display: flex; flex-direction: column; gap: 0.15rem; }
.cell-stack .id-line {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  word-break: break-all;
}


/* back to hub — force readable contrast, ignore visited purple */
.back-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line-soft);
}

a.back-home,
a.back-home:link,
a.back-home:visited,
a.back-home:hover,
a.back-home:focus,
a.back-home:active {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  text-decoration: none !important;
  /* high contrast: near-black pill + pure white label */
  background: #1b1b1b !important;
  color: #ffffff !important;
  border: 1px solid #3a3a3a !important;
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
  cursor: pointer;
}

a.back-home:hover,
a.back-home:focus {
  background: #2e2e2e !important;
  color: #ffffff !important;
  border-color: #555 !important;
}

a.back-home:active {
  background: #111111 !important;
  color: #ffffff !important;
}

.back-hub {
  font-size: 0.82rem;
  color: var(--muted);
}

.hub-logo-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
}

/* ===== MC-wiki style crafting stations ===== */
.craft-block {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1.25rem;
  margin: 0.75rem 0 1.1rem;
  padding: 0.85rem 1rem;
  background: var(--infobox-bg, #f8f9fa);
  border: 1px solid var(--line, #a2a9b1);
  border-radius: 8px;
}
.craft-name { font-weight: 700; margin-bottom: 0.35rem; width: 100%; }
.craft-station {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2, #54595d);
  margin-bottom: 0.45rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #eaecf0;
  border: 1px solid var(--line, #c8ccd1);
}
.craft-station .st-ico {
  width: 18px; height: 18px;
  image-rendering: pixelated;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}
.craft-table-wrap { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.craft-meta { flex: 1; min-width: 200px; font-size: 0.85rem; color: var(--ink-2, #54595d); }
.craft-note { font-size: 0.88rem; color: var(--ink-2, #54595d); margin: 0.4rem 0 0.8rem; }
.craft-grid { display: none !important; }

.slot-ico {
  width: 40px; height: 40px;
  background: #8b8b8b;
  border: 2px solid #555;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #373737;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.slot-ico img {
  width: 32px; height: 32px;
  image-rendering: pixelated;
  display: block;
  object-fit: contain;
}
.craft-arrow {
  font-size: 1.6rem; font-weight: 700;
  color: var(--ink-2, #54595d); line-height: 1;
}
.craft-result {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.25rem; min-width: 88px; text-align: center;
  font-weight: 600; font-size: 0.86rem;
}
.craft-result .slot {
  width: 48px; height: 48px;
  background: #8b8b8b; border: 2px solid #555;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #373737;
  display: flex; align-items: center; justify-content: center;
}
.craft-result .slot img {
  width: 36px; height: 36px;
  image-rendering: pixelated;
  object-fit: contain;
}

/* multi outputs right of arrow */
.out-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.out-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  min-width: 52px;
}
.out-item .cnt {
  color: var(--ink-2, #54595d);
  font-weight: 700;
}

/* --- Crafting table 3x3 --- */
.station-crafting table.craft-3 {
  border-collapse: collapse;
  background: #c6c6c6;
  border: 2px solid #555;
  table-layout: fixed;
}
.station-crafting table.craft-3 td {
  width: 40px; height: 40px;
  border: 1px solid #777;
  background: #8b8b8b;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #373737;
  text-align: center; vertical-align: middle; padding: 0;
}
.station-crafting table.craft-3 img {
  width: 32px; height: 32px;
  image-rendering: pixelated;
  display: block; margin: 0 auto;
  object-fit: contain;
}

/* --- Furnace family --- */
.station-furnace .furnace-box,
.station-blast .furnace-box,
.station-smoker .furnace-box {
  display: grid;
  grid-template-columns: 48px 28px 18px auto;
  grid-template-rows: 48px 48px;
  gap: 4px 6px;
  align-items: center;
  background: #c6c6c6;
  border: 2px solid #555;
  padding: 8px;
  border-radius: 4px;
}
.furnace-box .f-input { grid-column: 1; grid-row: 1; }
.furnace-box .f-fuel { grid-column: 1; grid-row: 2; }
.furnace-box .f-fire {
  grid-column: 2; grid-row: 2;
  width: 22px; height: 22px;
  image-rendering: pixelated;
  object-fit: contain;
}
.furnace-box .f-arrow {
  grid-column: 3; grid-row: 1 / span 2;
  font-size: 1.35rem; color: #333; font-weight: 700;
  text-align: center;
}
.furnace-box .f-out { grid-column: 4; grid-row: 1 / span 2; }

/* --- Stonecutter: input | saw | → | outputs --- */
.station-stonecutter .stone-box {
  display: flex; align-items: center; gap: 8px;
  background: #c6c6c6; border: 2px solid #555;
  padding: 10px 12px; border-radius: 4px;
}
.stone-box .sc-blade {
  width: 28px; height: 36px;
  image-rendering: pixelated;
  object-fit: contain;
}

/* --- Smithing table --- */
.station-smithing .smith-box {
  display: grid;
  grid-template-columns: 48px 48px 48px 20px auto;
  grid-template-rows: 48px 48px;
  gap: 6px 8px;
  background: #3d3a36;
  border: 2px solid #222;
  padding: 10px 12px;
  border-radius: 4px;
  align-items: center;
}
.smith-box .s-template { grid-column: 1; grid-row: 1; }
.smith-box .s-base { grid-column: 2; grid-row: 1 / span 2; }
.smith-box .s-add { grid-column: 3; grid-row: 1 / span 2; }
.smith-box .s-arrow {
  grid-column: 4; grid-row: 1 / span 2;
  color: #ddd; font-weight: 700; text-align: center; font-size: 1.2rem;
}
.smith-box .s-out { grid-column: 5; grid-row: 1 / span 2; }
.smith-box .slot-ico {
  background: #1e1c1a;
  border-color: #666;
  box-shadow: inset 1px 1px 0 #555, inset -1px -1px 0 #000;
}

/* --- Campfire --- */
.station-campfire .camp-box {
  display: flex; align-items: center; gap: 8px;
  background: #c6c6c6; border: 2px solid #555;
  padding: 10px 12px; border-radius: 4px;
}
.camp-box .c-fire { width: 28px; height: 28px; image-rendering: pixelated; object-fit: contain; }

.craft-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: #eaf3ff;
  color: #3366cc;
  border: 1px solid #a2a9d0;
  margin-left: 0.35rem;
  font-weight: 600;
  vertical-align: middle;
}

/* Back-home pinned to top of sidebar */
.sb-top {
  margin: 0 0 0.65rem;
}
.wiki-sidebar .sb-top .back-home {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}
.wiki-sidebar .sb-title {
  margin-top: 0;
}

/* —— Sidebar sticky fix (TOC stays visible on long pages) —— */
.wiki-shell {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.wiki-sidebar {
  position: sticky;
  top: 3.1rem;
  align-self: flex-start;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  max-height: calc(100vh - 3.6rem);
  height: fit-content;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 5;
}
.wiki-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: clip;
}
.wiki-shell > .wiki-content { width: auto; }
/* group titles in long TOC */
.wiki-sidebar .sb-title {
  margin-top: 0.85rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.55rem;
}
.wiki-sidebar .sb-title:first-of-type {
  margin-top: 0.35rem;
  border-top: none;
  padding-top: 0;
}
@media (max-width: 800px) {
  .wiki-shell { display: block; }
  .wiki-sidebar {
    width: auto;
    flex: none;
    position: sticky;
    top: 3.1rem;
    max-height: 45vh;
    z-index: 30;
  }
}

.wiki-header .inner .site-home,

.wiki-header .site-home {
  display: inline-flex !important;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.3rem 0.75rem !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #f0c85a, #c49220) !important;
  color: #1a1a1a !important;
  font-weight: 800 !important;
  font-size: 0.84rem !important;
  text-decoration: none !important;
  border: 1px solid #f0d78c !important;
  box-shadow: 0 1px 0 #8a6514 !important;
  white-space: nowrap;
}
.wiki-header .site-home:link, .wiki-header .site-home:visited,
.wiki-header .site-home:hover, .wiki-header .site-home:active,
.wiki-header .site-home:focus {
  color: #1a1a1a !important;
  text-decoration: none !important;
}
.wiki-header .site-home:hover { filter: brightness(1.1); }

/* 返回官网 — header pill */
.wiki-header .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.wiki-header .site-home {
  display: inline-flex !important;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0.35rem 0 0.5rem;
  padding: 0.35rem 0.9rem !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #f0c85a 0%, #e0b13a 45%, #c49220 100%) !important;
  color: #1a1a1a !important;
  font-weight: 800 !important;
  font-size: 0.88rem !important;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  border: 1px solid #f6e3a8 !important;
  box-shadow: 0 2px 0 #8a6514, 0 4px 12px rgba(224, 177, 58, 0.35) !important;
  white-space: nowrap;
  flex: 0 0 auto;
}
.wiki-header .site-home:link,
.wiki-header .site-home:visited,
.wiki-header .site-home:hover,
.wiki-header .site-home:active,
.wiki-header .site-home:focus {
  color: #1a1a1a !important;
  text-decoration: none !important;
}
.wiki-header .site-home:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
@media (max-width: 640px) {
  .wiki-header .site-home { padding: 0.28rem 0.6rem !important; font-size: 0.78rem !important; }
}

/* ===== site-home (返回官网) + visited link fix ===== */
.wiki-header .inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; }
.wiki-header a.site-home,
.wiki-header .site-home {
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  padding: 0.35rem 0.95rem !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #f0c85a 0%, #e0b13a 50%, #c49220 100%) !important;
  color: #1a1a1a !important;
  font-weight: 800 !important;
  font-size: 0.9rem !important;
  text-decoration: none !important;
  border: 1px solid #f6e3a8 !important;
  box-shadow: 0 2px 0 #8a6514, 0 4px 14px rgba(224, 177, 58, 0.35) !important;
  white-space: nowrap;
}
.wiki-header a.site-home:link,
.wiki-header a.site-home:visited,
.wiki-header a.site-home:hover,
.wiki-header a.site-home:active,
.wiki-header .site-home:link,
.wiki-header .site-home:visited,
.wiki-header .site-home:hover,
.wiki-header .site-home:active {
  color: #1a1a1a !important;
  text-decoration: none !important;
  background: linear-gradient(180deg, #f0c85a 0%, #e0b13a 50%, #c49220 100%) !important;
}
.wiki-header .site-home:hover { filter: brightness(1.08); }

/* anti-purple: keep link colors after visit */
a, a:link, a:visited { color: var(--link, #0645ad); }
a:hover { text-decoration: underline; }
.wiki-header .wiki-logo,
.wiki-header .wiki-logo:visited { color: inherit !important; text-decoration: none !important; }
.wiki-sidebar a, .wiki-sidebar a:visited { color: var(--link, #0645ad); text-decoration: none; }
.bullets a, .breadcrumbs a, .categories a, .wiki-table-wrap a {
  color: var(--link, #0645ad);
}
.bullets a:visited, .breadcrumbs a:visited, .categories a:visited, .wiki-table-wrap a:visited {
  color: var(--link, #0645ad);
}
.hub-card, .hub-card:link, .hub-card:visited {
  color: inherit !important;
  text-decoration: none !important;
}
.hub-card .hub-go, .hub-card .hub-go:visited { color: var(--link, #0645ad) !important; }
.hub-grid a, .hub-grid a:visited { color: inherit; }
.back-home, .back-home:visited {
  color: #fff !important;
  text-decoration: none !important;
}
.qq-link:visited, .qq-chip:visited { color: #fff !important; }

/* ===== mobile wiki ===== */
@media (max-width: 800px) {
  .wiki-shell { display: block; }
  .wiki-sidebar {
    position: sticky; top: 0; z-index: 30;
    width: auto !important; flex: none !important;
    max-height: 42vh; margin-bottom: 0.5rem;
    border-right: none; border-bottom: 1px solid var(--line-soft);
  }
  .wiki-content { padding: 0.65rem 0.7rem 1.25rem; }
  .wiki-header .inner { padding: 0.45rem 0.7rem; gap: 0.35rem 0.5rem; }
  .wiki-header .site-home {
    margin-left: 0.2rem !important;
    padding: 0.28rem 0.55rem !important;
    font-size: 0.75rem !important;
  }
  .article-header h1 { font-size: 1.25rem; }
  .infobox { float: none !important; width: 100% !important; margin: 0 0 0.75rem !important; }
  .wiki-table-wrap { overflow-x: auto; }
  .wiki-table-wrap table { min-width: 520px; }
  .shot-grid, .hub-grid, .cards, .mini-grid { grid-template-columns: 1fr; }
  .qq-banner { flex-direction: column; align-items: stretch; text-align: center; }
  .qq-link { width: 100%; text-align: center; }
  table.craft-3 td { width: 34px; height: 34px; }
  table.craft-3 img { width: 26px; height: 26px; }
}
@media (max-width: 480px) {
  .wiki-logo span { display: none; }
}

/* ===== sticky back-home + header safety ===== */
.wiki-header {
  position: sticky;
  top: 0;
  z-index: 50;
}
.wiki-sidebar .sb-top {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 0.55rem;
  padding: 0.25rem 0 0.35rem;
  background: var(--sidebar, #fff);
}
.wiki-sidebar .sb-top .back-home {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}
@media (max-width: 720px) {
  .wiki-header {
    position: sticky;
    top: 0;
    z-index: 60;
  }
  .wiki-sidebar {
    position: sticky;
    top: 3.2rem;
    z-index: 40;
    max-height: 38vh;
    overflow-y: auto;
  }
  .wiki-sidebar .sb-top {
    top: 0;
    background: var(--sidebar, #fff);
    box-shadow: 0 1px 0 var(--line-soft, #e0e0e0);
  }
}

/* collapsed sidebar: hide titles + lists, keep back-home */
.wiki-sidebar.collapsed .sb-title,
.wiki-sidebar.collapsed ul {
  display: none !important;
}
.wiki-sidebar.collapsed {
  max-height: none;
  overflow: visible;
  border-bottom: none;
}
@media (max-width: 800px) {
  .wiki-sidebar {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .wiki-sidebar .sb-top {
    position: sticky;
    top: 3.1rem;
  }
}

/* ===== TOC button controls both sidebar and in-page toc-box ===== */
.wiki-sidebar.collapsed ol,
.wiki-sidebar.collapsed .toc-box ol,
.toc-box.collapsed ol {
  display: none !important;
}
.toc-box .toc-title {
  cursor: pointer;
  user-select: none;
}
.toc-box .toc-title::after {
  content: " ▾";
  font-size: 0.75em;
  opacity: 0.6;
}
.toc-box.collapsed .toc-title::after {
  content: " ▸";
}
.toc-box.collapsed {
  padding-bottom: 0.5rem;
}
/* mobile: start with toc-box collapsed so chapters don't stick on screen */
@media (max-width: 800px) {
  .toc-box ol { display: none; }
  .toc-box.open ol { display: block; }
  .toc-box.open .toc-title::after { content: " ▾"; }
  .toc-box:not(.open) .toc-title::after { content: " ▸"; }
}

/* ===== float nav: sticky home + collapsible TOC ===== */
.float-nav {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 200;
  display: flex;
  gap: 8px;
  align-items: center;
}
.float-nav a.float-home,
.float-nav button.float-toc {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line, #d0d7de);
  background: #fff;
  color: var(--link, #0645ad) !important;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  cursor: pointer;
  line-height: 1.2;
}
.float-nav a.float-home:link,
.float-nav a.float-home:visited,
.float-nav a.float-home:hover,
.float-nav a.float-home:focus,
.float-nav a.float-home:active { color: var(--link, #0645ad) !important; text-decoration: none !important; }
.float-nav a.float-home:hover,
.float-nav button.float-toc:hover { filter: brightness(1.05); background: #f0f6ff; }
.float-nav button.float-toc[aria-expanded="true"] { background: #d9e6f7; }
.float-toc-panel {
  position: fixed;
  top: 52px;
  right: 10px;
  z-index: 199;
  width: min(320px, calc(100vw - 20px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line, #d0d7de);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  padding: 0.6rem 0.75rem;
}
.float-toc-panel[hidden] { display: none !important; }
.float-toc-panel .ftp-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted, #666);
  margin: 0.35rem 0 0.25rem;
}
.float-toc-panel a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  color: var(--link, #0645ad) !important;
  text-decoration: none !important;
  font-size: 0.9rem;
}
.float-toc-panel a:hover { background: #eaf3ff; }
@media (max-width: 800px) {
  .float-nav { top: auto; bottom: 14px; right: 12px; }
  .float-toc-panel {
    top: auto;
    bottom: 60px;
    right: 12px;
    max-height: 55vh;
  }
}

/* ===== float-nav fix: panel above buttons; mobile hide big buttons ===== */
.float-toc-panel {
  z-index: 210 !important;
  top: 52px !important;
}
.float-nav { z-index: 205 !important; }
/* sidebar back-home must not cover TOC list */
.wiki-sidebar .sb-top {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  background: transparent !important;
}
@media (max-width: 800px) {
  .float-nav,
  .float-toc-panel {
    display: none !important;
  }
}

/* ===== desktop sidebar home pin / mobile float-only ===== */
@media (min-width: 801px) {
  .wiki-sidebar .sb-top {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    background: var(--sidebar, #f6f7f9) !important;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
  .float-nav,
  .float-toc-panel {
    display: none !important;
  }
}
@media (max-width: 800px) {
  .float-nav {
    display: flex !important;
  }
  .float-toc-panel:not([hidden]) {
    display: block !important;
  }
  .float-toc-panel[hidden] {
    display: none !important;
  }
  .toc-toggle {
    display: none !important;
  }
  .wiki-sidebar .sb-top {
    position: relative !important;
    top: auto !important;
  }
}

/* lucky blocks probability column */
.p-prob { white-space: nowrap; font-size: 0.88rem; }
.p-prob strong { color: var(--accent, #0b57d0); }
.wiki .p-prob { width: 7.5em; }
