/* MCSR RogueLike Wiki - uses site.css variables */
/* Top padding clears fixed topbar; keep in sync with .wiki-sidebar-pin-root / .wiki-toc-panel top */
.wiki-main-wrap { max-width: 1180px; margin: 0 auto; padding: 88px 16px 48px; }
.wiki-main-wrap.wiki-hub { max-width: 1240px; }
.wiki-main-wrap.wiki-doc-page { max-width: 1320px; }

.wiki-main-wrap .section { padding-left: 0; padding-right: 0; }
.wiki-doc-section { padding-top: 0; }
.wiki-breadcrumb {
  font-size: 13px; color: var(--muted); margin-bottom: 10px;
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
}
.wiki-breadcrumb a { text-decoration: none; }
.wiki-breadcrumb span.sep { opacity: 0.55; }
.wiki-hatnote {
  font-size: 13px; line-height: 1.68; color: var(--muted);
  border: 1px solid rgba(119, 219, 255, 0.18);
  border-left: 4px solid rgba(119, 219, 255, 0.45);
  background: rgba(7, 18, 26, 0.45);
  padding: 11px 14px; border-radius: 0 12px 12px 0; margin-bottom: 18px;
}
.wiki-lead {
  font-size: clamp(14px, 1.15vw, 16px); line-height: 1.85; color: var(--muted);
  margin-bottom: 18px;
}
.wiki-nav-table-wrap { overflow-x: auto; margin: 16px 0; border-radius: 12px; border: 1px solid rgba(119, 219, 255, 0.14); }
.wiki-nav-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wiki-nav-table th, .wiki-nav-table td {
  padding: 11px 13px; text-align: left;
  border-bottom: 1px solid rgba(119, 219, 255, 0.1);
  color: var(--muted); vertical-align: top; font-weight: 700;
}
.wiki-nav-table th { background: rgba(119, 219, 255, 0.08); color: var(--brand); width: 22%; }
.wiki-nav-table tr:last-child td { border-bottom: 0; }
.wiki-panel.panel-card { margin-bottom: 16px; }
.wiki-panel h2 {
  color: var(--brand); margin: 0 0 12px; font-size: clamp(17px, 1.45vw, 21px);
  padding-bottom: 8px; border-bottom: 1px solid rgba(119, 219, 255, 0.12);
  scroll-margin-top: 100px;
}
.wiki-panel h3 {
  color: var(--brand-2); margin: 18px 0 8px; font-size: 15px;
  scroll-margin-top: 100px;
}
.wiki-panel h4 { color: var(--brand-2); margin: 14px 0 6px; font-size: 14px; opacity: 0.95; }
.wiki-prose p, .wiki-prose li { color: var(--muted); line-height: 1.82; margin: 10px 0; font-weight: 700; }
.wiki-prose ul, .wiki-prose ol { margin: 8px 0 12px 1.2em; padding: 0; }
.wiki-prose li { margin: 6px 0; }
.wiki-prose strong { color: #d4f4ff; }
.wiki-note {
  border-left: 4px solid var(--brand-2);
  padding: 12px 14px; margin: 14px 0;
  border-radius: 0 10px 10px 0;
  background: rgba(111, 240, 200, 0.07);
  color: var(--muted); font-size: 14px; line-height: 1.65; font-weight: 700;
}
.wiki-note strong { color: var(--brand-2); }
/* Private-room player list legend (multiplayer wiki) — aligns with in-game formatting hints */
.wiki-pr-smp-abandon { color: #c5cdd6; font-style: italic; font-weight: 700; }
.wiki-pr-smp-time { color: #5fdf8c; font-weight: 800; letter-spacing: 0.02em; }
.wiki-pr-smp-muted { color: #ff7a7a; font-weight: 700; }
.wiki-pr-smp-blocked { color: #8b96a8; font-weight: 700; }
.wiki-table-wrap { overflow-x: auto; margin: 14px 0; border-radius: 12px; border: 1px solid rgba(119, 219, 255, 0.14); }
.wiki-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wiki-table th, .wiki-table td {
  padding: 10px 11px; text-align: left;
  border-bottom: 1px solid rgba(119, 219, 255, 0.1);
  color: var(--muted); font-weight: 700;
}
.wiki-table th { background: rgba(119, 219, 255, 0.08); color: var(--brand); }
.wiki-table tr:last-child td { border-bottom: 0; }
.wiki-table .wiki-table-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.wiki-table .wiki-table-tag .wiki-topic-icon {
  width: 22px;
  height: 22px;
}
.wiki-inline-nav { margin: 14px 0; font-size: 14px; }
.wiki-inline-nav a { margin-right: 14px; }
details.wiki-details { margin: 12px 0; border-radius: 10px; border: 1px solid rgba(119, 219, 255, 0.12); padding: 10px 14px; background: rgba(7, 18, 26, 0.35); }
details.wiki-details summary { cursor: pointer; color: var(--brand); }
details.wiki-details .wiki-prose { margin-top: 10px; }

/* ---------- Wiki ???????????? ---------- */
.wiki-hub-hero {
  position: relative;
  border-radius: var(--radius, 16px);
  padding: 28px 26px 26px;
  margin-bottom: 28px;
  background: linear-gradient(135deg, rgba(16, 42, 58, 0.92) 0%, rgba(8, 22, 36, 0.88) 100%);
  border: 1px solid rgba(119, 219, 255, 0.22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.wiki-hub-hero::before {
  content: "";
  position: absolute;
  inset: -40% 40% auto -20%;
  height: 120%;
  background: radial-gradient(ellipse, rgba(119, 219, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
}
.wiki-hub-hero .section-title-row { position: relative; z-index: 1; }
.wiki-hub-hero h1 {
  font-size: clamp(1.55rem, 3.5vw, 2.1rem);
  letter-spacing: 0.02em;
  color: var(--text);
}
.wiki-hub-lead {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  max-width: 52rem;
}
.wiki-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
@media (max-width: 520px) {
  .wiki-hub-grid { grid-template-columns: 1fr; }
}
.wiki-hub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 20px 18px;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: rgba(10, 24, 34, 0.72);
  border: 1px solid rgba(119, 219, 255, 0.16);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.wiki-hub-card:hover {
  transform: translateY(-3px);
  border-color: rgba(119, 219, 255, 0.42);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
}
.wiki-hub-card-icon {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  object-fit: contain;
  border-radius: 12px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(119, 219, 255, 0.15);
}
.wiki-hub-card-title {
  font-size: 1.15rem;
  color: var(--brand);
}
.wiki-hub-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  font-weight: 700;
}
.wiki-hub-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
@media (max-width: 900px) {
  .wiki-hub-split { grid-template-columns: 1fr; }
}
.wiki-hub-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 0 6px;
  border-top: 1px solid rgba(119, 219, 255, 0.1);
}
.wiki-hub-foot a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  background: rgba(119, 219, 255, 0.08);
  border: 1px solid rgba(119, 219, 255, 0.18);
  color: var(--text);
}
.wiki-hub-foot a:hover {
  background: rgba(119, 219, 255, 0.16);
}

/* ---------- Wiki ????????? slot + ?? fixed???????? JS ?? top/max-height?? ---------- */
.wiki-layout {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 28px 32px;
}
.wiki-sidebar-slot {
  flex: 0 0 240px;
  width: 240px;
  max-width: 260px;
  min-width: 200px;
  flex-shrink: 0;
}
.wiki-sidebar-toc {
  width: 100%;
  position: relative;
  z-index: 5;
}

/* Wraps TOC + shortcut buttons; sticky/fixed target for wiki-toc.js */
.wiki-sidebar-pin-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-self: flex-start;
  box-sizing: border-box;
  position: -webkit-sticky;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
}

.wiki-sidebar-pin-root .wiki-toc-panel {
  position: relative;
  top: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.wiki-toc-panel {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: rgba(8, 20, 30, 0.92);
  border: 1px solid rgba(119, 219, 255, 0.22);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
}

.wiki-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.wiki-sidebar-action {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: rgba(8, 20, 30, 0.92);
  border: 1px solid rgba(119, 219, 255, 0.22);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wiki-sidebar-action:hover,
.wiki-sidebar-action:focus-visible {
  background: rgba(119, 219, 255, 0.12);
  border-color: rgba(119, 219, 255, 0.38);
  color: var(--text);
}

button.wiki-sidebar-action {
  font-family: inherit;
}
.wiki-toc-title {
  font-size: 13px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(119, 219, 255, 0.12);
}
.wiki-toc-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wiki-toc-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.45;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.wiki-toc-nav a:hover,
.wiki-toc-nav a:focus-visible {
  background: rgba(119, 219, 255, 0.1);
  color: var(--text);
}
.wiki-toc-nav a.wiki-toc-active {
  border-left-color: var(--brand-2);
  background: rgba(111, 240, 200, 0.08);
  color: #d4f4ff;
}
.wiki-doc-column {
  flex: 1 1 0;
  min-width: 0;
}
.wiki-doc-section article[id],
.wiki-hub-section article[id] {
  scroll-margin-top: 100px;
}

.wiki-doc-page .wiki-breadcrumb {
  scroll-margin-top: 96px;
}

.wiki-doc-page .wiki-doc-section > .section-title-row {
  scroll-margin-top: 100px;
}

@media (max-width: 1024px) {
  .wiki-layout {
    flex-direction: column;
    align-items: stretch;
  }
  .wiki-sidebar-slot {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .wiki-sidebar-toc {
    margin: 0 -12px 12px;
    padding: 0 12px;
    z-index: 5;
  }
  .wiki-sidebar-pin-root {
    position: static;
    max-height: none;
    top: auto;
    align-self: stretch;
    gap: 10px;
  }
  .wiki-sidebar-pin-root .wiki-toc-panel {
    flex: none;
    min-height: 0;
    position: -webkit-sticky;
    position: sticky;
    top: 72px;
  }
  .wiki-toc-panel {
    max-height: none;
    overflow-y: visible;
    padding: 10px 12px;
  }
  .wiki-sidebar-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .wiki-sidebar-action {
    flex: 1 1 calc(50% - 4px);
    min-width: 140px;
    padding: 9px 10px;
    font-size: 12px;
  }
  .wiki-toc-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .wiki-toc-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
  }
  .wiki-toc-nav a.wiki-toc-active {
    border-bottom-color: var(--brand-2);
    background: rgba(119, 219, 255, 0.12);
  }
}

.wiki-topic-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  object-fit: contain;
  flex-shrink: 0;
}
.wiki-topic-icon.wiki-achievement-icon {
  width: 56px;
  height: 56px;
}
.wiki-h2-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wiki-panel h3.wiki-h3-row {
  color: var(--brand-2);
  margin: 22px 0 10px;
  font-size: clamp(15px, 1.18vw, 18px);
  font-weight: 700;
  scroll-margin-top: 96px;
}
.wiki-inline-icon {
  width: 1.2em;
  height: 1.2em;
  image-rendering: pixelated;
  object-fit: contain;
  vertical-align: -0.22em;
  margin: 0 0.12em;
}
.wiki-nav-table .wiki-entry-link {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
}
.wiki-nav-table .wiki-entry-link img.wiki-topic-icon {
  margin-top: 2px;
  width: 26px;
  height: 26px;
}
.wiki-table td.wiki-td-iconcell {
  vertical-align: middle;
}
.wiki-table .wiki-mode-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.wiki-table .wiki-mode-row img.wiki-topic-icon {
  width: 22px;
  height: 22px;
}

.wiki-formula-note {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.65;
  font-weight: 700;
}

/* ----- Optional recipe / schematic thumbnails (items-season wiki) ----- */
.wiki-recipe-figure {
  margin: 14px 0;
  text-align: center;
}
.wiki-recipe-figure img {
  max-width: min(100%, 300px);
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(119, 219, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.wiki-recipe-figure .wiki-formula-note {
  margin-top: 10px;
}

/* KaTeX???????? */
#challenge-math-scope .katex-display {
  margin: 14px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0;
}
#challenge-math-scope .katex {
  font-size: 1.05em;
}
#challenge-math-scope .katex-display > .katex {
  color: #e8f6ff;
}
