/* ==========================================================================
   Sporebound Wiki — Authentic Minecraft Wiki (Vector) + Dark Survivor Theme
   ========================================================================== */

:root {
  /* Classic Minecraft Wiki Light Palette */
  --bg-page: #f6f6f6;
  --bg-content: #ffffff;
  --bg-sidebar: #eeeeee;
  --bg-header: #ffffff;
  --bg-subtle: #f8f9fa;
  --bg-box-header: #e2ebd7;
  --bg-box-header-alt: #dce6f2;
  --bg-box-header-warn: #f5e4d7;
  --bg-infobox: #f9f9f9;
  --bg-infobox-header: #3c6e28;
  --text-infobox-header: #ffffff;
  --bg-toc: #f8f9fa;
  --border-color: #a2a9b1;
  --border-light: #c8ccd1;
  --border-content: #a7d7f9;
  --text-main: #202122;
  --text-muted: #54595d;
  --link-color: #0645ad;
  --link-hover: #0b0080;
  --accent-green: #3c8527;
  --accent-spore: #c86428;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  /* Dark Post-Apocalyptic Survivor Wiki Theme */
  --bg-page: #121512;
  --bg-content: #1a1e1a;
  --bg-sidebar: #151915;
  --bg-header: #181c18;
  --bg-subtle: #222722;
  --bg-box-header: #263822;
  --bg-box-header-alt: #21303d;
  --bg-box-header-warn: #3d2a1e;
  --bg-infobox: #202520;
  --bg-infobox-header: #2f5e20;
  --text-infobox-header: #eef5ea;
  --bg-toc: #202520;
  --border-color: #3a423a;
  --border-light: #2d342d;
  --border-content: #3b5932;
  --text-main: #e4e8e2;
  --text-muted: #9aa396;
  --link-color: #6cb4ff;
  --link-hover: #99cbff;
  --accent-green: #58b83c;
  --accent-spore: #e67e22;
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: var(--link-color);
  text-decoration: none;
  cursor: pointer;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

code, pre, kbd {
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
}

code {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12.5px;
}

kbd {
  background: #eee;
  color: #111;
  border: 1px solid #888;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  font-weight: 700;
  font-size: 12px;
}

/* Pixel art crisp rendering */
.pixelated {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ==========================================================================
   Wiki Shell Layout (#mw-wrapper)
   ========================================================================== */
.mw-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar (#mw-panel) */
.mw-panel {
  width: 245px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: 12px 12px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.wiki-logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 8px 12px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}

.wiki-logo-crest {
  width: 68px;
  height: 68px;
  background: radial-gradient(circle, rgba(60, 133, 39, 0.22), transparent 70%);
  border: 2px solid var(--accent-green);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.15);
}

.wiki-logo-crest img {
  width: 48px;
  height: 48px;
}

.wiki-logo-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--text-main);
}

.wiki-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.portal-section {
  display: flex;
  flex-direction: column;
}

.portal-heading {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}

.portal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.portal-list li {
  margin: 1px 0;
}

.portal-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 7px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--link-color);
  text-decoration: none;
}

.portal-link:hover, .portal-link.active {
  background: var(--bg-box-header);
  text-decoration: none;
  font-weight: 600;
}

.portal-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0 6px;
}

/* Main Column */
.mw-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top Bar (#mw-head) */
.mw-head {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-content);
  padding: 8px 22px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mw-tabs {
  display: flex;
  gap: 3px;
}

.mw-tab {
  padding: 7px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-content);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  font-size: 13px;
  color: var(--link-color);
  cursor: pointer;
  user-select: none;
}

.mw-tab.active {
  background: var(--bg-content);
  color: var(--text-main);
  font-weight: 700;
  position: relative;
  top: 1px;
  padding-bottom: 8px;
}

.mw-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 7px;
}

/* Search Box + Autocomplete */
.search-container {
  position: relative;
  width: 340px;
  max-width: 100%;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-content);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 0 8px;
}

.search-input-wrap:focus-within {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(60, 133, 39, 0.2);
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  padding: 6px 6px;
  font-size: 13px;
  outline: none;
}

.search-shortcut {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 0 5px;
  pointer-events: none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-content);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  max-height: 420px;
  overflow-y: auto;
  z-index: 300;
  display: none;
}

.search-dropdown.open {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}

.search-result-item:hover, .search-result-item.focused {
  background: var(--bg-box-header);
}

.search-result-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.search-result-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-tool {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 5px 10px;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-tool:hover {
  background: var(--bg-box-header);
}

/* Main Wiki Body (#content) */
.mw-body {
  background: var(--bg-content);
  border-bottom: 1px solid var(--border-content);
  padding: 20px 28px 44px;
  flex: 1;
}

.firstHeading {
  font-family: "Linux Libertine", Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
  border-bottom: 1px solid var(--border-color);
  margin: 0 0 8px;
  padding-bottom: 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.firstHeading-en {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.siteSub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.mw-section-heading {
  font-family: "Linux Libertine", Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 400;
  border-bottom: 1px solid var(--border-light);
  margin: 24px 0 12px;
  padding-bottom: 3px;
  clear: left;
}

/* ==========================================================================
   Minecraft Wiki Right Infobox (.infobox)
   ========================================================================== */
.infobox {
  float: right;
  clear: right;
  width: 300px;
  margin: 0 0 18px 22px;
  background: var(--bg-infobox);
  border: 1px solid var(--border-color);
  border-spacing: 0;
  font-size: 13px;
  box-shadow: var(--shadow-card);
}

.infobox-header {
  background: var(--bg-infobox-header);
  color: var(--text-infobox-header);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
}

.infobox-image-area {
  padding: 16px 12px;
  text-align: center;
  background: radial-gradient(circle, rgba(128, 128, 128, 0.12), transparent 72%);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.infobox-table {
  width: 100%;
  border-collapse: collapse;
}

.infobox-table th,
.infobox-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  text-align: left;
}

.infobox-table th {
  width: 44%;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.infobox-section-title {
  background: var(--bg-box-header);
  text-align: center !important;
  font-weight: 700;
  color: var(--text-main) !important;
  padding: 5px 8px !important;
}

/* Table of Contents (.toc) */
.toc-box {
  display: inline-block;
  background: var(--bg-toc);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  margin: 12px 0 18px;
  font-size: 13px;
  min-width: 230px;
}

.toc-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.toc-list {
  margin: 0;
  padding-left: 18px;
}

.toc-list li {
  margin: 3px 0;
}

/* ==========================================================================
   Icons: 2D Pixel Item, Tinted Alcohol Bottle & Isometric 3D Block Cube
   ========================================================================== */
.wiki-icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  user-select: none;
}

.wiki-icon-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* Tinted Bottle (Glass + Colored Liquid Mask) */
.tinted-bottle-wrap {
  position: relative;
  display: inline-block;
}

.tinted-bottle-liquid {
  position: absolute;
  inset: 0;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  image-rendering: pixelated;
}

.tinted-bottle-glass {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  mix-blend-mode: normal;
}

/* Isometric 3D Minecraft Block Cube */
.iso-cube-scene {
  width: 96px;
  height: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iso-cube {
  position: relative;
  width: 54px;
  height: 54px;
  transform-style: preserve-3d;
  transform: rotateX(-30deg) rotateY(45deg);
}

.iso-face {
  position: absolute;
  width: 54px;
  height: 54px;
  background-size: 100% 100%;
  image-rendering: pixelated;
  backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.iso-face-top {
  transform: rotateX(90deg) translateZ(27px);
  filter: brightness(1.08);
}

.iso-face-front {
  transform: translateZ(27px);
  filter: brightness(0.92);
}

.iso-face-side {
  transform: rotateY(-90deg) translateZ(27px);
  filter: brightness(0.75);
}

/* Vanilla Fallback Badge Icon */
.vanilla-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-weight: 800;
  font-size: 11px;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Authentic Minecraft GUI Crafting & Station Widgets (.mc-gui)
   ========================================================================== */
.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  margin: 12px 0 20px;
}

.mc-gui-card {
  background: #c6c6c6;
  color: #222;
  border: 2px solid #000;
  box-shadow:
    inset 2px 2px 0 #ffffff,
    inset -2px -2px 0 #555555;
  border-radius: 2px;
  padding: 10px 12px 12px;
  font-family: "JetBrains Mono", Consolas, monospace;
}

.mc-gui-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #373737;
  border-bottom: 1px solid #999;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.mc-gui-header a {
  color: #1f3d14;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mc-gui-badges {
  display: flex;
  gap: 4px;
  font-size: 11px;
}

.mc-gui-badge {
  background: #373737;
  color: #fff;
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 600;
}

.mc-gui-badge.power {
  background: #8a5600;
  color: #ffe680;
}

.mc-gui-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 114px;
}

.mc-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: repeat(3, 36px);
  gap: 2px;
  background: #8b8b8b;
  padding: 2px;
  border: 1px solid #373737;
}

.mc-station-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 170px;
  justify-content: center;
}

.mc-slot {
  width: 36px;
  height: 36px;
  background: #8b8b8b;
  border-top: 2px solid #373737;
  border-left: 2px solid #373737;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mc-slot:hover {
  background: #a8c69f;
}

.mc-slot.output-slot {
  width: 46px;
  height: 46px;
}

.mc-slot.catalyst-slot {
  background: #6c7a89;
  outline: 1px dashed #ffd166;
}

.mc-slot-count {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 1px 1px 0 #111, -1px -1px 0 #111, 1px -1px 0 #111, -1px 1px 0 #111;
  line-height: 1;
  pointer-events: none;
}

.mc-arrow {
  font-size: 22px;
  font-weight: 900;
  color: #4a4a4a;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mc-gui-notes {
  margin-top: 8px;
  font-size: 11.5px;
  color: #333;
  background: rgba(255, 255, 255, 0.45);
  padding: 4px 7px;
  border-left: 3px solid #3c6e28;
}

/* Minecraft Dark-Purple Hover Tooltip */
#mc-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: rgba(16, 0, 16, 0.95);
  color: #ffffff;
  border: 2px solid #28007f;
  outline: 2px solid #100010;
  padding: 6px 10px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.4;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: none;
}

#mc-tooltip .tt-title {
  font-weight: 700;
  color: #ffffff;
}

#mc-tooltip .tt-title.rarity-uncommon { color: #ffff55; }
#mc-tooltip .tt-title.rarity-rare { color: #55ffff; }
#mc-tooltip .tt-title.rarity-epic { color: #ff55ff; }

#mc-tooltip .tt-sub {
  color: #aaaaaa;
  font-size: 11.5px;
  margin-top: 2px;
}

#mc-tooltip .tt-id {
  color: #666677;
  font-size: 11px;
  margin-top: 3px;
}

/* ==========================================================================
   Main Page Boxes & Wiki Tables (.wiki-box, .wiki-table, .navbox)
   ========================================================================== */
.mainpage-banner {
  background: linear-gradient(135deg, rgba(60, 110, 40, 0.16), rgba(200, 100, 40, 0.12));
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--accent-green);
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mainpage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-pill {
  background: var(--bg-content);
  border: 1px solid var(--border-light);
  padding: 6px 12px;
  border-radius: 4px;
  text-align: center;
}

.stat-pill strong {
  display: block;
  font-size: 17px;
  color: var(--accent-green);
}

.stat-pill span {
  font-size: 11px;
  color: var(--text-muted);
}

.mainpage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.wiki-box {
  background: var(--bg-content);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.wiki-box-header {
  background: var(--bg-box-header);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wiki-box-header.alt { background: var(--bg-box-header-alt); }
.wiki-box-header.warn { background: var(--bg-box-header-warn); }

.wiki-box-body {
  padding: 12px 14px;
}

/* Icon chip links (like Minecraft Wiki item links) */
.item-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  font-size: 12.5px;
  color: var(--link-color);
  text-decoration: none;
}

.item-chip:hover {
  background: var(--bg-box-header);
  border-color: var(--accent-green);
  text-decoration: none;
}

/* Standard Wiki Data Table */
.wiki-table-wrap {
  overflow-x: auto;
  margin: 10px 0 18px;
}

.wiki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-content);
}

.wiki-table th,
.wiki-table td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
}

.wiki-table th {
  background: var(--bg-box-header);
  font-weight: 700;
}

.wiki-table tr:nth-child(even) td {
  background: var(--bg-subtle);
}

/* Bottom Navbox (.navbox) */
.navbox {
  clear: both;
  margin-top: 32px;
  border: 1px solid var(--border-color);
  background: var(--bg-content);
  font-size: 12.5px;
}

.navbox-title {
  background: var(--bg-infobox-header);
  color: var(--text-infobox-header);
  font-weight: 700;
  text-align: center;
  padding: 6px 12px;
}

.navbox-table {
  width: 100%;
  border-collapse: collapse;
}

.navbox-table th {
  width: 170px;
  background: var(--bg-box-header);
  border: 1px solid var(--border-light);
  padding: 6px 10px;
  text-align: right;
  font-weight: 600;
}

.navbox-table td {
  border: 1px solid var(--border-light);
  padding: 6px 10px;
}

/* Badges */
.tier-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}
.tier-1 { background: #6c757d; color: #fff; }
.tier-2 { background: #2e7d32; color: #fff; }
.tier-3 { background: #1565c0; color: #fff; }
.tier-4 { background: #6a1b9a; color: #fff; }

.preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.preview-card {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  padding: 8px;
  text-align: center;
}

.preview-card img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-light);
}

.preview-card-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Footer */
.mw-footer {
  padding: 16px 28px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 960px) {
  .mw-wrapper { flex-direction: column; }
  .mw-panel {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 18px 0;
  }
  .mainpage-grid {
    grid-template-columns: 1fr;
  }
}
