/* Wiki: navegación, lectura y profundidad. Se carga DESPUÉS de vmu.css, vmu-rediseno.css y los <style> de cada página.
   Nivel A (estilo + navegación): todo menos los bloques marcados "Nivel B". Nivel B (efectos 3D): tilt, parallax, entrada escalonada. */

:root {
  --wx-top: 86px;
  --wx-side-w: 17rem;
  --wx-toc-w: 13.5rem;
  --wx-body: #c0d2e1;
  --wx-inset: rgba(4, 9, 16, 0.62);
  --wx-slot: rgba(79, 212, 255, 0.07);
  --wx-hover: rgba(79, 212, 255, 0.08);
  --wx-zebra: rgba(79, 212, 255, 0.028);
  --wx-glow: rgba(79, 212, 255, 0.35);
  --wx-tip-bg: rgba(232, 195, 106, 0.09);
  --wx-warn-bg: rgba(255, 106, 99, 0.09);
  --wx-ok-bg: rgba(95, 227, 154, 0.08);
  --wx-ease: cubic-bezier(.2, .7, .2, 1);
}
html[data-theme="dark"] { color-scheme: dark; }

/* ---------- Tema claro opcional ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eaf0f6; --bg-alt: #dfe8f1; --bg-card: #ffffff;
  --border: #c9d7e5; --border-bright: #6f98b8;
  --text: #12263a; --text-dim: #46607a;
  --accent: #0b6fa0; --accent-bright: #0a6393;
  --gold: #7a5600; --green: #12683f; --red: #b42318; --purple: #5b3cc4;
  --wx-body: #26405a; --wx-inset: #f2f6fa; --wx-slot: #e3edf6;
  --wx-hover: rgba(10, 99, 147, 0.08); --wx-zebra: rgba(10, 99, 147, 0.045); --wx-glow: rgba(10, 99, 147, 0.3);
  --wx-tip-bg: rgba(122, 86, 0, 0.09); --wx-warn-bg: rgba(180, 35, 24, 0.07); --wx-ok-bg: rgba(18, 104, 63, 0.08);
}
html[data-theme="light"] body {
  background:
    linear-gradient(rgba(10, 99, 147, 0.05) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(10, 99, 147, 0.05) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg);
  background-attachment: fixed;
}
/* La barra superior, las cabeceras y los tooltips conservan la paleta oscura de marca en ambos temas */
html[data-theme="light"] :is(.nav, .page-hero, .hhero, .wx-tip, .wx-fab) {
  --bg: #060a12; --bg-alt: #08101c; --bg-card: #0a1321;
  --border: #1c3149; --border-bright: #2d6286;
  --text: #d6e4f0; --text-dim: #7e97ad;
  --accent: #1fa6d9; --accent-bright: #4fd4ff;
  --gold: #e8c36a; --green: #5fe39a; --red: #ff6a63; --purple: #b9a2ff;
  color: var(--text);
}
html[data-theme="light"] .btn--primary { background: #2fc2f0 !important; color: #02121c !important; }
html[data-theme="light"] .btn--ghost, html[data-theme="light"] .btn--outline { color: var(--text) !important; }

/* ---------- Utilidades ---------- */
[hidden] { display: none !important; }
.wx-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html.wx-pending :is(.wiki-content, .hub) { opacity: 0; }
html.wx-on .wiki-content { z-index: auto; }
.wx-lock { overflow: hidden; }
.nav.is-scrolled { border-bottom-color: var(--accent-bright); }
html.wx-on .nav__inner { max-width: 1440px; }

/* Botones de tema e idioma en la barra superior */
.wx-theme { width: 2.1rem; height: 2.1rem; display: inline-grid; place-items: center; background: transparent; border: 1px solid var(--border); border-radius: 0; color: var(--text-dim); cursor: pointer; font: 400 1rem/1 var(--sans); transition: color 0.15s, border-color 0.15s; }
.wx-theme::before { content: '☀'; }
html[data-theme="light"] .wx-theme::before { content: '☾'; }
.wx-theme:hover, .nav .lang-toggle:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.nav .lang-toggle { border-radius: 0; }
.wx-mobile-tools { display: flex; gap: 0.6rem; padding: 0.6rem 0.75rem 0; }

/* ---------- Barra de progreso de lectura ---------- */
.wx-progress { position: fixed; z-index: 1100; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; }
.wx-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); box-shadow: 0 0 10px var(--wx-glow); transform: scaleX(var(--p, 0)); transform-origin: left; }

/* ---------- Estructura de lectura: barra lateral | artículo | índice ---------- */
html.wx-on .wiki-content > .container { max-width: 1440px; }
html.wx-on .wx-shell { display: grid; grid-template-columns: var(--wx-side-w) minmax(0, 1fr) var(--wx-toc-w); gap: 2rem; align-items: start; }
html.wx-on .wx-shell.wx-no-toc { grid-template-columns: var(--wx-side-w) minmax(0, 1fr); }
html.wx-on .wx-shell > .wiki-sidebar { display: none; }
html.wx-on .wx-article { min-width: 0; }
html.wx-on .wx-article [id] { scroll-margin-top: 96px; }
html.wx-on .wx-article > .wx-note { margin: 0 0 1.2rem; padding: 0.6rem 0.9rem; border-left: 3px solid var(--purple); background: var(--wx-inset); color: var(--wx-body); font-size: 0.88rem; }

/* Barra lateral fija */
.wx-side { position: sticky; top: var(--wx-top); display: flex; flex-direction: column; max-height: calc(100vh - var(--wx-top) - 1rem); background: var(--bg-card); border: 1px solid var(--border); }
.wx-side::after { content: ''; position: absolute; inset: -1px; pointer-events: none; z-index: 2;
  background:
    linear-gradient(var(--accent-bright), var(--accent-bright)) top left / 14px 2px no-repeat,
    linear-gradient(var(--accent-bright), var(--accent-bright)) top left / 2px 14px no-repeat,
    linear-gradient(var(--accent-bright), var(--accent-bright)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--accent-bright), var(--accent-bright)) bottom right / 2px 14px no-repeat; }
.wx-side__head { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem 0.2rem; }
.wx-side__title { font: 400 0.78rem var(--mono); color: var(--text-dim); }
.wx-side__close { display: none; width: 2.2rem; height: 2.2rem; background: transparent; border: 1px solid var(--border); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.wx-side__search { padding: 0.5rem 0.8rem 0.7rem; }
.wx-side__search input { width: 100%; padding: 0.55rem 0.7rem; background: var(--wx-inset); border: 1px solid var(--border-bright); border-radius: 0; color: var(--text); font: 400 0.92rem var(--sans); }
.wx-side__search input::placeholder { color: var(--text-dim); }
.wx-side__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 0.5rem 1rem; scrollbar-width: thin; }
.wx-side__status { padding: 0.2rem 0.6rem 0.5rem; font: 400 0.8rem var(--mono); color: var(--text-dim); }

.wx-nav__group { margin-bottom: 0.9rem; }
.wx-nav__h { padding: 0.5rem 0.6rem 0.25rem; font: 400 0.74rem var(--mono); color: var(--text-dim); }
.wx-nav ul { list-style: none; }
.wx-nav__a { display: flex; align-items: center; gap: 0.55rem; padding: 0.42rem 0.6rem; border-left: 2px solid transparent; color: var(--text-dim); font-size: 0.92rem; line-height: 1.35; transition: color 0.15s, background 0.15s, border-color 0.15s; }
.wx-nav__a:hover { color: var(--text); background: var(--wx-hover); }
.wx-nav__a[aria-current="page"] { color: var(--accent-bright); border-left-color: var(--accent-bright); background: var(--wx-hover); font-weight: 600; }
.wx-nav__ico { width: 1.5rem; flex: none; text-align: center; font-size: 1.05rem; }
.wx-nav__a--sub { font-size: 0.88rem; padding-left: 0.9rem; }
.wx-nav__back { display: block; margin: 0.2rem 0 0.8rem; padding: 0.4rem 0.6rem; font: 500 0.85rem var(--mono); color: var(--accent-bright); }
.wx-nav__back:hover { background: var(--wx-hover); }
.wx-nav__more summary, .wx-nav__cat summary { cursor: pointer; padding: 0.4rem 0.6rem; color: var(--text-dim); font-size: 0.88rem; }
.wx-nav__more > summary { font: 400 0.74rem var(--mono); }
.wx-nav__more summary:hover, .wx-nav__cat summary:hover { color: var(--text); }
.wx-nav__cat { margin-left: 0.3rem; }

/* Resultados de búsqueda (barra lateral y portada) */
.wx-res-list { list-style: none; }
.wx-res { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.6rem 0.7rem; border-left: 2px solid transparent; color: var(--text); }
.wx-res:hover, .wx-res:focus-visible { background: var(--wx-hover); border-left-color: var(--accent-bright); }
.wx-res__ico { flex: none; width: 1.7rem; text-align: center; font-size: 1.2rem; line-height: 1.4; }
.wx-res__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wx-res__t { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.wx-res__s { font-size: 0.82rem; color: var(--text-dim); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wx-res__k { flex: none; font: 500 0.7rem var(--mono); color: var(--text-dim); border: 1px solid var(--border); padding: 0.05rem 0.4rem; }
.wx-res mark { background: rgba(232, 195, 106, 0.28); color: inherit; padding: 0 1px; }
html[data-theme="light"] .wx-res mark { background: rgba(122, 86, 0, 0.2); }

/* Índice de la página (derecha) */
.wx-toc { position: sticky; top: var(--wx-top); max-height: calc(100vh - var(--wx-top) - 1rem); overflow-y: auto; padding: 0.2rem 0 0.2rem 1rem; border-left: 1px solid var(--border); scrollbar-width: thin; }
.wx-toc__t { margin-bottom: 0.5rem; font: 400 0.78rem var(--mono); color: var(--text-dim); }
.wx-toc__list { list-style: none; }
.wx-toc__i a { display: block; padding: 0.3rem 0.5rem; margin-left: -0.5rem; border-left: 2px solid transparent; color: var(--text-dim); font-size: 0.86rem; line-height: 1.35; transition: color 0.15s; }
.wx-toc__i--3 a { padding-left: 1.1rem; font-size: 0.82rem; }
.wx-toc__i a:hover { color: var(--text); }
.wx-toc__i.is-on a { color: var(--accent-bright); border-left-color: var(--accent-bright); font-weight: 600; }
.wx-toc-inline { display: none; margin-bottom: 1.2rem; background: var(--bg-card); border: 1px solid var(--border); }
.wx-toc-inline summary { cursor: pointer; padding: 0.7rem 1rem; font: 500 0.88rem var(--mono); color: var(--accent-bright); }
.wx-toc-inline .wx-toc__list { padding: 0 1rem 0.8rem; }
.wx-toc-inline .wx-toc__i a { margin-left: 0; }

/* ---------- Cabecera de sección: capas con profundidad ---------- */
html.wx-on .page-hero { position: relative; overflow: hidden; isolation: isolate; --px: 0; --py: 0; --sy: 0px; }
html.wx-on:not(.wx-lite) .page-hero::before { display: none; }
html.wx-lite :is(.hhero__stack, .hhero__rings, .hhero__floor) { display: none; }
html.wx-on .page-hero > :not(.wx-hero__layers) { position: relative; z-index: 2; }
html.wx-on .page-hero > :not(.wx-hero__layers):not(nav) { max-width: 1440px; }
html.wx-on .page-hero > nav { max-width: 1440px; }
.wx-hero__layers { position: absolute; inset: 0; z-index: -2; margin: 0; padding: 0; max-width: none; pointer-events: none; }
.wx-hero__bg { position: absolute; inset: 0 0 0 var(--hero-left, 36%); background: var(--wx-hero-img) var(--hero-pos, center 30%) / var(--hero-size, cover) no-repeat; opacity: 0.9;
  filter: brightness(var(--hero-bright, 1.5)) saturate(1.1);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 var(--hero-fade, 60%)); mask-image: linear-gradient(90deg, transparent 0%, #000 var(--hero-fade, 60%));
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -5px + var(--sy) * 0.04), 0) scale(1.12); }
.wx-hero__floor, .hhero__floor { position: absolute; left: -20%; right: -20%; bottom: -35%; height: 90%; transform-origin: 50% 100%; transform: perspective(420px) rotateX(64deg);
  background:
    linear-gradient(rgba(79, 212, 255, 0.3) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(79, 212, 255, 0.3) 1px, transparent 1px) 0 0 / 56px 56px;
  -webkit-mask-image: linear-gradient(0deg, #000 5%, transparent 80%); mask-image: linear-gradient(0deg, #000 5%, transparent 80%); opacity: 0.55; }
.wx-hero__rings, .hhero__rings { position: absolute; right: 2%; top: 50%; width: min(36vw, 430px); aspect-ratio: 1;
  transform: translate3d(calc(var(--px) * 14px), calc(var(--py) * 8px), 0) translateY(-48%) perspective(800px) rotateX(70deg); }
.wx-hero__rings i, .hhero__rings i { position: absolute; border-radius: 50%; }
.wx-hero__rings i:nth-child(1), .hhero__rings i:nth-child(1) { inset: 0; border: 1px dashed rgba(79, 212, 255, 0.5); }
.wx-hero__rings i:nth-child(2), .hhero__rings i:nth-child(2) { inset: 13%; border: 2px solid rgba(79, 212, 255, 0.2); border-top-color: var(--accent-bright); border-bottom-color: transparent; }
.wx-hero__rings i:nth-child(3), .hhero__rings i:nth-child(3) { inset: 30%; border: 1px dotted rgba(95, 227, 154, 0.6); box-shadow: 0 0 34px rgba(79, 212, 255, 0.2), inset 0 0 30px rgba(79, 212, 255, 0.12); }
.wx-hero__glyph { position: absolute; right: clamp(1rem, 9vw, 8rem); top: 50%; font-size: clamp(7rem, 15vw, 12rem); line-height: 1; opacity: 0.16; filter: grayscale(0.3);
  transform: translate3d(calc(var(--px) * 26px), calc(var(--py) * 16px + var(--sy) * -0.12 - 50%), 0); }

/* ---------- Lectura cómoda ---------- */
html.wx-on .wx-article :is(.info-card, .chaos-intro, .quest-card, .recipe-card) :is(p, li) { color: var(--wx-body); font-size: 1rem; line-height: 1.75; }
html.wx-on .wx-article :is(.info-card, .chaos-intro) p { max-width: 76ch; }
:where(html.wx-on .wx-article) strong { color: var(--text); font-weight: 600; }
html.wx-on .wx-article :is(.info-card, .quest-card, .recipe-card) h2 { font-size: 1.4rem; line-height: 1.25; margin-bottom: 1.1rem; }
html.wx-on .wx-article .info-card > h2::before, html.wx-on .wx-article .recipe-card > h2::before { content: ''; display: inline-block; width: 4px; height: 1.05em; margin-right: 0.6rem; vertical-align: -0.12em; background: var(--accent-bright); box-shadow: 0 0 10px var(--wx-glow); }
html.wx-on .wx-article :is(.info-card, .quest-card, .recipe-card, .chaos-intro, .zone-card, .raza-card, .panel-header) { border-color: var(--border); }
html.wx-on .wx-article :is(.meta-item, .benefit-item, .raza-stat) { background: var(--wx-inset) !important; }
html.wx-on .wx-article :is(.quest-step, .item-row, .ingredient, .hub-recipe, .npc-card, .flow .node) { background: var(--wx-inset); }
html.wx-on .wx-article .meta-item__v { font-size: 1rem; }
html.wx-on .wx-article .step-list li, html.wx-on .wx-article .quest-step__content { font-size: 1rem; }
html.wx-on .wx-article :is(p, li, td) a:not(.btn):not(.keyword) { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, var(--accent-bright) 45%, transparent); }
html.wx-on .wx-article :is(p, li, td) a:not(.btn):not(.keyword):hover { text-decoration-color: currentColor; }
html.wx-on .wx-article a:focus-visible, .wx-shell a:focus-visible, .wx-shell button:focus-visible, .wx-shell summary:focus-visible, .wx-shell input:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

.keyword { color: var(--accent-bright); border-bottom: 1px dashed var(--accent-bright); font-weight: 600; text-decoration: none; }
.keyword::after { content: " \2197"; font-size: 0.8em; }
.keyword:hover { background: var(--wx-hover); }

.wx-tip { position: fixed; z-index: 1200; max-width: 22rem; padding: 0.7rem 0.9rem; background: rgba(5, 10, 18, 0.97); border: 1px solid var(--border-bright); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); pointer-events: none; }
.wx-tip__t { font: 600 0.95rem var(--serif); color: var(--accent-bright); }
.wx-tip__d { margin-top: 0.25rem; font: 400 0.84rem/1.5 var(--sans); color: var(--text-dim); }

/* ---------- Avisos ---------- */
html.wx-on .wx-article :is(.tip-box, .warning-box) { position: relative; margin: 1.25rem 0 0; padding: 0.95rem 1.1rem 0.95rem 3.3rem; color: var(--wx-body); font-size: 0.97rem; line-height: 1.65; }
html.wx-on .wx-article .tip-box { --c: var(--gold); background: var(--wx-tip-bg) !important; border-left: 4px solid var(--c) !important; }
html.wx-on .wx-article .warning-box { --c: var(--red); background: var(--wx-warn-bg) !important; border-left: 4px solid var(--c) !important; }
html.wx-on .wx-article :is(.tip-box, .warning-box)::before { content: 'i'; position: absolute; left: 1rem; top: 0.95rem; width: 1.55rem; height: 1.55rem; display: grid; place-items: center; border: 1.5px solid var(--c); border-radius: 50%; color: var(--c); font: 700 0.9rem var(--mono); }
html.wx-on .wx-article .warning-box::before { content: '!'; }
html.wx-on .wx-article :is(.tip-box, .warning-box) > strong:first-child { color: var(--c); }
html.wx-on .wx-article .server-note { background: var(--wx-tip-bg); }

/* ---------- Tablas ---------- */
html.wx-on .wx-tw { overflow: auto; max-height: min(72vh, 680px); overscroll-behavior-x: contain; scrollbar-width: thin; border: 1px solid var(--border);
  background:
    linear-gradient(to right, var(--bg-card) 30%, transparent) 0 0 / 2.5rem 100% no-repeat local,
    linear-gradient(to left, var(--bg-card) 30%, transparent) 100% 0 / 2.5rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--wx-glow), transparent) 0 0 / 0.8rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--wx-glow), transparent) 100% 0 / 0.8rem 100% no-repeat scroll,
    var(--bg-card); }
html.wx-on .wx-tablewrap { margin: 1rem 0; }
html.wx-on .wx-tw table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.95rem; }
html.wx-on .wx-tw thead th { position: sticky; top: 0; z-index: 2; padding: 0.7rem 1rem; text-align: left; white-space: nowrap; background: var(--bg-card) !important; box-shadow: inset 0 -2px 0 var(--border-bright); color: var(--text) !important; font-weight: 600 !important; }
html.wx-on .wx-tw::after { display: none; }
html.wx-on .wx-tw td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
html.wx-on .wx-tw tbody tr:nth-child(even) td { background: var(--wx-zebra); }
html.wx-on .wx-tw tbody tr:hover td { background: var(--wx-hover); }
html.wx-on .wx-tw tbody tr:last-child td { border-bottom: 0; }
html.wx-on .wx-tw th.r, html.wx-on .wx-tw td.r { text-align: right; }
html.wx-on .wx-tw:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ---------- Receta de Chaos Machine: tarjeta de ingredientes ---------- */
html.wx-on .recipe-card { overflow: visible; padding: 1.9rem 1.9rem 1.7rem; }
html.wx-on .recipe-card + .recipe-card::before { content: '▼'; position: absolute; left: 50%; top: -1.6rem; transform: translateX(-50%); color: var(--accent-bright); font-size: 0.8rem; opacity: 0.8; }
html.wx-on .recipe-ingredients { display: grid; gap: 0.6rem; transform-style: preserve-3d; }
html.wx-on .ingredient { position: relative; flex-wrap: wrap; gap: 0.9rem; padding: 0.7rem 1rem; font-size: 1rem; border-color: var(--border); transform: translateZ(calc(var(--k, 1) * 1px)); transition: transform 0.25s var(--wx-ease), border-color 0.2s, filter 0.25s; }
html.wx-on .ingredient--plus { padding: 0.25rem; background: none; border: 0; }
html.wx-on .ingredient__icon { flex: none; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; font-size: 1.35rem; border: 1px solid var(--border-bright); background: var(--wx-slot); }
html.wx-on .ingredient__name { min-width: 10rem; color: var(--text); font-weight: 500; }
html.wx-on .ingredient__qty { color: var(--gold); font: 600 0.95rem var(--mono); }
html.wx-on .ingredient__req { flex-basis: 100%; padding-left: 3.4rem; color: var(--accent-bright); font-size: 0.86rem; }
html.wx-on .ingredient:hover { border-color: var(--accent-bright); }
html.wx-on .recipe-result { padding: 0.9rem 1.1rem; border-color: var(--green); background: var(--wx-ok-bg); }
html.wx-on .recipe-result__label { font: 400 0.78rem var(--mono); color: var(--text-dim); text-transform: none; letter-spacing: 0; }
html.wx-on .recipe-result__name { color: var(--green); font-size: 1.02rem; }
html.wx-on .rate-badge { font-family: var(--mono); }

.wx-copy { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.65rem; background: var(--wx-inset); border: 1px solid var(--border-bright); border-radius: 0; color: var(--text-dim); font: 500 0.8rem var(--mono); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.wx-copy:hover, .wx-copy:focus-visible { color: var(--accent-bright); border-color: var(--accent-bright); }
.wx-copy.is-done { color: var(--green); border-color: var(--green); }
.wx-copy--card { position: absolute; right: 1.2rem; top: 1.3rem; z-index: 3; }
.wx-copy--inline { margin-left: 0.4rem; vertical-align: middle; }

/* ---------- Misiones ---------- */
html.wx-on .quest-card { padding: 1.9rem; }
html.wx-on .quest-title { font-size: 1.45rem; }
html.wx-on .quest-steps { gap: 0.6rem; }
html.wx-on .reward-card { background: var(--wx-ok-bg); }

/* ---------- Anterior / siguiente ---------- */
html.wx-on .wx-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 2.2rem; }
html.wx-on .wx-pager a, html.wx-on .wx-pager .wx-pager__a { display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem 1.2rem; background: var(--bg-card); border: 1px solid var(--border-bright); border-radius: 0; color: var(--text); font-size: 1rem; line-height: 1.4; transition: border-color 0.2s, background 0.2s, transform 0.2s var(--wx-ease); }
html.wx-on .wx-pager a:hover { border-color: var(--accent-bright); background: var(--wx-hover); }
html.wx-on .wx-pager small { font: 400 0.76rem var(--mono); color: var(--text-dim); }
html.wx-on .wx-pager b { font-weight: 600; color: var(--accent-bright); }
html.wx-on .wx-pager .wx-pager__a--next { grid-column: 2; text-align: right; }
html.wx-on .wx-pager .wx-pager__a--prev { grid-column: 1; }

/* ---------- Botón flotante y hoja de menú (móvil) ---------- */
.wx-fab { display: none; position: fixed; z-index: 1000; left: 1rem; bottom: 1rem; align-items: center; gap: 0.5rem; padding: 0.7rem 1rem; background: var(--bg-card); border: 1px solid var(--accent-bright); border-radius: 0; color: var(--text); font: 600 0.9rem var(--sans); cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.wx-fab__i { color: var(--accent-bright); font-size: 1.1rem; }
.wx-scrim { position: fixed; inset: 0; z-index: 1040; background: rgba(2, 6, 12, 0.7); opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; }
.wx-scrim.is-open { opacity: 1; visibility: visible; }

/* ---------- Entrada escalonada, tilt y efectos (Nivel B) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.wx-motion [data-wx-reveal] { opacity: 0; translate: 0 22px; transition: opacity 0.65s var(--wx-ease) calc(var(--i, 0) * 70ms), translate 0.65s var(--wx-ease) calc(var(--i, 0) * 70ms), transform 0.2s ease-out; }
  html.wx-motion [data-wx-reveal].is-in { opacity: 1; translate: 0 0; }
  html.wx-on [data-fx~="tilt"] { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; }
  html.wx-on .recipe-card:hover .ingredient { transform: translateZ(calc(var(--k, 1) * 5px)); }
  html.wx-on .recipe-card .ingredient:hover { transform: translateZ(30px); filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.55)); }
  html.wx-on .recipe-card.is-in .ingredient { animation: wxIngIn 0.5s var(--wx-ease) backwards; animation-delay: calc(var(--k, 1) * 70ms + 150ms); }
  .wx-hero__floor, .hhero__floor { animation: wxFloor 5s linear infinite; }
  .wx-hero__rings i:nth-child(1), .hhero__rings i:nth-child(1) { animation: wxSpin 46s linear infinite; }
  .wx-hero__rings i:nth-child(2), .hhero__rings i:nth-child(2) { animation: wxSpin 24s linear infinite reverse; }
  .wx-hero__rings i:nth-child(3), .hhero__rings i:nth-child(3) { animation: wxSpin 36s linear infinite; }
  html { scroll-behavior: smooth; }
}
@keyframes wxIngIn { from { opacity: 0; transform: translate3d(-16px, 0, 0); } }
@keyframes wxFloor { to { background-position: 0 56px, 0 0; } }
@keyframes wxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wx-hero__bg, .wx-hero__glyph, .wx-hero__rings, .hhero__plane, .hhero__rings, .hhero__stack { transform: none; }
  .wx-hero__rings, .hhero__rings { transform: translateY(-48%) perspective(800px) rotateX(70deg); }
  .wx-hero__glyph { transform: translateY(-50%); }
}

/* Luz que sigue al cursor (borde) en las tarjetas del hub */
.hcard[data-fx], .hcat[data-fx] { --gc: var(--accent-bright); }
.hcard[data-fx]::before, .hcat[data-fx]::before { content: ''; position: absolute; inset: -1px; padding: 1px; pointer-events: none; opacity: 0; transition: opacity 0.25s; z-index: 3;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--gc), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.hcard[data-fx]:hover::before, .hcat[data-fx]:hover::before { opacity: 1; }

/* =========================================================
   Portada de la wiki (hub)
   ========================================================= */
.hhero { position: relative; overflow: hidden; isolation: isolate; padding: clamp(64px, 9vw, 110px) 0 clamp(40px, 5vw, 64px); border-bottom: 1px solid var(--border-bright); --px: 0; --py: 0; --sy: 0px; color: var(--text); }
.hhero::before { content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none; background: linear-gradient(90deg, rgba(4, 8, 14, 0.97) 0%, rgba(4, 8, 14, 0.78) 48%, rgba(4, 8, 14, 0.3) 100%); }
.hhero__plane { position: absolute; inset: 0; z-index: -3; transform: translate3d(calc(var(--px) * -14px), calc(var(--py) * -8px + var(--sy) * 0.05), 0) scale(1.1); }
.hhero__plane img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 40%; }
.hhero__fog { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(40% 50% at 78% 60%, rgba(31, 166, 217, 0.16), transparent 70%); }
.hhero__floor, .hhero__rings { z-index: -1; pointer-events: none; }
.hhero__inner { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 24rem); gap: clamp(28px, 5vw, 72px); align-items: center; position: relative; z-index: 1; }
.hhero__kicker { font: 400 0.9rem var(--mono); color: var(--accent-bright); margin-bottom: 0.9rem; }
.hhero h1 { font-size: clamp(2.5rem, 5.4vw, 4.6rem); line-height: 1; font-weight: 700; letter-spacing: -0.02em; }
.hhero h1 span { display: block; }
.hhero__brand { color: var(--accent-bright); }
.hhero__lead { margin-top: 1.1rem; max-width: 46ch; font-size: 1.15rem; color: #c3d3e2; }
.hsearch { position: relative; max-width: 40rem; margin-top: 1.9rem; }
.hsearch svg { position: absolute; left: 1rem; top: 50%; width: 1.3rem; height: 1.3rem; transform: translateY(-50%); color: var(--accent-bright); pointer-events: none; }
.hsearch input { width: 100%; padding: 1.05rem 5.2rem 1.05rem 3.1rem; background: rgba(5, 10, 18, 0.88); border: 1px solid var(--border-bright); border-radius: 0; color: var(--text); font: 400 1.08rem var(--sans); box-shadow: 0 0 40px rgba(31, 166, 217, 0.12); }
.hsearch input::placeholder { color: var(--text-dim); }
.hsearch input:focus { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.hsearch kbd { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font: 500 0.78rem var(--mono); color: var(--text-dim); border: 1px solid var(--border-bright); padding: 0.1rem 0.45rem; pointer-events: none; }
.htry { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; font: 400 0.82rem var(--mono); color: var(--text-dim); }
.hchip { padding: 0.25rem 0.7rem; background: transparent; border: 1px solid var(--border-bright); border-radius: 0; color: var(--text); font: 500 0.82rem var(--mono); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.hchip:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.hstats { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem 2.4rem; margin-top: 2.1rem; padding-top: 1.2rem; border-top: 1px solid var(--border); max-width: 34rem; }
.hstat { display: flex; flex-direction: column; }
.hstat b { font: 700 2rem/1.1 var(--serif); color: var(--accent-bright); font-variant-numeric: tabular-nums; }
.hstat span { font: 400 0.8rem var(--mono); color: var(--text-dim); }

.hhero__stack { position: relative; height: 22rem; perspective: 1100px; transform: rotateX(calc(var(--py) * -5deg)) rotateY(calc(var(--px) * 7deg)); transform-style: preserve-3d; }
.hlayer { position: absolute; width: 15.5rem; padding: 1rem 1.1rem; background: rgba(6, 12, 22, 0.86); border: 1px solid var(--border-bright); box-shadow: 0 24px 40px -20px rgba(0, 0, 0, 0.8); transform-style: preserve-3d; }
.hlayer--1 { left: 0; top: 0; transform: translateZ(0) rotateZ(-3deg); }
.hlayer--2 { right: 0; top: 7rem; transform: translateZ(60px) rotateZ(2deg); border-color: var(--accent-bright); }
.hlayer--3 { left: 2.2rem; top: 14.2rem; transform: translateZ(120px) rotateZ(-1deg); }
.hlayer__top { display: flex; align-items: center; gap: 0.7rem; font: 600 1rem var(--serif); color: var(--text); }
.hlayer__ico { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; font-size: 1.4rem; border: 1px solid var(--border-bright); background: var(--wx-slot); }
.hlayer__bars { margin-top: 0.8rem; display: grid; gap: 0.35rem; }
.hlayer__bars i { display: block; height: 4px; background: var(--border); }
.hlayer__bars i:nth-child(1) { width: 92%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.hlayer__bars i:nth-child(2) { width: 70%; }
.hlayer__bars i:nth-child(3) { width: 46%; }

.hub { position: relative; z-index: 1; padding: 2.6rem 0 4.5rem; }
.hub .container { max-width: 1240px; }
.hlabel { font: 400 0.85rem var(--mono); color: var(--text-dim); margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); }
.hquick { margin-bottom: 2.6rem; }
.hquick__list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.hq { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem; background: var(--bg-card); border: 1px solid var(--border-bright); color: var(--text); font-weight: 600; transition: border-color 0.2s, transform 0.2s var(--wx-ease), color 0.2s; }
.hq:hover { border-color: var(--accent-bright); color: var(--accent-bright); transform: translateY(-2px); }
.hq__ico { font-size: 1.25rem; }
.hgroup { margin-bottom: 2.6rem; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 1.1rem; perspective: 1200px; }

.hcard { position: relative; display: flex; flex-direction: column; gap: 0.75rem; min-height: 15.5rem; padding: 1.5rem 1.4rem 1.25rem; background: var(--bg-card); border: 1px solid var(--border-bright); color: var(--text); transition: border-color 0.2s; }
.hcard::after, .hcat::after { content: ''; position: absolute; inset: -1px; pointer-events: none; z-index: 2;
  background:
    linear-gradient(var(--accent-bright), var(--accent-bright)) top left / 14px 2px no-repeat,
    linear-gradient(var(--accent-bright), var(--accent-bright)) top left / 2px 14px no-repeat,
    linear-gradient(var(--accent-bright), var(--accent-bright)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--accent-bright), var(--accent-bright)) bottom right / 2px 14px no-repeat; }
.hcard:hover::after, .hcat:hover::after { background:
    linear-gradient(var(--green), var(--green)) top left / 14px 2px no-repeat,
    linear-gradient(var(--green), var(--green)) top left / 2px 14px no-repeat,
    linear-gradient(var(--green), var(--green)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--green), var(--green)) bottom right / 2px 14px no-repeat; }
.hcard:hover, .hcat:hover { border-color: var(--accent-bright); }
.hcard__icon { width: 4rem; height: 4rem; display: grid; place-items: center; font-size: 2.2rem; line-height: 1; border: 1px solid var(--border-bright); background: var(--wx-slot); transition: border-color 0.2s; }
.hcard:hover .hcard__icon { border-color: var(--green); }
.hcard__title { font: 600 1.3rem/1.25 var(--serif); }
.hcard:hover .hcard__title { color: var(--accent-bright); }
.hcard__desc { color: var(--text-dim); font-size: 0.95rem; line-height: 1.6; }
.hcard__meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 0.5rem; font: 500 0.85rem var(--mono); color: var(--accent-bright); }
.hcard__meta b { font-weight: 700; font-size: 1.05rem; }
.hcard__go { transition: transform 0.2s var(--wx-ease); }
.hcard:hover .hcard__go { transform: translateX(5px); }
@media (prefers-reduced-motion: no-preference) {
  .hcard[data-fx] { transform-style: preserve-3d; }
  .hcard[data-fx] .hcard__icon { transform: translateZ(38px); }
  .hcard[data-fx] .hcard__title { transform: translateZ(22px); }
  .hcard[data-fx] .hcard__meta { transform: translateZ(12px); }
  .hcat[data-fx] { transform-style: preserve-3d; }
  .hcat[data-fx] .hcat__ico { transform: translateZ(24px); }
}

.hchaos { margin-bottom: 2.6rem; }
.hchaos__sub { color: var(--text-dim); margin: -0.4rem 0 1.1rem; }
.hcats { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 0.9rem; perspective: 1200px; }
.hcat { position: relative; display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.1rem; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); transition: border-color 0.2s; }
.hcat__ico { flex: none; width: 2.7rem; height: 2.7rem; display: grid; place-items: center; font-size: 1.5rem; border: 1px solid var(--border-bright); background: var(--wx-slot); }
.hcat__txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; font-weight: 600; }
.hcat__txt small { font: 400 0.8rem var(--mono); color: var(--text-dim); }

.hresults { margin-bottom: 2.6rem; }
.hresults .wx-res-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
.hresults .wx-res { background: var(--bg-card); border: 1px solid var(--border); border-left: 2px solid transparent; margin-bottom: 0.5rem; }
.hstatus { font: 400 0.85rem var(--mono); color: var(--text-dim); margin-bottom: 0.9rem; }

.hindex { border: 1px solid var(--border); background: var(--bg-card); }
.hindex > summary { cursor: pointer; padding: 0.9rem 1.2rem; font: 500 0.9rem var(--mono); color: var(--accent-bright); }
.hindex__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.4rem; padding: 0.4rem 1.2rem 1.3rem; }
.hindex__h { font: 400 0.78rem var(--mono); color: var(--text-dim); margin-bottom: 0.4rem; }
.hindex ul { list-style: none; }
.hindex li a { display: block; padding: 0.3rem 0; color: var(--text); }
.hindex li a:hover { color: var(--accent-bright); }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  html.wx-on .wx-shell, html.wx-on .wx-shell.wx-no-toc { grid-template-columns: var(--wx-side-w) minmax(0, 1fr); }
  .wx-toc { display: none; }
  .wx-toc-inline { display: block; }
}
@media (max-width: 1020px) {
  html.wx-on .wx-shell, html.wx-on .wx-shell.wx-no-toc { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wx-side { position: fixed; z-index: 1050; top: 0; bottom: 0; left: 0; width: min(86vw, 22rem); max-height: none; transform: translateX(-104%); visibility: hidden; transition: transform 0.28s var(--wx-ease), visibility 0.28s; background: var(--bg-card); }
  .wx-side.is-open { transform: none; visibility: visible; }
  .wx-side__close { display: grid; place-items: center; }
  .wx-fab { display: inline-flex; }
  html.wx-on .wiki-content { padding-bottom: 5.5rem; }
  .hhero__inner { grid-template-columns: minmax(0, 1fr); }
  .hhero__stack { display: none; }
  .hresults .wx-res-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  html.wx-on .recipe-card, html.wx-on .quest-card { padding: 1.3rem 1.1rem; }
  html.wx-on .wx-copy--card { position: static; margin: 1rem 0 0; }
  html.wx-on .ingredient__name { min-width: 0; flex-basis: calc(100% - 4rem); }
  html.wx-on .wx-pager { grid-template-columns: minmax(0, 1fr); }
  html.wx-on .wx-pager .wx-pager__a--next { grid-column: 1; text-align: left; }
  html.wx-on .wx-tw { max-height: 65vh; }
  .wx-hero__glyph { opacity: 0.1; }
  .hstat b { font-size: 1.6rem; }
  .hsearch input { padding-right: 1rem; }
  .hsearch kbd { display: none; }
}
@media print {
  .wx-side, .wx-toc, .wx-toc-inline, .wx-fab, .wx-scrim, .wx-progress, .wx-copy { display: none !important; }
  html.wx-on .wx-shell { display: block; }
  [data-wx-reveal] { opacity: 1 !important; translate: none !important; }
}
