:root{
  --bg: #120d09;
  --bg-elevated: #1c140f;
  --sidebar-bg: #0d0a07;
  --border: #2a1d15;
  --text: #f0e6da;
  --text-dim: #c9b8a8;
  --text-faint: #8a7a6c;
  --accent: #e2432c;
  --accent-soft: rgba(226,67,44,0.14);
  --gold: #f0b429;
  --gold-soft: rgba(240,180,41,0.12);
  --warn: #f0b429;
  --warn-soft: rgba(240,180,41,0.09);
  --info: #e2432c;
  --info-soft: rgba(226,67,44,0.08);
  --radius: 8px;
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "Geist", system-ui, sans-serif;
  --font-mono: "Space Grotesk", ui-monospace, monospace;
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ============ TOPBAR ============ */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13,10,7,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner{
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ff6a4a, #c0281a);
  color: #2a0a05;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
}
.brand-sub{
  font-weight: 400;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0;
}

/* wiki switcher (dungeons <-> hardcore) */
.wiki-switch{
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.wiki-switch a{
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-faint);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.wiki-switch a:hover{ color: var(--text); }
.wiki-switch a.current{
  background: var(--accent-soft);
  color: var(--accent);
}

.search-fake{
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text-faint);
  font-size: 13px;
  cursor: pointer;
  margin-left: auto;
}
.search-fake kbd{
  font-family: var(--font-body);
  font-size: 11px;
  background: var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-dim);
}

/* ============ SEARCH PANEL ============ */
.search-overlay{
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8,6,4,0.7);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}
.search-overlay.open{ display: flex; }
.search-panel{
  width: 100%;
  max-width: 620px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.7);
  overflow: hidden;
}
.search-input-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-input-row svg{ flex-shrink: 0; color: var(--text-faint); }
.search-input-row input{
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
}
.search-input-row input::placeholder{ color: var(--text-faint); }
.search-esc{
  font-size: 11px;
  color: var(--text-faint);
  background: var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}
.search-results{
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}
.search-result{
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 2px;
}
.search-result:hover, .search-result.sel{
  background: var(--accent-soft);
}
.search-result-title{
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.search-result-title mark{
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: 3px;
  padding: 0 2px;
}
.search-result-snippet{
  font-size: 12.5px;
  color: var(--text-dim);
}
.search-result-snippet mark{
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: 3px;
  padding: 0 2px;
}
.search-empty{
  padding: 24px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13.5px;
}

/* ============ SHELL / LAYOUT ============ */
.shell{
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
}

/* ============ SIDEBAR ============ */
.sidebar{
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 24px 16px 40px;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
}
.side-section{ margin-bottom: 28px; }
.side-label{
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 10px;
  margin-bottom: 8px;
}
.side-link{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}
.side-link:hover{
  background: var(--bg-elevated);
  color: var(--text);
}
.side-link.active{
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ============ CONTENT ============ */
.content{
  padding: 40px 56px 120px;
  min-width: 0;
}
.page{
  max-width: 760px;
  padding-top: 8px;
  scroll-margin-top: 76px;
}
.page + .page{
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding-top: 56px;
}
.crumbs{
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
}
h1{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: #fff;
}
h2{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin: 36px 0 12px;
  color: #fff;
  letter-spacing: -0.005em;
}
.lede{
  font-size: 16.5px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 24px;
}
p{ margin: 0 0 14px; color: var(--text); }
.fine-note{
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: -6px;
}
a{ color: var(--accent); }
code{
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--accent);
}

/* ============ CALLOUTS ============ */
.callout{
  display: flex;
  gap: 12px;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 18px 0;
  border: 1px solid transparent;
}
.callout-icon{
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.4;
}
.callout p{ margin: 4px 0 0; }
.callout strong{ color: #fff; }
.callout-warn{ background: var(--warn-soft); border-color: rgba(240,180,41,0.25); }
.callout-warn .callout-icon{ color: var(--warn); }
.callout-info{ background: var(--info-soft); border-color: rgba(226,67,44,0.2); }
.callout-info .callout-icon{ color: var(--info); }

/* ============ TABLES ============ */
.data-table{
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 22px;
  font-size: 13.5px;
}
.data-table th, .data-table td{
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table th{
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table tr:hover td{ background: rgba(255,255,255,0.02); }

/* ============ LISTS ============ */
.steps{
  padding-left: 20px;
  margin: 14px 0 22px;
}
.steps li{ margin-bottom: 10px; padding-left: 4px; }
.check-list{
  list-style: none;
  padding: 0;
  margin: 14px 0 22px;
}
.check-list li{
  padding: 7px 0 7px 24px;
  position: relative;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.check-list li:before{
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.check-list li:last-child{ border-bottom: none; }

.enchant-list{
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 2;
}

/* ============ SIDE NAV (progreso lateral) ============ */
.side-nav{
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.side-dot{
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(240,230,218,0.22);
  transition: background .25s ease, transform .25s ease;
}
.side-dot::before{
  content: '';
  position: absolute;
  inset: -7px;
}
.side-dot::after{
  content: attr(data-label);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.side-dot:hover::after, .side-dot:focus-visible::after{
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.side-dot:hover, .side-dot:focus-visible{ transform: scale(1.4); }
.side-dot:focus-visible{ outline: 2px solid var(--accent); outline-offset: 4px; }
.side-dot[aria-current="true"]{
  background: var(--accent);
  transform: scale(1.3);
}
@media (max-width: 1180px){
  .side-nav{ display: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px){
  .shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .content{ padding: 32px 20px 100px; }
  h1{ font-size: 26px; }
  .search-fake{ display: none; }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
}

/* ============ CREDITS FOOTER ============ */
.credits-page{
  padding-top: 0;
  max-width: 760px;
}
.credits-callout{
  margin: 0;
  align-items: center;
}
.credits-callout .callout-icon{
  font-size: 22px;
}
.credits-callout p{
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-dim);
}
