*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #07090e;
  --card:     #0f131a;
  --card-2:   #111620;
  --blue:     #38bdf8;
  --yellow:   #facc15;
  --green:    #4ade80;
  --text:     #f8fafc;
  --muted:    #94a3b8;
  --border:   rgba(56,189,248,.13);
  --border-s: rgba(56,189,248,.06);
  --radius:   14px;
  --sidebar-w: 260px;
  --header-h:  58px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg); color: var(--text);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* noise */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: .02; pointer-events: none;
}

canvas#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ── TOP BAR ── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  background: rgba(7,9,14,.75);
  backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border-s);
}
.topbar-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: 15px; letter-spacing: .08em;
  color: var(--text); text-decoration: none; flex-shrink: 0;
  white-space: nowrap;
}
.topbar-logo span { color: var(--blue); }
.topbar-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.topbar-wiki {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase; flex-shrink: 0;
}
.topbar-search {
  flex: 1; max-width: 340px; margin-left: auto;
  position: relative; display: flex; align-items: center;
}
.topbar-search input {
  width: 100%; background: rgba(255,255,255,.04);
  border: 1px solid var(--border-s); border-radius: 8px;
  padding: 7px 12px 7px 34px;
  color: var(--text); font-family: 'Manrope', sans-serif;
  font-size: 13px; outline: none;
  transition: border-color .2s, background .2s;
}
.topbar-search input:focus {
  border-color: rgba(56,189,248,.3);
  background: rgba(56,189,248,.04);
}
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search svg {
  position: absolute; left: 10px; color: var(--muted); pointer-events: none;
}
.back-link {
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
  color: var(--muted); text-decoration: none;
  text-transform: uppercase; white-space: nowrap; flex-shrink: 0;
  transition: color .2s;
  display: flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--text); }

/* hamburger for mobile sidebar */
.sb-toggle {
  display: none; flex-direction: column; gap: 4px;
  cursor: pointer; padding: 4px; flex-shrink: 0;
}
.sb-toggle span { display: block; width: 20px; height: 2px; background: var(--muted); border-radius: 2px; transition: all .25s; }

/* ── LAYOUT ── */
#layout {
  display: flex; position: relative; z-index: 1;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: fixed; top: var(--header-h); bottom: 0; left: 0;
  overflow-y: auto; overflow-x: hidden;
  background: rgba(7,9,14,.6);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-s);
  padding: 24px 0 40px;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  scrollbar-width: thin; scrollbar-color: rgba(56,189,248,.15) transparent;
  z-index: 150;
}
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(56,189,248,.15); border-radius: 3px; }

.sb-section { margin-bottom: 6px; }
.sb-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
  padding: 6px 20px 4px; opacity: .5;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--muted);
  border-left: 2px solid transparent;
  transition: color .2s, background .2s, border-color .2s;
  white-space: nowrap; user-select: none;
}
.sb-item:hover { color: var(--text); background: rgba(56,189,248,.04); }
.sb-item.active {
  color: var(--blue); border-left-color: var(--blue);
  background: rgba(56,189,248,.06);
}
.sb-item .sb-icon {
  width: 16px; height: 16px; flex-shrink: 0; opacity: .7;
}
.sb-item.active .sb-icon { opacity: 1; }
.sb-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  background: rgba(250,204,21,.1); color: var(--yellow);
  border: 1px solid rgba(250,204,21,.2); letter-spacing: .04em;
  flex-shrink: 0;
}
.sb-badge.new {
  background: rgba(56,189,248,.1); color: var(--blue);
  border-color: rgba(56,189,248,.2);
}

/* overlay for mobile */
#sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 140;
  backdrop-filter: blur(4px);
}

/* ── MAIN CONTENT ── */
#content {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  padding: clamp(32px,5vw,56px) clamp(20px,5vw,64px);
  max-width: 900px;
}

/* article pages */
.wiki-page { display: none; }
.wiki-page.active { display: block; animation: fadeUp .4s both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* page header */
.page-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .16em;
  color: var(--blue); text-transform: uppercase; margin-bottom: 14px;
}
.page-eyebrow::before {
  content: ''; display: block; width: 20px; height: 1px;
  background: var(--blue); flex-shrink: 0;
}
.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: clamp(26px,4vw,42px);
  line-height: 1.1; letter-spacing: -.02em;
  margin-bottom: clamp(10px,2vw,16px);
}
.page-sub {
  font-size: clamp(14px,1.6vw,16px); color: var(--muted);
  line-height: 1.7; max-width: 600px;
  margin-bottom: clamp(32px,5vw,48px);
}
.page-divider {
  border: none; border-top: 1px solid var(--border-s);
  margin: clamp(28px,4vw,40px) 0;
}

/* content typography */
.wiki-h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(17px,2vw,22px); font-weight: 700;
  margin: clamp(28px,4vw,40px) 0 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-s);
  display: flex; align-items: center; gap: 10px;
}
.wiki-h2 .h2-icon {
  width: 22px; height: 22px; border-radius: 7px;
  background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.14);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--blue);
}
.wiki-h3 {
  font-size: clamp(14px,1.6vw,17px); font-weight: 700;
  margin: 20px 0 10px; color: var(--text);
}
.wiki-p {
  font-size: clamp(13px,1.4vw,15px); color: var(--muted);
  line-height: 1.8; margin-bottom: 14px;
}
.wiki-p strong { color: var(--text); font-weight: 600; }
.wiki-p em { color: var(--blue); font-style: normal; }
.wiki-p mark { background: none; color: var(--yellow); }

/* callout boxes */
.callout {
  border-radius: 10px; padding: 16px 18px;
  margin: 18px 0; display: flex; gap: 14px; align-items: flex-start;
  font-size: 13px; line-height: 1.65;
}
.callout.info   { background: rgba(56,189,248,.06);  border: 1px solid rgba(56,189,248,.15); color: #93c5fd; }
.callout.warn   { background: rgba(250,204,21,.06);  border: 1px solid rgba(250,204,21,.18); color: #fde68a; }
.callout.danger { background: rgba(248,113,113,.06); border: 1px solid rgba(248,113,113,.18); color: #fca5a5; }
.callout.success{ background: rgba(74,222,128,.06);  border: 1px solid rgba(74,222,128,.18); color: #86efac; }
.callout-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.callout-body strong { color: var(--text); font-weight: 600; }

/* info cards grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%,220px),1fr));
  gap: 12px; margin: 20px 0;
}
.info-card {
  background: var(--card); border: 1px solid var(--border-s);
  border-radius: var(--radius); padding: 20px;
  transition: border-color .25s, transform .25s;
}
.info-card:hover { border-color: var(--border); transform: translateY(-3px); }
.info-card-label {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.info-card-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(20px,2.5vw,28px); font-weight: 800;
  color: var(--text); margin-bottom: 4px;
}
.info-card-val span { color: var(--blue); }
.info-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* rule list */
.rule-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.rule-list li {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 13px; color: var(--muted); line-height: 1.6;
  background: var(--card); border: 1px solid var(--border-s);
  border-radius: 10px; padding: 14px 16px;
}
.rule-list li strong { color: var(--text); font-weight: 600; }
.rule-num {
  font-size: 11px; font-weight: 800; color: var(--blue);
  background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.18);
  border-radius: 6px; padding: 2px 8px; flex-shrink: 0; margin-top: 1px;
  letter-spacing: .04em;
}
.rule-num.warn { color: var(--yellow); background: rgba(250,204,21,.1); border-color: rgba(250,204,21,.2); }
.rule-num.danger { color: #f87171; background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.2); }

/* tag pills */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag {
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  padding: 4px 12px; border-radius: 99px;
  background: rgba(56,189,248,.07); border: 1px solid rgba(56,189,248,.14);
  color: var(--blue);
}
.tag.y { background: rgba(250,204,21,.07); border-color: rgba(250,204,21,.18); color: var(--yellow); }
.tag.g { background: rgba(74,222,128,.07); border-color: rgba(74,222,128,.18); color: var(--green); }
.tag.r { background: rgba(248,113,113,.07); border-color: rgba(248,113,113,.18); color: #f87171; }

/* lore entry */
.lore-entry {
  background: var(--card); border: 1px solid var(--border-s);
  border-radius: var(--radius); padding: 22px 24px; margin: 14px 0;
  position: relative; overflow: hidden;
}
.lore-entry::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--yellow), transparent);
}
.lore-entry-id {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: var(--yellow); opacity: .6; text-transform: uppercase; margin-bottom: 8px;
}
.lore-entry-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px; font-weight: 700; margin-bottom: 10px;
}
.lore-entry-body {
  font-size: 13px; color: var(--muted); line-height: 1.75;
}
.lore-entry-body strong { color: var(--text); font-weight: 600; }
.lore-entry-body em { color: var(--yellow); font-style: normal; }
.lore-unknown {
  display: inline-block; background: rgba(248,250,252,.1);
  border-radius: 3px; padding: 0 7px; color: transparent;
  cursor: default; transition: background .25s, color .25s;
  font-size: 12px; font-weight: 600;
}
.lore-unknown:hover { background: rgba(250,204,21,.12); color: var(--yellow); }

/* guide steps */
.step-list { display: flex; flex-direction: column; gap: 0; margin: 16px 0; }
.step-item {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 0; border-bottom: 1px solid var(--border-s);
  position: relative;
}
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--blue); margin-top: 2px;
}
.step-title { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.step-body { font-size: 13px; color: var(--muted); line-height: 1.65; }
.step-body strong { color: var(--text); font-weight: 600; }

/* toc (table of contents) */
.toc {
  background: rgba(56,189,248,.03); border: 1px solid var(--border-s);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 32px;
}
.toc-title { font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.toc-list a {
  font-size: 13px; font-weight: 500; color: var(--muted);
  text-decoration: none; transition: color .2s;
  display: flex; align-items: center; gap: 8px;
}
.toc-list a::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0; opacity: .4;
}
.toc-list a:hover { color: var(--text); }
.toc-list a:hover::before { opacity: 1; }

/* home page cards */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%,260px),1fr));
  gap: 14px; margin-top: 28px;
}
.home-card {
  background: var(--card); border: 1px solid var(--border-s);
  border-radius: var(--radius); padding: 24px;
  cursor: pointer; transition: border-color .25s, transform .25s;
  text-decoration: none; display: block;
}
.home-card:hover { border-color: var(--border); transform: translateY(-4px); }
.home-card-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; flex-shrink: 0;
}
.home-card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px; font-weight: 700; margin-bottom: 8px;
}
.home-card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.home-card-count {
  font-size: 11px; font-weight: 600; color: var(--muted);
  margin-top: 14px; opacity: .6;
}

/* responsive */
@media (max-width: 780px) {
  :root { --sidebar-w: 240px; }
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #sb-overlay.open { display: block; }
  #content { margin-left: 0; }
  .sb-toggle { display: flex; }
  .topbar-search { display: none; }
}
@media (max-width: 480px) {
  .back-link span { display: none; }
  #content { padding: 24px 16px; }
}
/* ── CRAFTING TABLE ── */
.craft-section {
  margin: clamp(28px,4vw,44px) 0;
}
.craft-card {
  background: var(--card);
  border: 1px solid var(--border-s);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .3s;
}
.craft-card:hover { border-color: var(--border); }

.craft-card-header {
  padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.craft-card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(15px,1.8vw,18px); font-weight: 700;
}
.craft-card-desc {
  font-size: 13px; color: var(--muted); line-height: 1.6;
  padding: 8px 24px 20px; max-width: 560px;
}

/* the actual crafting table UI */
.craft-table-wrap {
  padding: 0 24px 28px;
  display: flex; align-items: center;
  gap: clamp(20px,4vw,48px); flex-wrap: wrap;
}

.craft-grid-label {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  opacity: .5; margin-bottom: 10px;
}

.craft-grid {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 4px;
  flex-shrink: 0;
}

.craft-cell {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; position: relative;
  transition: background .2s, border-color .2s;
  cursor: default;
}
.craft-cell:hover {
  background: rgba(56,189,248,.06);
  border-color: rgba(56,189,248,.2);
}
.craft-cell.filled { border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.05); }
.craft-cell .item-count {
  position: absolute; bottom: 3px; right: 5px;
  font-size: 10px; font-weight: 800; color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* arrow */
.craft-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.craft-arrow svg { color: var(--muted); opacity: .4; }
.craft-arrow-label {
  font-size: 10px; color: var(--muted); opacity: .4;
  letter-spacing: .06em; font-weight: 600;
}

/* result cell */
.craft-result-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.craft-result-cell {
  width: 64px; height: 64px;
  background: rgba(56,189,248,.05);
  border: 1px solid rgba(56,189,248,.18);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; position: relative;
  box-shadow: 0 0 20px rgba(56,189,248,.08);
  cursor: default;
}
.craft-result-cell .item-count {
  position: absolute; bottom: 4px; right: 6px;
  font-size: 11px; font-weight: 800; color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.craft-result-name {
  font-size: 12px; font-weight: 700; color: var(--blue);
  letter-spacing: .04em; text-align: center;
}

/* tooltip */
.craft-cell[data-tip]:hover::after,
.craft-result-cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: #1e2533; border: 1px solid var(--border);
  color: var(--text); font-size: 11px; font-weight: 600;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 99;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  font-family: 'Manrope', sans-serif;
}

/* ingredient list */
.craft-ingredients {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 24px 24px; padding-top: 16px;
  border-top: 1px solid var(--border-s);
}
.craft-ing-title {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); opacity: .5;
  margin-bottom: 4px;
}
.craft-ing-item {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.craft-ing-item strong { color: var(--text); font-weight: 600; }
.craft-ing-icon {
  width: 32px; height: 32px; border-radius: 7px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

/* coming soon craft */
.craft-soon {
  background: var(--card); border: 1px dashed rgba(56,189,248,.15);
  border-radius: var(--radius); padding: 28px 24px;
  display: flex; align-items: center; gap: 16px;
  margin-top: 14px;
}
.craft-soon-icon { font-size: 24px; flex-shrink: 0; opacity: .4; }
.craft-soon-text { font-size: 13px; color: var(--muted); line-height: 1.6; }
.craft-soon-text strong { color: var(--text); }